]> git.karo-electronics.de Git - linux-beck.git/commitdiff
NFSv4.1: pull error handling out of nfs_commit_list
authorFred Isaman <iisaman@netapp.com>
Wed, 23 Mar 2011 13:27:47 +0000 (13:27 +0000)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 23 Mar 2011 19:29:03 +0000 (15:29 -0400)
Create a separate support function for later use by data server
commit code.

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

index bf672faa48856f6ccfe6cd182b693e86a394a426..dbc801810e759aef4e83ab83e162122fa293ee83 100644 (file)
@@ -1357,6 +1357,21 @@ static void nfs_init_commit(struct nfs_write_data *data,
        nfs_fattr_init(&data->fattr);
 }
 
+static void nfs_retry_commit(struct list_head *page_list)
+{
+       struct nfs_page *req;
+
+       while (!list_empty(page_list)) {
+               req = nfs_list_entry(page_list->next);
+               nfs_list_remove_request(req);
+               nfs_mark_request_commit(req);
+               dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+               dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
+                            BDI_RECLAIMABLE);
+               nfs_clear_page_tag_locked(req);
+       }
+}
+
 /*
  * Commit dirty pages
  */
@@ -1364,7 +1379,6 @@ static int
 nfs_commit_list(struct inode *inode, struct list_head *head, int how)
 {
        struct nfs_write_data   *data;
-       struct nfs_page         *req;
 
        data = nfs_commitdata_alloc();
 
@@ -1375,15 +1389,7 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how)
        nfs_init_commit(data, head);
        return nfs_initiate_commit(data, NFS_CLIENT(inode), data->mds_ops, how);
  out_bad:
-       while (!list_empty(head)) {
-               req = nfs_list_entry(head->next);
-               nfs_list_remove_request(req);
-               nfs_mark_request_commit(req);
-               dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
-               dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
-                               BDI_RECLAIMABLE);
-               nfs_clear_page_tag_locked(req);
-       }
+       nfs_retry_commit(head);
        nfs_commit_clear_lock(NFS_I(inode));
        return -ENOMEM;
 }