diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /fs/nfs/pagelist.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r-- | fs/nfs/pagelist.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index e2975939126a..29d9d36cd5f4 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -112,12 +112,10 @@ void nfs_unlock_request(struct nfs_page *req) | |||
112 | */ | 112 | */ |
113 | int nfs_set_page_tag_locked(struct nfs_page *req) | 113 | int nfs_set_page_tag_locked(struct nfs_page *req) |
114 | { | 114 | { |
115 | struct nfs_inode *nfsi = NFS_I(req->wb_context->path.dentry->d_inode); | ||
116 | |||
117 | if (!nfs_lock_request_dontget(req)) | 115 | if (!nfs_lock_request_dontget(req)) |
118 | return 0; | 116 | return 0; |
119 | if (req->wb_page != NULL) | 117 | if (req->wb_page != NULL) |
120 | radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); | 118 | radix_tree_tag_set(&NFS_I(req->wb_context->path.dentry->d_inode)->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); |
121 | return 1; | 119 | return 1; |
122 | } | 120 | } |
123 | 121 | ||
@@ -126,10 +124,10 @@ int nfs_set_page_tag_locked(struct nfs_page *req) | |||
126 | */ | 124 | */ |
127 | void nfs_clear_page_tag_locked(struct nfs_page *req) | 125 | void nfs_clear_page_tag_locked(struct nfs_page *req) |
128 | { | 126 | { |
129 | struct inode *inode = req->wb_context->path.dentry->d_inode; | ||
130 | struct nfs_inode *nfsi = NFS_I(inode); | ||
131 | |||
132 | if (req->wb_page != NULL) { | 127 | if (req->wb_page != NULL) { |
128 | struct inode *inode = req->wb_context->path.dentry->d_inode; | ||
129 | struct nfs_inode *nfsi = NFS_I(inode); | ||
130 | |||
133 | spin_lock(&inode->i_lock); | 131 | spin_lock(&inode->i_lock); |
134 | radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); | 132 | radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); |
135 | nfs_unlock_request(req); | 133 | nfs_unlock_request(req); |
@@ -142,16 +140,22 @@ void nfs_clear_page_tag_locked(struct nfs_page *req) | |||
142 | * nfs_clear_request - Free up all resources allocated to the request | 140 | * nfs_clear_request - Free up all resources allocated to the request |
143 | * @req: | 141 | * @req: |
144 | * | 142 | * |
145 | * Release page resources associated with a write request after it | 143 | * Release page and open context resources associated with a read/write |
146 | * has completed. | 144 | * request after it has completed. |
147 | */ | 145 | */ |
148 | void nfs_clear_request(struct nfs_page *req) | 146 | void nfs_clear_request(struct nfs_page *req) |
149 | { | 147 | { |
150 | struct page *page = req->wb_page; | 148 | struct page *page = req->wb_page; |
149 | struct nfs_open_context *ctx = req->wb_context; | ||
150 | |||
151 | if (page != NULL) { | 151 | if (page != NULL) { |
152 | page_cache_release(page); | 152 | page_cache_release(page); |
153 | req->wb_page = NULL; | 153 | req->wb_page = NULL; |
154 | } | 154 | } |
155 | if (ctx != NULL) { | ||
156 | put_nfs_open_context(ctx); | ||
157 | req->wb_context = NULL; | ||
158 | } | ||
155 | } | 159 | } |
156 | 160 | ||
157 | 161 | ||
@@ -165,9 +169,8 @@ static void nfs_free_request(struct kref *kref) | |||
165 | { | 169 | { |
166 | struct nfs_page *req = container_of(kref, struct nfs_page, wb_kref); | 170 | struct nfs_page *req = container_of(kref, struct nfs_page, wb_kref); |
167 | 171 | ||
168 | /* Release struct file or cached credential */ | 172 | /* Release struct file and open context */ |
169 | nfs_clear_request(req); | 173 | nfs_clear_request(req); |
170 | put_nfs_open_context(req->wb_context); | ||
171 | nfs_page_free(req); | 174 | nfs_page_free(req); |
172 | } | 175 | } |
173 | 176 | ||
@@ -176,6 +179,12 @@ void nfs_release_request(struct nfs_page *req) | |||
176 | kref_put(&req->wb_kref, nfs_free_request); | 179 | kref_put(&req->wb_kref, nfs_free_request); |
177 | } | 180 | } |
178 | 181 | ||
182 | static int nfs_wait_bit_uninterruptible(void *word) | ||
183 | { | ||
184 | io_schedule(); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
179 | /** | 188 | /** |
180 | * nfs_wait_on_request - Wait for a request to complete. | 189 | * nfs_wait_on_request - Wait for a request to complete. |
181 | * @req: request to wait upon. | 190 | * @req: request to wait upon. |
@@ -186,14 +195,9 @@ void nfs_release_request(struct nfs_page *req) | |||
186 | int | 195 | int |
187 | nfs_wait_on_request(struct nfs_page *req) | 196 | nfs_wait_on_request(struct nfs_page *req) |
188 | { | 197 | { |
189 | int ret = 0; | 198 | return wait_on_bit(&req->wb_flags, PG_BUSY, |
190 | 199 | nfs_wait_bit_uninterruptible, | |
191 | if (!test_bit(PG_BUSY, &req->wb_flags)) | 200 | TASK_UNINTERRUPTIBLE); |
192 | goto out; | ||
193 | ret = out_of_line_wait_on_bit(&req->wb_flags, PG_BUSY, | ||
194 | nfs_wait_bit_killable, TASK_KILLABLE); | ||
195 | out: | ||
196 | return ret; | ||
197 | } | 201 | } |
198 | 202 | ||
199 | /** | 203 | /** |