diff options
-rw-r--r-- | fs/nfs/pagelist.c | 14 | ||||
-rw-r--r-- | fs/nfs/write.c | 6 | ||||
-rw-r--r-- | include/linux/nfs_page.h | 5 |
3 files changed, 15 insertions, 10 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"); |
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index 042434c39b7e..481a42105d69 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h | |||
@@ -22,6 +22,7 @@ | |||
22 | * Valid flags for the radix tree | 22 | * Valid flags for the radix tree |
23 | */ | 23 | */ |
24 | #define NFS_PAGE_TAG_LOCKED 0 | 24 | #define NFS_PAGE_TAG_LOCKED 0 |
25 | #define NFS_PAGE_TAG_COMMIT 1 | ||
25 | 26 | ||
26 | /* | 27 | /* |
27 | * Valid flags for a dirty buffer | 28 | * Valid flags for a dirty buffer |
@@ -71,8 +72,8 @@ extern void nfs_clear_request(struct nfs_page *req); | |||
71 | extern void nfs_release_request(struct nfs_page *req); | 72 | extern void nfs_release_request(struct nfs_page *req); |
72 | 73 | ||
73 | 74 | ||
74 | extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst, | 75 | extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst, |
75 | pgoff_t idx_start, unsigned int npages); | 76 | pgoff_t idx_start, unsigned int npages, int tag); |
76 | extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, | 77 | extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, |
77 | struct inode *inode, | 78 | struct inode *inode, |
78 | int (*doio)(struct inode *, struct list_head *, unsigned int, size_t, int), | 79 | int (*doio)(struct inode *, struct list_head *, unsigned int, size_t, int), |