summaryrefslogtreecommitdiff
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-09 13:54:53 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-09 15:17:49 -0400
commit0427708657750bdc03af3491a0297cab5e7efabf (patch)
tree50b754a332cb763c8e5349d55e38db4d85521ea9 /fs/nfs/direct.c
parent1d1afcbc294cc7c788eb5c7b6b98e8d63caf002c (diff)
downloadlinux-0427708657750bdc03af3491a0297cab5e7efabf.tar.gz
NFS: Clean up - Simplify reference counting in fs/nfs/direct.c
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 845e20196803..c47a46eaf905 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -486,10 +486,8 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
}
nfs_pageio_complete(&desc);
- while (!list_empty(&failed)) {
- nfs_release_request(req);
+ while (!list_empty(&failed))
nfs_unlock_and_release_request(req);
- }
if (put_dreq(dreq))
nfs_direct_write_complete(dreq, dreq->inode);
@@ -518,9 +516,9 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data)
nfs_list_remove_request(req);
if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) {
/* Note the rewrite will go through mds */
+ kref_get(&req->wb_kref);
nfs_mark_request_commit(req, NULL, &cinfo);
- } else
- nfs_release_request(req);
+ }
nfs_unlock_and_release_request(req);
}
@@ -657,13 +655,11 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_pageio_descriptor *d
break;
}
nfs_lock_request(req);
- kref_get(&req->wb_kref);
req->wb_index = pos >> PAGE_SHIFT;
req->wb_offset = pos & ~PAGE_MASK;
if (!nfs_pageio_add_request(desc, req)) {
result = desc->pg_error;
nfs_unlock_and_release_request(req);
- nfs_release_request(req);
break;
}
pgbase = 0;
@@ -734,10 +730,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
switch (bit) {
case NFS_IOHDR_NEED_RESCHED:
case NFS_IOHDR_NEED_COMMIT:
+ kref_get(&req->wb_kref);
nfs_mark_request_commit(req, hdr->lseg, &cinfo);
- break;
- default:
- nfs_release_request(req);
}
nfs_unlock_and_release_request(req);
}
@@ -755,7 +749,6 @@ static void nfs_write_sync_pgio_error(struct list_head *head)
while (!list_empty(head)) {
req = nfs_list_entry(head->next);
nfs_list_remove_request(req);
- nfs_release_request(req);
nfs_unlock_and_release_request(req);
}
}