[pnfs] CVS: nfsv4

Benny Halevy Panasas bhalevy at citi.umich.edu
Tue Dec 12 04:53:17 EST 2006


CVSROOT:	/cvs
Module name:	nfsv4
Changes by:	bhalevy at citi.	2006/12/12 04:53:17

Modified files:
	cvs/pnfs/fs/nfs: pnfs.c pnfs.h 
	cvs/pnfs/include/linux: pnfs_xdr.h 

Log message:
- define pnfs_iomode as an enumerated type rather than using FMODE constants
- rename (and retype) argument names accordingly.

Signed-off-by: Benny Halevy bhalevy at panasas.com

Index: fs/nfs/pnfs.c
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/pnfs.c,v
retrieving revision 1.47
diff -u -p -r1.47 pnfs.c
--- fs/nfs/pnfs.c	12 Dec 2006 09:43:42 -0000	1.47
+++ fs/nfs/pnfs.c	12 Dec 2006 09:52:22 -0000
@@ -298,7 +298,7 @@ static int
get_layout(struct inode* ino,
struct nfs_open_context* ctx,
size_t count, loff_t pos,
-	   int access_type,
+	   enum pnfs_iomode iomode,
struct nfs4_pnfs_layoutget_arg* arg,
struct nfs4_pnfs_layoutget_res* res)
{
@@ -312,8 +312,7 @@ get_layout(struct inode* ino,

arg->clientid = ctx->state->owner->so_client->cl_clientid;
arg->type = server->pnfs_curr_ld->id;
-	/* FMODE_WRITE =2= LAYOUTMODE_RW,  FMODE_READ =1= LAYOUTMODE_READ */
-	arg->iomode = access_type;
+	arg->iomode = iomode;
arg->offset = 0;
arg->length = (__u64)~0;
arg->minlength = count;
@@ -347,8 +346,7 @@ pnfs_return_layout(struct inode* ino)
arg.clientid = server->nfs4_state->cl_clientid;
arg.reclaim = 0;
arg.layout_type = server->pnfs_curr_ld->id;
-	/* FMODE_WRITE =2= LAYOUTMODE_RW,  FMODE_READ =1= LAYOUTMODE_READ */
-	arg.iomode = FMODE_WRITE;
+	arg.iomode = IOMODE_ANY /* for now */;
arg.return_type = LAYOUTRETURN_FILE;
arg.offset = 0;
arg.length = ~0;
@@ -409,7 +407,7 @@ virtual_update_layout(struct inode* ino,
struct nfs_open_context* ctx,
size_t count,
loff_t pos,
-		      int access_type)
+		      enum pnfs_iomode iomode)
{
struct nfs4_pnfs_layoutget_res res;
struct nfs4_pnfs_layoutget_arg arg;
@@ -437,7 +435,7 @@ virtual_update_layout(struct inode* ino,
return 0; /* Already have layout information */
}

-	if ((result = get_layout(ino, ctx, count, pos, access_type, &arg, &res))) {
+	if ((result = get_layout(ino, ctx, count, pos, iomode, &arg, &res))) {
printk("\n%s: ERROR retrieving layout %d\n",__FUNCTION__,result);
result =  -EIO;
goto out;
@@ -731,7 +729,7 @@ pnfs_writepages(struct nfs_write_data* w
args->context,
args->count,
args->offset,
-					    FMODE_WRITE)))
+					    IOMODE_RW)))
goto out;

if (!nfss->pnfs_curr_ld->ld_io_ops ||
@@ -819,7 +817,7 @@ pnfs_readpages(struct nfs_read_data *rda
args->context,
args->count,
args->offset,
-					    FMODE_WRITE)))
+					    IOMODE_RW)))
{
printk(KERN_WARNING "%s: ERROR %d from virtual_update_layout\n",
__FUNCTION__, status);
@@ -909,7 +907,7 @@ pnfs_file_read(struct file* filp,
(struct nfs_open_context *)filp->private_data,
count,
*pos,
-					    FMODE_READ)))
+					    IOMODE_READ)))
goto out;

/* Step 2: Call I/O device driver's read function */
@@ -993,7 +991,7 @@ pnfs_file_write(struct file* filp,
(struct nfs_open_context *)filp->private_data,
count,
*pos,
-					    FMODE_WRITE)))
+					    IOMODE_RW)))
goto out;

/* Step 2: Call I/O device driver's write function */
@@ -1120,7 +1118,7 @@ pnfs_fsync(struct file *file, struct den
(struct nfs_open_context *)file->private_data,
0,
0,
-					    FMODE_WRITE)))
+					    IOMODE_RW)))
goto out;

dprintk("%s: Calling layout driver fsync\n",__FUNCTION__);
Index: fs/nfs/pnfs.h
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/pnfs.h,v
retrieving revision 1.17
diff -u -p -r1.17 pnfs.h
--- fs/nfs/pnfs.h	13 Oct 2006 05:54:30 -0000	1.17
+++ fs/nfs/pnfs.h	12 Dec 2006 09:52:22 -0000
@@ -13,7 +13,7 @@
#define FS_NFS_PNFS_H

int virtual_update_layout(struct inode* ino, struct nfs_open_context* ctx,
-	size_t count, loff_t pos, int access_type);
+	size_t count, loff_t pos, enum pnfs_iomode access_type);

int pnfs_return_layout(struct inode* ino);
void set_pnfs_layoutdriver(struct super_block *sb, u32 id);
Index: include/linux/pnfs_xdr.h
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/include/linux/pnfs_xdr.h,v
retrieving revision 1.12
diff -u -p -r1.12 pnfs_xdr.h
--- include/linux/pnfs_xdr.h	12 Dec 2006 09:43:43 -0000	1.12
+++ include/linux/pnfs_xdr.h	12 Dec 2006 09:52:22 -0000
@@ -28,6 +28,12 @@ struct nfs4_pnfs_layout {
char buf[PNFS_LAYOUT_MAXSIZE];
};

+enum pnfs_iomode {
+	IOMODE_READ = 1,
+	IOMODE_RW = 2,
+	IOMODE_ANY = 3,
+};
+
struct nfs4_pnfs_layoutget_arg {
__u64 clientid;
__u32 type;



More information about the pNFS mailing list