aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-06-22 13:16:30 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-06-22 16:07:39 -0400
commitc6a556b88adfacd2af90be84357c8165d716c27d (patch)
treeb63d477180052d3d1edabffb51f3fdfe4f699866 /fs/nfs/write.c
parentab0a3dbedc51037f3d2e22ef67717a987b3d15e2 (diff)
[PATCH] NFS: Make searching and waiting on busy writeback requests more efficient.
Basically copies the VFS's method for tracking writebacks and applies it to the struct nfs_page. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 79b621a545b2..58a39b0486a7 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -503,13 +503,12 @@ nfs_wait_on_requests(struct inode *inode, unsigned long idx_start, unsigned int
503 503
504 spin_lock(&nfsi->req_lock); 504 spin_lock(&nfsi->req_lock);
505 next = idx_start; 505 next = idx_start;
506 while (radix_tree_gang_lookup(&nfsi->nfs_page_tree, (void **)&req, next, 1)) { 506 while (radix_tree_gang_lookup_tag(&nfsi->nfs_page_tree, (void **)&req, next, 1, NFS_PAGE_TAG_WRITEBACK)) {
507 if (req->wb_index > idx_end) 507 if (req->wb_index > idx_end)
508 break; 508 break;
509 509
510 next = req->wb_index + 1; 510 next = req->wb_index + 1;
511 if (!NFS_WBACK_BUSY(req)) 511 BUG_ON(!NFS_WBACK_BUSY(req));
512 continue;
513 512
514 atomic_inc(&req->wb_count); 513 atomic_inc(&req->wb_count);
515 spin_unlock(&nfsi->req_lock); 514 spin_unlock(&nfsi->req_lock);
@@ -821,7 +820,7 @@ out:
821#else 820#else
822 nfs_inode_remove_request(req); 821 nfs_inode_remove_request(req);
823#endif 822#endif
824 nfs_unlock_request(req); 823 nfs_clear_page_writeback(req);
825} 824}
826 825
827static inline int flush_task_priority(int how) 826static inline int flush_task_priority(int how)
@@ -952,7 +951,7 @@ out_bad:
952 nfs_writedata_free(data); 951 nfs_writedata_free(data);
953 } 952 }
954 nfs_mark_request_dirty(req); 953 nfs_mark_request_dirty(req);
955 nfs_unlock_request(req); 954 nfs_clear_page_writeback(req);
956 return -ENOMEM; 955 return -ENOMEM;
957} 956}
958 957
@@ -1002,7 +1001,7 @@ static int nfs_flush_one(struct list_head *head, struct inode *inode, int how)
1002 struct nfs_page *req = nfs_list_entry(head->next); 1001 struct nfs_page *req = nfs_list_entry(head->next);
1003 nfs_list_remove_request(req); 1002 nfs_list_remove_request(req);
1004 nfs_mark_request_dirty(req); 1003 nfs_mark_request_dirty(req);
1005 nfs_unlock_request(req); 1004 nfs_clear_page_writeback(req);
1006 } 1005 }
1007 return -ENOMEM; 1006 return -ENOMEM;
1008} 1007}
@@ -1029,7 +1028,7 @@ nfs_flush_list(struct list_head *head, int wpages, int how)
1029 req = nfs_list_entry(head->next); 1028 req = nfs_list_entry(head->next);
1030 nfs_list_remove_request(req); 1029 nfs_list_remove_request(req);
1031 nfs_mark_request_dirty(req); 1030 nfs_mark_request_dirty(req);
1032 nfs_unlock_request(req); 1031 nfs_clear_page_writeback(req);
1033 } 1032 }
1034 return error; 1033 return error;
1035} 1034}
@@ -1121,7 +1120,7 @@ static void nfs_writeback_done_full(struct nfs_write_data *data, int status)
1121 nfs_inode_remove_request(req); 1120 nfs_inode_remove_request(req);
1122#endif 1121#endif
1123 next: 1122 next:
1124 nfs_unlock_request(req); 1123 nfs_clear_page_writeback(req);
1125 } 1124 }
1126} 1125}
1127 1126
@@ -1278,7 +1277,7 @@ nfs_commit_list(struct list_head *head, int how)
1278 req = nfs_list_entry(head->next); 1277 req = nfs_list_entry(head->next);
1279 nfs_list_remove_request(req); 1278 nfs_list_remove_request(req);
1280 nfs_mark_request_commit(req); 1279 nfs_mark_request_commit(req);
1281 nfs_unlock_request(req); 1280 nfs_clear_page_writeback(req);
1282 } 1281 }
1283 return -ENOMEM; 1282 return -ENOMEM;
1284} 1283}
@@ -1324,7 +1323,7 @@ nfs_commit_done(struct rpc_task *task)
1324 dprintk(" mismatch\n"); 1323 dprintk(" mismatch\n");
1325 nfs_mark_request_dirty(req); 1324 nfs_mark_request_dirty(req);
1326 next: 1325 next:
1327 nfs_unlock_request(req); 1326 nfs_clear_page_writeback(req);
1328 res++; 1327 res++;
1329 } 1328 }
1330 sub_page_state(nr_unstable,res); 1329 sub_page_state(nr_unstable,res);