[pnfs] [PATCH 2/2] layout commit changes

Benny Halevy bhalevy at panasas.com
Tue Nov 28 03:13:27 EST 2006


Add a layout_commit export op
If implemented, invoke it rather than notify_change() in 
nfsd4_layoutcommit()
so that the filesystem can decide how to apply new attributes

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

diff -x CVS -urp a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
--- a/fs/nfsd/nfs4proc.c        2006-09-09 00:39:52.000000000 +0300
+++ b/fs/nfsd/nfs4proc.c        2006-11-27 11:37:02.000000000 +0200
@@ -850,6 +850,7 @@ nfsd4_layoutcommit( struct svc_rqst *rqs
         int status;
         struct inode* ino = NULL;
         struct iattr ia;
+       struct super_block *sb;

         dprintk("NFSD: nfsd4_layoutcommit \n");
         status = fh_verify(rqstp, current_fh, 0, MAY_NOP);
@@ -880,8 +881,14 @@ nfsd4_layoutcommit( struct svc_rqst *rqs
         dprintk("%s: Modifying file size\n", __FUNCTION__);
         ia.ia_valid = ATTR_SIZE;
         ia.ia_size = lcp->lc_last_wr + 1;
-       status = notify_change(current_fh->fh_dentry, &ia);
-       dprintk("%s:notify_change result %d\n", __FUNCTION__, status);
+       sb = current_fh->fh_dentry->d_inode->i_sb;
+       if (sb->s_export_op->layout_commit) {
+               status = sb->s_export_op->layout_commit(ino, lcp);
+               dprintk("%s:layout_commit result %d\n", __FUNCTION__, 
status);
+       } else {
+               status = notify_change(current_fh->fh_dentry, &ia);
+               dprintk("%s:notify_change result %d\n", __FUNCTION__, 
status);
+       }

         fh_unlock(current_fh);

diff -x CVS -urp a/include/linux/fs.h b/include/linux/fs.h
--- a/include/linux/fs.h        2006-09-25 11:34:51.000000000 +0300
+++ b/include/linux/fs.h        2006-11-27 11:37:02.000000000 +0200
@@ -1285,6 +1285,8 @@ struct export_operations {
         int (*layout_get) (struct inode *inode, void *buf);
                 /* pNFS: returns the opaque device */
         int (*get_deviceinfo) (struct super_block *sb, void *p);
+               /* pNFS: commit changes to layout */
+       int (*layout_commit) (struct inode *inode, void *p);
                 /* pNFS: returns the layout */
         int (*layout_return) (struct inode *inode, void *p);




More information about the pNFS mailing list