diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-17 15:27:42 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:26 -0400 |
commit | 5c36968343fcd013a3f7ae93f246c2e75596780b (patch) | |
tree | 96a3f2867e4631d84179952b1af170f3e48eae4b /fs/nfs | |
parent | 9fd367f0f376ccfb2592eed9be0eece70429894f (diff) |
NFS cleanup: speed up nfs_scan_commit using radix tree tags
Add a tag for requests that are waiting for a COMMIT
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/pagelist.c | 14 | ||||
-rw-r--r-- | fs/nfs/write.c | 6 |
2 files changed, 12 insertions, 8 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 23e9dea20902..ad90cbe76703 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -381,10 +381,10 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index) | |||
381 | /** | 381 | /** |
382 | * nfs_scan_list - Scan a list for matching requests | 382 | * nfs_scan_list - Scan a list for matching requests |
383 | * @nfsi: NFS inode | 383 | * @nfsi: NFS inode |
384 | * @head: One of the NFS inode request lists | ||
385 | * @dst: Destination list | 384 | * @dst: Destination list |
386 | * @idx_start: lower bound of page->index to scan | 385 | * @idx_start: lower bound of page->index to scan |
387 | * @npages: idx_start + npages sets the upper bound to scan. | 386 | * @npages: idx_start + npages sets the upper bound to scan. |
387 | * @tag: tag to scan for | ||
388 | * | 388 | * |
389 | * Moves elements from one of the inode request lists. | 389 | * Moves elements from one of the inode request lists. |
390 | * If the number of requests is set to 0, the entire address_space | 390 | * If the number of requests is set to 0, the entire address_space |
@@ -392,9 +392,9 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index) | |||
392 | * The requests are *not* checked to ensure that they form a contiguous set. | 392 | * The requests are *not* checked to ensure that they form a contiguous set. |
393 | * You must be holding the inode's req_lock when calling this function | 393 | * You must be holding the inode's req_lock when calling this function |
394 | */ | 394 | */ |
395 | int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, | 395 | int nfs_scan_list(struct nfs_inode *nfsi, |
396 | struct list_head *dst, pgoff_t idx_start, | 396 | struct list_head *dst, pgoff_t idx_start, |
397 | unsigned int npages) | 397 | unsigned int npages, int tag) |
398 | { | 398 | { |
399 | struct nfs_page *pgvec[NFS_SCAN_MAXENTRIES]; | 399 | struct nfs_page *pgvec[NFS_SCAN_MAXENTRIES]; |
400 | struct nfs_page *req; | 400 | struct nfs_page *req; |
@@ -409,9 +409,9 @@ int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, | |||
409 | idx_end = idx_start + npages - 1; | 409 | idx_end = idx_start + npages - 1; |
410 | 410 | ||
411 | for (;;) { | 411 | for (;;) { |
412 | found = radix_tree_gang_lookup(&nfsi->nfs_page_tree, | 412 | found = radix_tree_gang_lookup_tag(&nfsi->nfs_page_tree, |
413 | (void **)&pgvec[0], idx_start, | 413 | (void **)&pgvec[0], idx_start, |
414 | NFS_SCAN_MAXENTRIES); | 414 | NFS_SCAN_MAXENTRIES, tag); |
415 | if (found <= 0) | 415 | if (found <= 0) |
416 | break; | 416 | break; |
417 | for (i = 0; i < found; i++) { | 417 | for (i = 0; i < found; i++) { |
@@ -419,10 +419,10 @@ int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, | |||
419 | if (req->wb_index > idx_end) | 419 | if (req->wb_index > idx_end) |
420 | goto out; | 420 | goto out; |
421 | idx_start = req->wb_index + 1; | 421 | idx_start = req->wb_index + 1; |
422 | if (req->wb_list_head != head) | ||
423 | continue; | ||
424 | if (nfs_set_page_tag_locked(req)) { | 422 | if (nfs_set_page_tag_locked(req)) { |
425 | nfs_list_remove_request(req); | 423 | nfs_list_remove_request(req); |
424 | radix_tree_tag_clear(&nfsi->nfs_page_tree, | ||
425 | req->wb_index, tag); | ||
426 | nfs_list_add_request(req, dst); | 426 | nfs_list_add_request(req, dst); |
427 | res++; | 427 | res++; |
428 | } | 428 | } |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 754066cc9146..0f779ca12ec3 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -462,6 +462,9 @@ nfs_mark_request_commit(struct nfs_page *req) | |||
462 | nfs_list_add_request(req, &nfsi->commit); | 462 | nfs_list_add_request(req, &nfsi->commit); |
463 | nfsi->ncommit++; | 463 | nfsi->ncommit++; |
464 | set_bit(PG_NEED_COMMIT, &(req)->wb_flags); | 464 | set_bit(PG_NEED_COMMIT, &(req)->wb_flags); |
465 | radix_tree_tag_set(&nfsi->nfs_page_tree, | ||
466 | req->wb_index, | ||
467 | NFS_PAGE_TAG_COMMIT); | ||
465 | spin_unlock(&nfsi->req_lock); | 468 | spin_unlock(&nfsi->req_lock); |
466 | inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); | 469 | inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); |
467 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | 470 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); |
@@ -575,7 +578,8 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, u | |||
575 | int res = 0; | 578 | int res = 0; |
576 | 579 | ||
577 | if (nfsi->ncommit != 0) { | 580 | if (nfsi->ncommit != 0) { |
578 | res = nfs_scan_list(nfsi, &nfsi->commit, dst, idx_start, npages); | 581 | res = nfs_scan_list(nfsi, dst, idx_start, npages, |
582 | NFS_PAGE_TAG_COMMIT); | ||
579 | nfsi->ncommit -= res; | 583 | nfsi->ncommit -= res; |
580 | if ((nfsi->ncommit == 0) != list_empty(&nfsi->commit)) | 584 | if ((nfsi->ncommit == 0) != list_empty(&nfsi->commit)) |
581 | printk(KERN_ERR "NFS: desynchronized value of nfs_i.ncommit.\n"); | 585 | printk(KERN_ERR "NFS: desynchronized value of nfs_i.ncommit.\n"); |