NFS: create nfs_generic_commit_list
authorFred Isaman <iisaman@netapp.com>
Fri, 20 Apr 2012 18:47:52 +0000 (14:47 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 27 Apr 2012 18:10:38 +0000 (14:10 -0400)
Simple refactoring.

Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/write.c

index 705bf01cfbba8bb50f3051bae9e51efb466239bc..2500f1cf1996631a786daa1597ca73400eb45e3c 100644 (file)
@@ -1523,6 +1523,17 @@ static const struct rpc_call_ops nfs_commit_ops = {
        .rpc_release = nfs_commit_release,
 };
 
+static int nfs_generic_commit_list(struct inode *inode, struct list_head *head,
+                                  int how)
+{
+       int status;
+
+       status = pnfs_commit_list(inode, head, how);
+       if (status == PNFS_NOT_ATTEMPTED)
+               status = nfs_commit_list(inode, head, how);
+       return status;
+}
+
 int nfs_commit_inode(struct inode *inode, int how)
 {
        LIST_HEAD(head);
@@ -1536,9 +1547,7 @@ int nfs_commit_inode(struct inode *inode, int how)
        if (res) {
                int error;
 
-               error = pnfs_commit_list(inode, &head, how);
-               if (error == PNFS_NOT_ATTEMPTED)
-                       error = nfs_commit_list(inode, &head, how);
+               error = nfs_generic_commit_list(inode, &head, how);
                if (error < 0)
                        return error;
                if (!may_wait)