Skip to contentSkip to conversation

SQUASHME: pnfs-submit: Use LAYOUT_NFSV4_1_FILES instead of LAYOUT_NFSV4_FILES

PATCH In review Ricardo Labiaga 3 participants 9 messages May 24, 2010 – May 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 SQUASHME: pnfs-submit: Use LAYOUT_NFSV4_1_FILES instead of LAYOUT_NFSV4_FILES

So that we can be consistent with the spec definitions.

---
 fs/nfs/nfs4filelayout.c    |    4 ++--
 fs/nfs/nfs4filelayoutdev.c |    2 +-
 include/linux/nfs4.h       |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
fs/nfs/nfs4filelayout.c +2 -2
index 9d1274d..d39315a 100644
@@ -766,8 +766,8 @@ struct layoutdriver_policy_operations filelayout_policy_operations = {
 };
 
 struct pnfs_layoutdriver_type filelayout_type = {
-	.id = LAYOUT_NFSV4_FILES,
-	.name = "LAYOUT_NFSV4_FILES",
+	.id = LAYOUT_NFSV4_1_FILES,
+	.name = "LAYOUT_NFSV4_1_FILES",
 	.ld_io_ops = &filelayout_io_operations,
 	.ld_policy_ops = &filelayout_policy_operations,
 };
fs/nfs/nfs4filelayoutdev.c +1 -1
index 462f6de..b540679 100644
@@ -510,7 +510,7 @@ get_device_info(struct inode *inode, struct pnfs_deviceid *dev_id)
 		goto out_free;
 
 	memcpy(&pdev->dev_id, dev_id, NFS4_PNFS_DEVICEID4_SIZE);
-	pdev->layout_type = LAYOUT_NFSV4_FILES;
+	pdev->layout_type = LAYOUT_NFSV4_1_FILES;
 	pdev->pages = pages;
 	pdev->pgbase = 0;
 	pdev->pglen = PAGE_SIZE * max_pages;
include/linux/nfs4.h +1 -1
index 1730e86..219e6b4 100644
@@ -565,7 +565,7 @@ enum state_protect_how4 {
 };
 
 enum pnfs_layouttype {
-	LAYOUT_NFSV4_FILES  = 1,
+	LAYOUT_NFSV4_1_FILES  = 1,
 	LAYOUT_OSD2_OBJECTS = 2,
 	LAYOUT_BLOCK_VOLUME = 3,
 };
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH 2/2 pnfs-submit: Dynamically load the nfslayoutdriver

Load the files layout driver if the server indicates that it supports LAYOUT4_NFSV4_1_FILES. Other layouts can be loaded in a similar fashion. The module can be blacklisted to disable pNFS support for the corresponding layout type.

---
 fs/nfs/pnfs.c |   17 +++++++++++++++--
 fs/nfs/pnfs.h |    2 ++
 2 files changed, 17 insertions(+), 2 deletions(-)
fs/nfs/pnfs.c +15 -2
index 57d3ff0..6a89279 100644
@@ -205,12 +205,24 @@ unmount_pnfs_layoutdriver(struct nfs_server *nfss)
 void
 set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
 {
-	struct pnfs_module *mod;
+	struct pnfs_module *mod = NULL;
 
 	if (server->pnfs_curr_ld)
 		return;
 
-	if (id > 0 && find_pnfs(id, &mod)) {
+	if (!find_pnfs(id, &mod)) {
+		switch (id) {
+		case LAYOUT_NFSV4_1_FILES:
+			request_module(LAYOUT_NFSV4_1_FILES_MODULE);
+			break;
+		default:
+			goto out_not_found;
+		};
+
+		find_pnfs(id, &mod);
+	}
+
+	if (mod) {
 		if (mod->pnfs_ld_type->ld_io_ops->initialize_mountpoint(
 			server->nfs_client)) {
 			printk(KERN_ERR "%s: Error initializing mount point "
@@ -227,6 +239,7 @@ set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
 		return;
 	}
 
+out_not_found:
 	dprintk("%s: No pNFS module found for %u. ", __func__, id);
 out_err:
 	dprintk("Using NFSv4 I/O\n");
fs/nfs/pnfs.h +2 -0
index b80157b..dac955e 100644
@@ -80,6 +80,8 @@ void _pnfs_direct_init_io(struct inode *inode, struct nfs_open_context *ctx,
 				     (srv)->pnfs_curr_ld->ld_policy_ops && \
 				     (srv)->pnfs_curr_ld->ld_policy_ops->opname)
 
+#define LAYOUT_NFSV4_1_FILES_MODULE "nfslayoutdriver"
+
 static inline int lo_fail_bit(u32 iomode)
 {
 	return iomode == IOMODE_RW ?
Signature · 1 line
1.5.4.3
#2 lore raw

Re: [PATCH 2/2] pnfs-submit: Dynamically load the nfslayoutdriver

Quoted 6 lines · Ricardo Labiaga

Load the files layout driver if the server indicates that it supports LAYOUT4_NFSV4_1_FILES. Other layouts can be loaded in a similar fashion. The module can be blacklisted to disable pNFS support for the corresponding layout type.

Committed at pnfs-all-2.6.34-2010-05-25

Thanks!

Benny

Quoted 57 lines
---
 fs/nfs/pnfs.c |   17 +++++++++++++++--
 fs/nfs/pnfs.h |    2 ++
 2 files changed, 17 insertions(+), 2 deletions(-)
fs/nfs/pnfs.c +15 -2
index 57d3ff0..6a89279 100644
@@ -205,12 +205,24 @@ unmount_pnfs_layoutdriver(struct nfs_server *nfss)
 void
 set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
 {
-	struct pnfs_module *mod;
+	struct pnfs_module *mod = NULL;
 
 	if (server->pnfs_curr_ld)
 		return;
 
-	if (id > 0 && find_pnfs(id, &mod)) {
+	if (!find_pnfs(id, &mod)) {
+		switch (id) {
+		case LAYOUT_NFSV4_1_FILES:
+			request_module(LAYOUT_NFSV4_1_FILES_MODULE);
+			break;
+		default:
+			goto out_not_found;
+		};
+
+		find_pnfs(id, &mod);
+	}
+
+	if (mod) {
 		if (mod->pnfs_ld_type->ld_io_ops->initialize_mountpoint(
 			server->nfs_client)) {
 			printk(KERN_ERR "%s: Error initializing mount point "
@@ -227,6 +239,7 @@ set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
 		return;
 	}
 
+out_not_found:
 	dprintk("%s: No pNFS module found for %u. ", __func__, id);
 out_err:
 	dprintk("Using NFSv4 I/O\n");
fs/nfs/pnfs.h +2 -0
index b80157b..dac955e 100644
@@ -80,6 +80,8 @@ void _pnfs_direct_init_io(struct inode *inode, struct nfs_open_context *ctx,
 				     (srv)->pnfs_curr_ld->ld_policy_ops && \
 				     (srv)->pnfs_curr_ld->ld_policy_ops->opname)
 
+#define LAYOUT_NFSV4_1_FILES_MODULE "nfslayoutdriver"
+
 static inline int lo_fail_bit(u32 iomode)
 {
 	return iomode == IOMODE_RW ?
#3 lore raw

PATCH 1/3 SQUASHME: pnfsd: dlm: fixup LAYOUT_NFSV4_1_FILES

In reply to Ricardo Labiaga
---
 fs/nfsd/nfs4pnfsdlm.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
fs/nfsd/nfs4pnfsdlm.c +5 -5
index b724991..0cc295c 100644
@@ -171,7 +171,7 @@ static int nfsd4_pnfs_dlm_getdeviter(struct super_block *sb,
 				     u32 layout_type,
 				     struct nfsd4_pnfs_dev_iter_res *res)
 {
-	if (layout_type != LAYOUT_NFSV4_FILES) {
+	if (layout_type != LAYOUT_NFSV4_1_FILES) {
 		printk(KERN_ERR "%s: ERROR: layout type isn't 'file' "
 			"(type: %x)\n", __func__, layout_type);
 		return -ENOTSUPP;
@@ -199,7 +199,7 @@ static int nfsd4_pnfs_dlm_getdevinfo(struct super_block *sb,
 	char   *bufp;
 
 	err = -ENOTSUPP;
-	if (layout_type != LAYOUT_NFSV4_FILES) {
+	if (layout_type != LAYOUT_NFSV4_1_FILES) {
 		dprintk("%s: ERROR: layout type isn't 'file' "
 			"(type: %x)\n", __func__, layout_type);
 		return err;
@@ -343,7 +343,7 @@ static enum nfsstat4 nfsd4_pnfs_dlm_layoutget(struct inode *inode,
 	if (index < 0)
 		return NFS4ERR_LAYOUTUNAVAILABLE;
 
-	res->lg_seg.layout_type = LAYOUT_NFSV4_FILES;
+	res->lg_seg.layout_type = LAYOUT_NFSV4_1_FILES;
 	/* Always give out whole file layouts */
 	res->lg_seg.offset = 0;
 	res->lg_seg.length = NFS4_MAX_UINT64;
@@ -357,7 +357,7 @@ static enum nfsstat4 nfsd4_pnfs_dlm_layoutget(struct inode *inode,
 	}
 
 	/* Set file layout response args */
-	layout->lg_layout_type = LAYOUT_NFSV4_FILES;
+	layout->lg_layout_type = LAYOUT_NFSV4_1_FILES;
 	layout->lg_stripe_type = STRIPE_SPARSE;
 	layout->lg_commit_through_mds = false;
 	layout->lg_stripe_unit = get_stripe_unit(inode->i_sb->s_blocksize);
@@ -392,7 +392,7 @@ error:
 static int
 nfsd4_pnfs_dlm_layouttype(struct super_block *sb)
 {
-	return LAYOUT_NFSV4_FILES;
+	return LAYOUT_NFSV4_1_FILES;
 }
 
 /* For use by DLM cluster file systems exported by pNFSD */
Signature · 1 line
1.6.6.1
#4 lore raw

PATCH 2/3 SQUASHME: pnfsd-lexp: fixup LAYOUT_NFSV4_1_FILES

In reply to Ricardo Labiaga
---
 fs/nfsd/pnfsd_lexp.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
fs/nfsd/pnfsd_lexp.c +5 -5
index 2d95913..bf2f403 100644
@@ -31,7 +31,7 @@ size_t pnfs_lexp_addr_len;
 static int
 pnfsd_lexp_layout_type(struct super_block *sb)
 {
-	int ret = LAYOUT_NFSV4_FILES;
+	int ret = LAYOUT_NFSV4_1_FILES;
 	dprintk("<-- %s: return %d\n", __func__, ret);
 	return ret;
 }
@@ -43,7 +43,7 @@ pnfsd_lexp_get_device_iter(struct super_block *sb,
 {
 	dprintk("--> %s: sb=%p\n", __func__, sb);
 
-	BUG_ON(layout_type != LAYOUT_NFSV4_FILES);
+	BUG_ON(layout_type != LAYOUT_NFSV4_1_FILES);
 
 	res->gd_eof = 1;
 	if (res->gd_cookie)
@@ -72,7 +72,7 @@ pnfsd_lexp_get_device_info(struct super_block *sb,
 
 	dprintk("--> %s: sb=%p\n", __func__, sb);
 
-	BUG_ON(layout_type != LAYOUT_NFSV4_FILES);
+	BUG_ON(layout_type != LAYOUT_NFSV4_1_FILES);
 
 	memset(&fdev, '\0', sizeof(fdev));
 
@@ -138,7 +138,7 @@ pnfsd_lexp_layout_get(struct inode *inode,
 
 	dprintk("--> %s: inode=%p\n", __func__, inode);
 
-	res->lg_seg.layout_type = LAYOUT_NFSV4_FILES;
+	res->lg_seg.layout_type = LAYOUT_NFSV4_1_FILES;
 	res->lg_seg.offset = 0;
 	res->lg_seg.length = NFS4_MAX_UINT64;
 
@@ -149,7 +149,7 @@ pnfsd_lexp_layout_get(struct inode *inode,
 	}
 
 	/* Set file layout response args */
-	layout->lg_layout_type = LAYOUT_NFSV4_FILES;
+	layout->lg_layout_type = LAYOUT_NFSV4_1_FILES;
 	layout->lg_stripe_type = STRIPE_SPARSE;
 	layout->lg_commit_through_mds = true;
 	layout->lg_stripe_unit = get_stripe_unit(inode->i_sb->s_blocksize);
Signature · 1 line
1.6.6.1
#5 lore raw

PATCH 3/3 SQUASHME: spnfs: fixup LAYOUT_NFSV4_1_FILES

In reply to Ricardo Labiaga
---
 fs/nfsd/spnfs_ops.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/spnfs_ops.c +2 -2
index 230fb59..b97a5af 100644
@@ -57,7 +57,7 @@ extern struct spnfs *global_spnfs;
 int
 spnfs_layout_type(struct super_block *sb)
 {
-	return LAYOUT_NFSV4_FILES;
+	return LAYOUT_NFSV4_1_FILES;
 }
 
 enum nfsstat4
@@ -218,7 +218,7 @@ spnfs_layoutrecall(struct inode *inode, int type, u64 offset, u64 len)
 	}
 
 	lr.cbl_recall_type = type;
-	lr.cbl_seg.layout_type = LAYOUT_NFSV4_FILES;
+	lr.cbl_seg.layout_type = LAYOUT_NFSV4_1_FILES;
 	lr.cbl_seg.clientid = 0;
 	lr.cbl_seg.offset = offset;
 	lr.cbl_seg.length = len;
Signature · 1 line
1.6.6.1
#6 lore raw

Re: [PATCH 3/3] SQUASHME: spnfs: fixup LAYOUT_NFSV4_1_FILES

Quoted 19 lines · Benny Halevy
---
 fs/nfsd/spnfs_ops.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/spnfs_ops.c +1 -1
index 230fb59..b97a5af 100644
@@ -57,7 +57,7 @@ extern struct spnfs *global_spnfs;
 int
 spnfs_layout_type(struct super_block *sb)
 {
-	return LAYOUT_NFSV4_FILES;
+	return LAYOUT_NFSV4_1_FILES;
 }
 
 enum nfsstat4

fs/nfsd/spnfs_ops.c spnfs_layoutrecall(struct inode *inode, int type, u64 offset, u64 len) · line 224

Quoted 8 lines
fs/nfsd/spnfs_ops.c +1 -1
@@ -218,7 +218,7 @@ spnfs_layoutrecall(struct inode *inode, int type, u64 offset, u64 len)
 	}
 
 	lr.cbl_recall_type = type;
-	lr.cbl_seg.layout_type = LAYOUT_NFSV4_FILES;
+	lr.cbl_seg.layout_type = LAYOUT_NFSV4_1_FILES;
 	lr.cbl_seg.clientid = 0;
 	lr.cbl_seg.offset = offset;
 	lr.cbl_seg.length = len;

Sorry to bother you guys but I don't like the "_" between the 4 and the 1 I would mutch prefer the LAYOUT_NFSV41_FILES format. An "_" is an heavy wait that should not be used lightly.

Boaz

#7 lore raw

Re: [PATCH 3/3] SQUASHME: spnfs: fixup LAYOUT_NFSV4_1_FILES

Quoted 22 lines · Boaz Harrosh
Quoted 21 lines · Benny Halevy
---
 fs/nfsd/spnfs_ops.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/spnfs_ops.c +1 -1
index 230fb59..b97a5af 100644
@@ -57,7 +57,7 @@ extern struct spnfs *global_spnfs;
 int
 spnfs_layout_type(struct super_block *sb)
 {
-	return LAYOUT_NFSV4_FILES;
+	return LAYOUT_NFSV4_1_FILES;
 }
 
 enum nfsstat4
@@ -218,7 +218,7 @@ spnfs_layoutrecall(struct inode *inode, int type, u64 offset, u64 len)
 	}
 
Quoted 11 lines

fs/nfsd/spnfs_ops.c spnfs_layoutrecall(struct inode *inode, int type, u64 offset, u64 len) · line 224

Quoted 6 lines
fs/nfsd/spnfs_ops.c +1 -1
 	lr.cbl_recall_type = type;
-	lr.cbl_seg.layout_type = LAYOUT_NFSV4_FILES;
+	lr.cbl_seg.layout_type = LAYOUT_NFSV4_1_FILES;
 	lr.cbl_seg.clientid = 0;
 	lr.cbl_seg.offset = offset;
 	lr.cbl_seg.length = len;

Sorry to bother you guys but I don't like the "_" between the 4 and the 1 I would mutch prefer the LAYOUT_NFSV41_FILES format. An "_" is an heavy wait that should not be used lightly.

First, that's the de-facto convention we used so far. Second, this is so unimportant I don't want to spend a second more thinking about it... :)

Benny

Quoted 5 lines

Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to Ricardo Labiaga
Quoted 3 lines · Ricardo Labiaga

So that we can be consistent with the spec definitions.

Committed at pnfs-all-2.6.34-2010-05-25

Thanks!

Benny

Quoted 47 lines
---
 fs/nfs/nfs4filelayout.c    |    4 ++--
 fs/nfs/nfs4filelayoutdev.c |    2 +-
 include/linux/nfs4.h       |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
fs/nfs/nfs4filelayout.c +2 -2
index 9d1274d..d39315a 100644
@@ -766,8 +766,8 @@ struct layoutdriver_policy_operations filelayout_policy_operations = {
 };
 
 struct pnfs_layoutdriver_type filelayout_type = {
-	.id = LAYOUT_NFSV4_FILES,
-	.name = "LAYOUT_NFSV4_FILES",
+	.id = LAYOUT_NFSV4_1_FILES,
+	.name = "LAYOUT_NFSV4_1_FILES",
 	.ld_io_ops = &filelayout_io_operations,
 	.ld_policy_ops = &filelayout_policy_operations,
 };
fs/nfs/nfs4filelayoutdev.c +1 -1
index 462f6de..b540679 100644
@@ -510,7 +510,7 @@ get_device_info(struct inode *inode, struct pnfs_deviceid *dev_id)
 		goto out_free;
 
 	memcpy(&pdev->dev_id, dev_id, NFS4_PNFS_DEVICEID4_SIZE);
-	pdev->layout_type = LAYOUT_NFSV4_FILES;
+	pdev->layout_type = LAYOUT_NFSV4_1_FILES;
 	pdev->pages = pages;
 	pdev->pgbase = 0;
 	pdev->pglen = PAGE_SIZE * max_pages;
include/linux/nfs4.h +1 -1
index 1730e86..219e6b4 100644
@@ -565,7 +565,7 @@ enum state_protect_how4 {
 };
 
 enum pnfs_layouttype {
-	LAYOUT_NFSV4_FILES  = 1,
+	LAYOUT_NFSV4_1_FILES  = 1,
 	LAYOUT_OSD2_OBJECTS = 2,
 	LAYOUT_BLOCK_VOLUME = 3,
 };