diff options
author | Weston Andros Adamson <dros@primarydata.com> | 2014-05-15 11:56:44 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-05-29 11:11:44 -0400 |
commit | ab75e417192a486ffe63a314b6d2e7361f0e157f (patch) | |
tree | 5bf3e9884f75e789aa1db33edb68103ad1f2c7fc /fs/nfs/pagelist.c | |
parent | b4fdac1a5150174df0847a45dc6612ce5ce3daeb (diff) |
nfs: call nfs_can_coalesce_requests for every req
Call nfs_can_coalesce_requests for every request, even the first one.
This is needed for future patches to give pg_test a way to inform
add_request to reduce the size of the request.
Now @prev can be null in nfs_can_coalesce_requests and pg_test functions.
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r-- | fs/nfs/pagelist.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 82233431880d..f343f49ff596 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -292,6 +292,8 @@ nfs_wait_on_request(struct nfs_page *req) | |||
292 | size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, | 292 | size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, |
293 | struct nfs_page *prev, struct nfs_page *req) | 293 | struct nfs_page *prev, struct nfs_page *req) |
294 | { | 294 | { |
295 | if (!prev) | ||
296 | return req->wb_bytes; | ||
295 | /* | 297 | /* |
296 | * FIXME: ideally we should be able to coalesce all requests | 298 | * FIXME: ideally we should be able to coalesce all requests |
297 | * that are not block boundary aligned, but currently this | 299 | * that are not block boundary aligned, but currently this |
@@ -761,17 +763,20 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev, | |||
761 | { | 763 | { |
762 | size_t size; | 764 | size_t size; |
763 | 765 | ||
764 | if (!nfs_match_open_context(req->wb_context, prev->wb_context)) | 766 | if (prev) { |
765 | return false; | 767 | if (!nfs_match_open_context(req->wb_context, prev->wb_context)) |
766 | if (req->wb_context->dentry->d_inode->i_flock != NULL && | 768 | return false; |
767 | !nfs_match_lock_context(req->wb_lock_context, prev->wb_lock_context)) | 769 | if (req->wb_context->dentry->d_inode->i_flock != NULL && |
768 | return false; | 770 | !nfs_match_lock_context(req->wb_lock_context, |
769 | if (req->wb_pgbase != 0) | 771 | prev->wb_lock_context)) |
770 | return false; | 772 | return false; |
771 | if (prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE) | 773 | if (req->wb_pgbase != 0) |
772 | return false; | 774 | return false; |
773 | if (req_offset(req) != req_offset(prev) + prev->wb_bytes) | 775 | if (prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE) |
774 | return false; | 776 | return false; |
777 | if (req_offset(req) != req_offset(prev) + prev->wb_bytes) | ||
778 | return false; | ||
779 | } | ||
775 | size = pgio->pg_ops->pg_test(pgio, prev, req); | 780 | size = pgio->pg_ops->pg_test(pgio, prev, req); |
776 | WARN_ON_ONCE(size && size != req->wb_bytes); | 781 | WARN_ON_ONCE(size && size != req->wb_bytes); |
777 | return size > 0; | 782 | return size > 0; |
@@ -788,17 +793,16 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev, | |||
788 | static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc, | 793 | static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc, |
789 | struct nfs_page *req) | 794 | struct nfs_page *req) |
790 | { | 795 | { |
796 | struct nfs_page *prev = NULL; | ||
791 | if (desc->pg_count != 0) { | 797 | if (desc->pg_count != 0) { |
792 | struct nfs_page *prev; | ||
793 | |||
794 | prev = nfs_list_entry(desc->pg_list.prev); | 798 | prev = nfs_list_entry(desc->pg_list.prev); |
795 | if (!nfs_can_coalesce_requests(prev, req, desc)) | ||
796 | return 0; | ||
797 | } else { | 799 | } else { |
798 | if (desc->pg_ops->pg_init) | 800 | if (desc->pg_ops->pg_init) |
799 | desc->pg_ops->pg_init(desc, req); | 801 | desc->pg_ops->pg_init(desc, req); |
800 | desc->pg_base = req->wb_pgbase; | 802 | desc->pg_base = req->wb_pgbase; |
801 | } | 803 | } |
804 | if (!nfs_can_coalesce_requests(prev, req, desc)) | ||
805 | return 0; | ||
802 | nfs_list_remove_request(req); | 806 | nfs_list_remove_request(req); |
803 | nfs_list_add_request(req, &desc->pg_list); | 807 | nfs_list_add_request(req, &desc->pg_list); |
804 | desc->pg_count += req->wb_bytes; | 808 | desc->pg_count += req->wb_bytes; |