[pnfs] CVS: nfsv4

Benny Halevy Panasas bhalevy at citi.umich.edu
Tue Dec 12 05:08:34 EST 2006


CVSROOT:	/cvs
Module name:	nfsv4
Changes by:	bhalevy at citi.	2006/12/12 05:08:34

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

Log message:
commit and return the layout before sending setattr based on layout driver policy.

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

Index: fs/nfs/nfs4proc.c
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/nfs4proc.c,v
retrieving revision 1.28
diff -u -p -r1.28 nfs4proc.c
--- fs/nfs/nfs4proc.c	28 Sep 2006 05:46:16 -0000	1.28
+++ fs/nfs/nfs4proc.c	12 Dec 2006 10:06:21 -0000
@@ -1594,6 +1594,33 @@ nfs4_proc_setattr(struct dentry *dentry,
return status;
}

+/*
+ * Return layout before issueing a setattr
+ */
+static int
+pnfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
+                   struct iattr *sattr)
+{
+	struct inode *inode = dentry->d_inode;
+
+	if (pnfs_enabled_sb(NFS_SERVER(inode)) && NFS_I(inode)->current_layout) {
+		struct pnfs_layoutdriver_type *ld;
+		struct layoutdriver_policy_operations *policy_ops;
+
+		ld = NFS_SERVER(inode)->pnfs_curr_ld;
+		policy_ops = ld->ld_policy_ops;
+
+		if (policy_ops && policy_ops->layoutret_on_setattr) {
+			if (NFS_I(inode)->layoutcommit_ctx) {
+				pnfs_layoutcommit_inode(inode, 0);
+			}
+			pnfs_return_layout(inode);
+		}
+	}
+
+	return nfs4_proc_setattr(dentry, fattr, sattr);
+}
+
static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name,
struct nfs_fh *fhandle, struct nfs_fattr *fattr)
{
@@ -4150,7 +4177,7 @@ struct nfs_rpc_ops	pnfs_v4_clientops = {
.file_inode_ops	= &nfs4_file_inode_operations,
.getroot	= nfs4_proc_get_root,
.getattr	= nfs4_proc_getattr,
-	.setattr	= nfs4_proc_setattr,
+	.setattr	= pnfs4_proc_setattr,
.lookup		= nfs4_proc_lookup,
.access		= nfs4_proc_access,
.readlink	= nfs4_proc_readlink,
Index: include/linux/nfs4_pnfs.h
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/include/linux/nfs4_pnfs.h,v
retrieving revision 1.13
diff -u -p -r1.13 nfs4_pnfs.h
--- include/linux/nfs4_pnfs.h	12 Dec 2006 10:02:59 -0000	1.13
+++ include/linux/nfs4_pnfs.h	12 Dec 2006 10:06:21 -0000
@@ -105,6 +105,10 @@ struct layoutdriver_policy_operations {
* same compound as the OPEN operation?
*/
int (*layoutget_on_open) (struct pnfs_mount_type *);
+
+	/* Should the pNFS client commit and return the layout upon a setattr
+	 */
+	int (*layoutret_on_setattr) (struct pnfs_mount_type *);
};

/* Per-layout driver specific registration structure */



More information about the pNFS mailing list