Blob Blame History Raw
commit 4c0c700c85cdd097af5d9be2e452d4027e430d0f
Author: Mike Sager <sager@netapp.com>
Date:   Thu Feb 7 20:19:03 2008 -0800

    Update layoutget per draft 13
    
    Also, change spnfs layoutget handling to reflect generic pnfs interface
    changes
    
    Signed-off-by: Mike Sager <sager@netapp.com>

diff --git a/utils/spnfsd/nfsd4_spnfs.h b/utils/spnfsd/nfsd4_spnfs.h
index 7619c75..4b3ce7f 100644
--- a/utils/spnfsd/nfsd4_spnfs.h
+++ b/utils/spnfsd/nfsd4_spnfs.h
@@ -58,7 +58,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #define	SPNFS_MAX_DEVICES		1
 #define	SPNFS_MAX_DATA_SERVERS		2
-#define	SPNFS_MAX_LAYOUT		8
 
 /* layout */
 struct spnfs_msg_layoutget_args {
@@ -66,18 +65,17 @@ struct spnfs_msg_layoutget_args {
 };
 
 struct spnfs_filelayout_list {
-	u_int32_t	dev_id;
-	u_int32_t       ds_index;
 	u_int32_t       fh_len;
 	unsigned char   fh_val[128]; /* DMXXX fix this const */
 };
 
 struct spnfs_msg_layoutget_res {
 	int status;
+	u_int32_t dev_id;
 	u_int64_t stripe_size;
 	u_int32_t stripe_type;
-	u_int32_t layout_count;
-	struct spnfs_filelayout_list flist[SPNFS_MAX_LAYOUT];
+	u_int32_t stripe_count;
+	struct spnfs_filelayout_list flist[SPNFS_MAX_DATA_SERVERS];
 };
 
 /* layoutcommit */
@@ -262,7 +260,7 @@ struct spnfs {
 };
 
 int spnfs_layout_type(void);
-int spnfs_layoutget(struct inode *, void *);
+int spnfs_layoutget(struct inode *, struct pnfs_layoutget_arg *);
 int spnfs_layoutcommit(void);
 int spnfs_layoutreturn(struct inode *, void *);
 int spnfs_getdeviceiter(struct super_block *, struct pnfs_deviter_arg *);
diff --git a/utils/spnfsd/spnfsd_ops.c b/utils/spnfsd/spnfsd_ops.c
index 81ad102..645c9eb 100644
--- a/utils/spnfsd/spnfsd_ops.c
+++ b/utils/spnfsd/spnfsd_ops.c
@@ -51,16 +51,15 @@ spnfsd_layoutget(struct spnfs_msg *im)
 
 	im->im_status = SPNFS_STATUS_SUCCESS;
 	im->im_res.layoutget_res.status = 0;
+	im->im_res.layoutget_res.dev_id = 1; /* XXX */
 	im->im_res.layoutget_res.stripe_size = stripesize;
 	if (densestriping)
-		im->im_res.layoutget_res.stripe_type = 2; /* DMXXX enum */
+		im->im_res.layoutget_res.stripe_type = 1; /* DMXXX enum */
 	else
-		im->im_res.layoutget_res.stripe_type = 1; /* DMXXX ^^^^ */
-	im->im_res.layoutget_res.layout_count = num_ds;
+		im->im_res.layoutget_res.stripe_type = 0; /* DMXXX ^^^^ */
+	im->im_res.layoutget_res.stripe_count = num_ds;
 
 	for (ds = 0 ; ds < num_ds ; ds++) {
-		im->im_res.layoutget_res.flist[ds].dev_id = 1; /* XXX */
-		im->im_res.layoutget_res.flist[ds].ds_index = ds;
 		memset(im->im_res.layoutget_res.flist[ds].fh_val, 0, 128); /*DMXXX*/
 		sprintf(fullpath, "%s/%s/%ld",
 			dsmountdir, dataservers[ds].ds_ip,
@@ -76,10 +75,10 @@ spnfsd_layoutget(struct spnfs_msg *im)
 
 		/*
 		 * MSXXX another hack...fix the hardcoding.
-		 * The fh's fsid_type is incremented by 5 to get
+		 * The fh's fsid_type is incremented by 8 to get
 		 * around stateid checking.
 		 */
-		im->im_res.layoutget_res.flist[ds].fh_val[2] += 5;
+		im->im_res.layoutget_res.flist[ds].fh_val[2] += 8;
 	}
 
 	return 0;