[pnfs] [PATCH 2/8] pnfs: refactor get_layout

andros at umich.edu andros at umich.edu
Mon Mar 10 14:39:14 EDT 2008


From: Andy Adamson <andros at umich.edu>

Prepare to split off pnfs_update_layout_done from pnfs_update_layout.

Signed-off-by: Andy Adamson<andros at umich.edu>
---
 fs/nfs/pnfs.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 8059181..757e917 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -472,16 +472,13 @@ lo_seg_intersecting(struct nfs4_pnfs_layout_segment *l1,
 static int
 get_layout(struct inode *ino,
 	   struct nfs_open_context *ctx,
-	   struct nfs4_pnfs_layoutget_arg *arg,
-	   struct nfs4_pnfs_layoutget_res *res)
+	   struct nfs4_pnfs_layoutget *lgp)
 {
-	int status;
+	struct nfs4_pnfs_layoutget_arg *arg = lgp->args;
 	struct nfs_server *server = NFS_SERVER(ino);
-	struct nfs4_pnfs_layoutget gdata = {
-		.args = arg,
-		.res = res,
-	};
-	dprintk("%s:Begin\n", __FUNCTION__);
+	int status;
+
+	dprintk("-->%s\n", __func__);
 
 	arg->type = server->pnfs_curr_ld->id;
 	arg->minlength = arg->lseg.length;
@@ -490,7 +487,9 @@ get_layout(struct inode *ino,
 	arg->ctx = ctx;
 
 	/* Retrieve layout information from server */
-	status = NFS_PROTO(ino)->pnfs_layoutget(&gdata);
+	status = NFS_PROTO(ino)->pnfs_layoutget(lgp);
+
+	dprintk("<-- %s status %d\n", __func__, status);
 	return status;
 }
 
@@ -823,6 +822,10 @@ pnfs_update_layout(struct inode *ino,
 {
 	struct nfs4_pnfs_layoutget_res res;
 	struct nfs4_pnfs_layoutget_arg arg;
+	struct nfs4_pnfs_layoutget gdata = {
+		.args = &arg,
+		.res = &res,
+	};
 	struct nfs_inode *nfsi = NFS_I(ino);
 	struct nfs_server *nfss = NFS_SERVER(ino);
 	struct pnfs_layout_type *layout_new;
@@ -868,7 +871,7 @@ pnfs_update_layout(struct inode *ino,
 	res.layout.buf = NULL;
 	memcpy(&layout_new->stateid.data, &arg.stateid.data, NFS4_STATEID_SIZE);
 	spin_unlock(&nfsi->lo_lock);
-	result = get_layout(ino, ctx, &arg, &res);
+	result = get_layout(ino, ctx, &gdata);
 	spin_lock(&nfsi->lo_lock);
 	/* FIXME: check for reordering using the returned sequence id */
 	memcpy(&res.stateid.data, &layout_new->stateid.data, NFS4_STATEID_SIZE);
-- 
1.5.0.2



More information about the pNFS mailing list