[pnfs] [PATCH 1/1] pnfs: Ensure file layout stripe_unit multiple of page size

Dean Hildebrand seattleplus at gmail.com
Fri May 16 14:22:29 EDT 2008


Signed-off-by: Dean Hildebrand <dhildeb at us.ibm.com>
---
 fs/nfs/nfs4filelayout.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index c7d043b..27d5b17 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -412,6 +412,7 @@ filelayout_free_layout(struct pnfs_layout_type *layoutid)
  *    is wrong.
  * 2) pattern_offset is ignored and must == 0 which is wrong;
  * 3) the pattern_offset needs to be a mutliple of the stripe unit.
+ * 4) stripe unit is multiple of page size
 */
 
 static int
@@ -421,6 +422,7 @@ filelayout_check_layout(struct pnfs_layout_type *lo,
 	struct nfs4_filelayout_segment *fl = LSEG_LD_DATA(lseg);
 	struct nfs4_pnfs_dev_item *dev;
 	int status = -EINVAL;
+	struct nfs_server *nfss = NFS_SERVER(PNFS_INODE(lo));
 
 	dprintk("--> %s\n", __func__);
 	dev = nfs4_pnfs_device_item_get(FILE_MT(lo->inode), NFS_FH(lo->inode),
@@ -444,6 +446,17 @@ filelayout_check_layout(struct pnfs_layout_type *lo,
 				__func__, fl->pattern_offset);
 		goto out;
 	}
+
+	if (fl->stripe_unit % PAGE_SIZE) {
+		dprintk("%s Stripe unit (%u) not page aligned\n",
+			__func__, fl->stripe_unit);
+		goto out;
+	}
+
+	if (fl->stripe_unit % nfss->ds_rsize || fl->stripe_unit % nfss->ds_wsize) {
+		dprintk("%s Stripe unit (%u) not aligned with rsize %u wsize %u\n",
+			__func__, fl->stripe_unit, nfss->ds_rsize, nfss->ds_wsize);
+	}
 	status = 0;
 out:
 	dprintk("--> %s returns %d\n", __func__, status);
-- 
1.5.3.3



More information about the pNFS mailing list