aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pagelist.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-06-17 13:26:38 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:26 -0400
commitc03b40246123b2ced79e2620d1d2c089bb12369a (patch)
tree59851fd137ee3ef4d7a3f6a5c6953011f45f8f96 /fs/nfs/pagelist.c
parenta50f7951a31d3b976e829250853f89c9d2da32c0 (diff)
NFS: Convert struct nfs_page to use krefs
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r--fs/nfs/pagelist.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index f8a4ba533930..257a7f8b2362 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -85,9 +85,8 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
85 req->wb_offset = offset; 85 req->wb_offset = offset;
86 req->wb_pgbase = offset; 86 req->wb_pgbase = offset;
87 req->wb_bytes = count; 87 req->wb_bytes = count;
88 atomic_set(&req->wb_count, 1);
89 req->wb_context = get_nfs_open_context(ctx); 88 req->wb_context = get_nfs_open_context(ctx);
90 89 kref_init(&req->wb_kref);
91 return req; 90 return req;
92} 91}
93 92
@@ -160,11 +159,9 @@ void nfs_clear_request(struct nfs_page *req)
160 * 159 *
161 * Note: Should never be called with the spinlock held! 160 * Note: Should never be called with the spinlock held!
162 */ 161 */
163void 162static void nfs_free_request(struct kref *kref)
164nfs_release_request(struct nfs_page *req)
165{ 163{
166 if (!atomic_dec_and_test(&req->wb_count)) 164 struct nfs_page *req = container_of(kref, struct nfs_page, wb_kref);
167 return;
168 165
169 /* Release struct file or cached credential */ 166 /* Release struct file or cached credential */
170 nfs_clear_request(req); 167 nfs_clear_request(req);
@@ -172,6 +169,11 @@ nfs_release_request(struct nfs_page *req)
172 nfs_page_free(req); 169 nfs_page_free(req);
173} 170}
174 171
172void nfs_release_request(struct nfs_page *req)
173{
174 kref_put(&req->wb_kref, nfs_free_request);
175}
176
175static int nfs_wait_bit_interruptible(void *word) 177static int nfs_wait_bit_interruptible(void *word)
176{ 178{
177 int ret = 0; 179 int ret = 0;