Message ID | 1380220908-14009-1-git-send-email-bhalevy@primarydata.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Seems like layout_type should just be a field in the export ops instead of a method. -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 09/29/2013 05:17 AM, Christoph Hellwig wrote: > Seems like layout_type should just be a field in the export ops instead > of a method. No! this field does not make any sense at all it should just be removed. There is a pNFS inquiry a client sends that asks for an array of all the types supported by this mount point. So these method should be returning an array. If at all. The layout_type is just an input to some operations and are no concern of NFSD. This is not a yes/no flag for pNFS the opts vector should be the flag. Cheers Boaz -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2013-10-01 04:21, Boaz Harrosh wrote: > On 09/29/2013 05:17 AM, Christoph Hellwig wrote: >> Seems like layout_type should just be a field in the export ops instead >> of a method. > > No! this field does not make any sense at all it should just be > removed. > > There is a pNFS inquiry a client sends that asks for an array > of all the types supported by this mount point. So these method > should be returning an array. If at all. We're not there yet. The pnfs generic implementation and none of the filesystems do that at the moment. When we go there we should revise the interface. > > The layout_type is just an input to some operations and are > no concern of NFSD. This is not a yes/no flag for pNFS the > opts vector should be the flag. We can push the check for the layout type down to file system but then it will have to encode FATTR4_WORD1_FS_LAYOUT_TYPES and FATTR4_WORD2_LAYOUT_TYPES. Benny > > Cheers > Boaz > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index b9c4417..83f7147 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2560,6 +2560,30 @@ static int get_parent_attributes(struct svc_export *exp, struct kstat *stat) get_parent_attributes(exp, &stat); WRITE64(stat.ino); } +#if defined(CONFIG_PNFSD) + if (bmval1 & FATTR4_WORD1_FS_LAYOUT_TYPES) { + struct super_block *sb = dentry->d_inode->i_sb; + int type = 0; + + /* Query the filesystem for supported pNFS layout types. + * Currently, we only support one layout type per file system. + * The export_ops->layout_type() returns the pnfs_layouttype4. + */ + buflen -= 4; + if (buflen < 0) /* length */ + goto out_resource; + + if (sb && sb->s_pnfs_op && sb->s_pnfs_op->layout_type) + type = sb->s_pnfs_op->layout_type(sb); + if (type) { + if ((buflen -= 4) < 0) /* type */ + goto out_resource; + WRITE32(1); /* length */ + WRITE32(type); /* type */ + } else + WRITE32(0); /* length */ + } +#endif /* CONFIG_PNFSD */ if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) { status = nfsd4_encode_security_label(rqstp, context, contextlen, &p, &buflen); diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index 30f34ab..f49fb0b 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h @@ -321,8 +321,13 @@ static inline void nfs4_reset_lease(time_t leasetime) { } #define NFSD4_1_SUPPORTED_ATTRS_WORD0 \ NFSD4_SUPPORTED_ATTRS_WORD0 +#if defined(CONFIG_PNFSD) +#define NFSD4_1_SUPPORTED_ATTRS_WORD1 \ + (NFSD4_SUPPORTED_ATTRS_WORD1 | FATTR4_WORD1_FS_LAYOUT_TYPES) +#else /* CONFIG_PNFSD */ #define NFSD4_1_SUPPORTED_ATTRS_WORD1 \ NFSD4_SUPPORTED_ATTRS_WORD1 +#endif /* CONFIG_PNFSD */ #define NFSD4_1_SUPPORTED_ATTRS_WORD2 \ (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT)