diff options
author | Fred <iisaman@citi.umich.edu> | 2008-03-19 11:24:38 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-03-19 17:59:56 -0400 |
commit | 6d884e8fc8114dc8877218f06a9a9a1d801901e4 (patch) | |
tree | 091b9ab3ae2fe7dfbb15b28573d173a21e44dc1f /fs/nfs | |
parent | c7c350e92aab1bba68f26a6027b734adcf9824ba (diff) |
nfs: nfs_redirty_request
Both flush functions have the same error handling routine. Pull
it out as a function.
Signed-off-by: Fred Isaman <iisaman@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/write.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 4cb88df12f83..ce40cadb15db 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -282,8 +282,6 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, | |||
282 | spin_unlock(&inode->i_lock); | 282 | spin_unlock(&inode->i_lock); |
283 | if (!nfs_pageio_add_request(pgio, req)) { | 283 | if (!nfs_pageio_add_request(pgio, req)) { |
284 | nfs_redirty_request(req); | 284 | nfs_redirty_request(req); |
285 | nfs_end_page_writeback(page); | ||
286 | nfs_clear_page_tag_locked(req); | ||
287 | return pgio->pg_error; | 285 | return pgio->pg_error; |
288 | } | 286 | } |
289 | return 0; | 287 | return 0; |
@@ -402,7 +400,7 @@ static void nfs_inode_remove_request(struct nfs_page *req) | |||
402 | } | 400 | } |
403 | 401 | ||
404 | static void | 402 | static void |
405 | nfs_redirty_request(struct nfs_page *req) | 403 | nfs_mark_request_dirty(struct nfs_page *req) |
406 | { | 404 | { |
407 | __set_page_dirty_nobuffers(req->wb_page); | 405 | __set_page_dirty_nobuffers(req->wb_page); |
408 | } | 406 | } |
@@ -456,7 +454,7 @@ int nfs_reschedule_unstable_write(struct nfs_page *req) | |||
456 | return 1; | 454 | return 1; |
457 | } | 455 | } |
458 | if (test_and_clear_bit(PG_NEED_RESCHED, &req->wb_flags)) { | 456 | if (test_and_clear_bit(PG_NEED_RESCHED, &req->wb_flags)) { |
459 | nfs_redirty_request(req); | 457 | nfs_mark_request_dirty(req); |
460 | return 1; | 458 | return 1; |
461 | } | 459 | } |
462 | return 0; | 460 | return 0; |
@@ -847,6 +845,17 @@ static void nfs_write_rpcsetup(struct nfs_page *req, | |||
847 | rpc_put_task(task); | 845 | rpc_put_task(task); |
848 | } | 846 | } |
849 | 847 | ||
848 | /* If a nfs_flush_* function fails, it should remove reqs from @head and | ||
849 | * call this on each, which will prepare them to be retried on next | ||
850 | * writeback using standard nfs. | ||
851 | */ | ||
852 | static void nfs_redirty_request(struct nfs_page *req) | ||
853 | { | ||
854 | nfs_mark_request_dirty(req); | ||
855 | nfs_end_page_writeback(req->wb_page); | ||
856 | nfs_clear_page_tag_locked(req); | ||
857 | } | ||
858 | |||
850 | /* | 859 | /* |
851 | * Generate multiple small requests to write out a single | 860 | * Generate multiple small requests to write out a single |
852 | * contiguous dirty area on one page. | 861 | * contiguous dirty area on one page. |
@@ -902,8 +911,6 @@ out_bad: | |||
902 | nfs_writedata_release(data); | 911 | nfs_writedata_release(data); |
903 | } | 912 | } |
904 | nfs_redirty_request(req); | 913 | nfs_redirty_request(req); |
905 | nfs_end_page_writeback(req->wb_page); | ||
906 | nfs_clear_page_tag_locked(req); | ||
907 | return -ENOMEM; | 914 | return -ENOMEM; |
908 | } | 915 | } |
909 | 916 | ||
@@ -944,8 +951,6 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, unsigned i | |||
944 | req = nfs_list_entry(head->next); | 951 | req = nfs_list_entry(head->next); |
945 | nfs_list_remove_request(req); | 952 | nfs_list_remove_request(req); |
946 | nfs_redirty_request(req); | 953 | nfs_redirty_request(req); |
947 | nfs_end_page_writeback(req->wb_page); | ||
948 | nfs_clear_page_tag_locked(req); | ||
949 | } | 954 | } |
950 | return -ENOMEM; | 955 | return -ENOMEM; |
951 | } | 956 | } |
@@ -1298,7 +1303,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) | |||
1298 | } | 1303 | } |
1299 | /* We have a mismatch. Write the page again */ | 1304 | /* We have a mismatch. Write the page again */ |
1300 | dprintk(" mismatch\n"); | 1305 | dprintk(" mismatch\n"); |
1301 | nfs_redirty_request(req); | 1306 | nfs_mark_request_dirty(req); |
1302 | next: | 1307 | next: |
1303 | nfs_clear_page_tag_locked(req); | 1308 | nfs_clear_page_tag_locked(req); |
1304 | } | 1309 | } |