225 struct inode *inode = page->mapping->host;
226 struct nfs_page *req;
227 int ret;
228
229 spin_lock(&inode->i_lock);
230 for(;;) {
231 req = nfs_page_find_request_locked(page);
232 if (req == NULL) {
233 spin_unlock(&inode->i_lock);
234 return 0;
235 }
236 if (nfs_set_page_tag_locked(req))
237 break;
238
239
240
241
242
243 spin_unlock(&inode->i_lock);
244 ret = nfs_wait_on_request(req);
245 nfs_release_request(req);
246 if (ret != 0)
247 return ret;
248 spin_lock(&inode->i_lock);
249 }
250 if (test_bit(PG_CLEAN, &req->wb_flags)) {
251 spin_unlock(&inode->i_lock);
252 BUG();
253 }
254 if (nfs_set_page_writeback(page) != 0) {
255 spin_unlock(&inode->i_lock);
256 BUG();
257 }
258 spin_unlock(&inode->i_lock);
259 if (!nfs_pageio_add_request(pgio, req)) {
260 nfs_redirty_request(req);
261 return pgio->pg_error;
262 }
263 return 0;
264}
265