GETDEVICEINFO(二)

本文深入探讨了在MDS( Metadata Server )中处理GETDEVICEINFO请求的过程,涉及MDS如何解析报文并使用struct nfsd4_pnfs_getdevinfo数据结构存储信息。主要关注nfsd4_pnfs_dlm_getdevinfo处理函数,该函数在接收到请求后,会解析写入的DS信息,并创建struct dlm_device_entry结构来保存这些数据。
摘要由CSDN通过智能技术生成

    上一篇文章讲解了客户端deviceid相关的数据结构和操作函数,这篇文章中讲讲MDS中与deviceid相关的数据结构和操作。当MDS接收到GETDEVICEINFO请求后,会解析报文,解析出的数据存放在数据结构struct nfsd4_pnfs_getdevinfo中了,这个数据结构定义如下:

struct nfsd4_pnfs_getdevinfo {
        struct nfsd4_pnfs_deviceid gd_devid;    /* request */   // 这是deviceid
        u32                     gd_layout_type; /* request */   // 这是layout类型
        u32                     gd_maxcount;    /* request */   // 这是应答报文的最大长度
        u32                     gd_notify_types;/* request */   // 这是notification机制
        struct super_block      *gd_sb;         // 根据前面的参数查找到了文件系统超级块.
};
    解析完请求报文后,MDS会调用nfsd4_getdevinfo()处理这个请求,这个函数的代码如下:

static __be32
nfsd4_getdevinfo(struct svc_rqst *rqstp,
                struct nfsd4_compound_state *cstate,
                struct nfsd4_pnfs_getdevinfo *gdp)
{
        struct super_block *sb;
        int status;
        clientid_t clid;

        dprintk("%s: layout_type %u dev_id %llx:%llx maxcnt %u\n",
               __func__, gdp->gd_layout_type, gdp->gd_devid.sbid,
               gdp->gd_devid.devid, gdp->gd_maxcount);

	status = nfserr_inval;
        sb = find_sbid_id(gdp->gd_devid.sbid);  // 根据deviceid查找文件系统.
        dprintk("%s: sb %p\n", __func__, sb);
        if (!sb) {
                status = nfserr_noent;          // 不存在
                goto out;
        }

        /* Ensure underlying file system supports pNFS and,
         * if so, the requested layout type
         */
        // 检查文件系统支持pNFS以及指定的layout类型.
        status = nfsd4_layout_verify(sb, NULL, gdp->gd_layout_type);
        if (status)
                goto out;       // 文件系统不支持pNFS或者不支持指定的layout类型.

        /* Set up arguments so device can be retrieved at encode time */
        gdp->gd_sb = sb;
        /* Update notifications */
        copy_clientid(&clid, cstate->session);
        // 这是在设置notification机制,不过现在是一个空函数,MDS中还没有实现notification机制.
        pnfs_set_device_notify(&clid, gdp->gd_notify_types);
out:
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值