diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-09 13:19:15 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-09 15:17:34 -0400 |
commit | 7ad84aa9448571678c243f0c5ef383fbe5b50f4f (patch) | |
tree | 7d2baea4ff52fe62b23bf8adbb81a824ee768938 /fs/nfs/write.c | |
parent | d1182b33ed9b62470cb6ab892a8a301542120086 (diff) |
NFS: Clean up - simplify nfs_lock_request()
We only have two places where we need to grab a reference when trying
to lock the nfs_page. We're better off making that explicit.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Fred Isaman <iisaman@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r-- | fs/nfs/write.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 83823294ffd2..553f7ef1079b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -260,10 +260,10 @@ static struct nfs_page *nfs_find_and_lock_request(struct page *page, bool nonblo | |||
260 | req = nfs_page_find_request_locked(page); | 260 | req = nfs_page_find_request_locked(page); |
261 | if (req == NULL) | 261 | if (req == NULL) |
262 | break; | 262 | break; |
263 | if (nfs_lock_request_dontget(req)) | 263 | if (nfs_lock_request(req)) |
264 | break; | 264 | break; |
265 | /* Note: If we hold the page lock, as is the case in nfs_writepage, | 265 | /* Note: If we hold the page lock, as is the case in nfs_writepage, |
266 | * then the call to nfs_lock_request_dontget() will always | 266 | * then the call to nfs_lock_request() will always |
267 | * succeed provided that someone hasn't already marked the | 267 | * succeed provided that someone hasn't already marked the |
268 | * request as dirty (in which case we don't care). | 268 | * request as dirty (in which case we don't care). |
269 | */ | 269 | */ |
@@ -406,7 +406,7 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req) | |||
406 | struct nfs_inode *nfsi = NFS_I(inode); | 406 | struct nfs_inode *nfsi = NFS_I(inode); |
407 | 407 | ||
408 | /* Lock the request! */ | 408 | /* Lock the request! */ |
409 | nfs_lock_request_dontget(req); | 409 | nfs_lock_request(req); |
410 | 410 | ||
411 | spin_lock(&inode->i_lock); | 411 | spin_lock(&inode->i_lock); |
412 | if (!nfsi->npages && nfs_have_delegation(inode, FMODE_WRITE)) | 412 | if (!nfsi->npages && nfs_have_delegation(inode, FMODE_WRITE)) |
@@ -651,6 +651,7 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst, | |||
651 | list_for_each_entry_safe(req, tmp, src, wb_list) { | 651 | list_for_each_entry_safe(req, tmp, src, wb_list) { |
652 | if (!nfs_lock_request(req)) | 652 | if (!nfs_lock_request(req)) |
653 | continue; | 653 | continue; |
654 | kref_get(&req->wb_kref); | ||
654 | if (cond_resched_lock(cinfo->lock)) | 655 | if (cond_resched_lock(cinfo->lock)) |
655 | list_safe_reset_next(req, tmp, wb_list); | 656 | list_safe_reset_next(req, tmp, wb_list); |
656 | nfs_request_remove_commit_list(req, cinfo); | 657 | nfs_request_remove_commit_list(req, cinfo); |
@@ -741,7 +742,7 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode, | |||
741 | || end < req->wb_offset) | 742 | || end < req->wb_offset) |
742 | goto out_flushme; | 743 | goto out_flushme; |
743 | 744 | ||
744 | if (nfs_lock_request_dontget(req)) | 745 | if (nfs_lock_request(req)) |
745 | break; | 746 | break; |
746 | 747 | ||
747 | /* The request is locked, so wait and then retry */ | 748 | /* The request is locked, so wait and then retry */ |
@@ -1717,7 +1718,7 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page) | |||
1717 | req = nfs_page_find_request(page); | 1718 | req = nfs_page_find_request(page); |
1718 | if (req == NULL) | 1719 | if (req == NULL) |
1719 | break; | 1720 | break; |
1720 | if (nfs_lock_request_dontget(req)) { | 1721 | if (nfs_lock_request(req)) { |
1721 | nfs_clear_request_commit(req); | 1722 | nfs_clear_request_commit(req); |
1722 | nfs_inode_remove_request(req); | 1723 | nfs_inode_remove_request(req); |
1723 | /* | 1724 | /* |