Commit 6d884e8f authored by Fred's avatar Fred Committed by Trond Myklebust

nfs: nfs_redirty_request

Both flush functions have the same error handling routine.  Pull
it out as a function.
Signed-off-by: default avatarFred Isaman <iisaman@citi.umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent c7c350e9
...@@ -282,8 +282,6 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, ...@@ -282,8 +282,6 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
if (!nfs_pageio_add_request(pgio, req)) { if (!nfs_pageio_add_request(pgio, req)) {
nfs_redirty_request(req); nfs_redirty_request(req);
nfs_end_page_writeback(page);
nfs_clear_page_tag_locked(req);
return pgio->pg_error; return pgio->pg_error;
} }
return 0; return 0;
...@@ -402,7 +400,7 @@ static void nfs_inode_remove_request(struct nfs_page *req) ...@@ -402,7 +400,7 @@ static void nfs_inode_remove_request(struct nfs_page *req)
} }
static void static void
nfs_redirty_request(struct nfs_page *req) nfs_mark_request_dirty(struct nfs_page *req)
{ {
__set_page_dirty_nobuffers(req->wb_page); __set_page_dirty_nobuffers(req->wb_page);
} }
...@@ -456,7 +454,7 @@ int nfs_reschedule_unstable_write(struct nfs_page *req) ...@@ -456,7 +454,7 @@ int nfs_reschedule_unstable_write(struct nfs_page *req)
return 1; return 1;
} }
if (test_and_clear_bit(PG_NEED_RESCHED, &req->wb_flags)) { if (test_and_clear_bit(PG_NEED_RESCHED, &req->wb_flags)) {
nfs_redirty_request(req); nfs_mark_request_dirty(req);
return 1; return 1;
} }
return 0; return 0;
...@@ -847,6 +845,17 @@ static void nfs_write_rpcsetup(struct nfs_page *req, ...@@ -847,6 +845,17 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
rpc_put_task(task); rpc_put_task(task);
} }
/* If a nfs_flush_* function fails, it should remove reqs from @head and
* call this on each, which will prepare them to be retried on next
* writeback using standard nfs.
*/
static void nfs_redirty_request(struct nfs_page *req)
{
nfs_mark_request_dirty(req);
nfs_end_page_writeback(req->wb_page);
nfs_clear_page_tag_locked(req);
}
/* /*
* Generate multiple small requests to write out a single * Generate multiple small requests to write out a single
* contiguous dirty area on one page. * contiguous dirty area on one page.
...@@ -902,8 +911,6 @@ out_bad: ...@@ -902,8 +911,6 @@ out_bad:
nfs_writedata_release(data); nfs_writedata_release(data);
} }
nfs_redirty_request(req); nfs_redirty_request(req);
nfs_end_page_writeback(req->wb_page);
nfs_clear_page_tag_locked(req);
return -ENOMEM; return -ENOMEM;
} }
...@@ -944,8 +951,6 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, unsigned i ...@@ -944,8 +951,6 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, unsigned i
req = nfs_list_entry(head->next); req = nfs_list_entry(head->next);
nfs_list_remove_request(req); nfs_list_remove_request(req);
nfs_redirty_request(req); nfs_redirty_request(req);
nfs_end_page_writeback(req->wb_page);
nfs_clear_page_tag_locked(req);
} }
return -ENOMEM; return -ENOMEM;
} }
...@@ -1298,7 +1303,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) ...@@ -1298,7 +1303,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
} }
/* We have a mismatch. Write the page again */ /* We have a mismatch. Write the page again */
dprintk(" mismatch\n"); dprintk(" mismatch\n");
nfs_redirty_request(req); nfs_mark_request_dirty(req);
next: next:
nfs_clear_page_tag_locked(req); nfs_clear_page_tag_locked(req);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment