aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2017-08-31 07:20:40 -0400
committerIlya Dryomov <idryomov@gmail.com>2017-09-06 13:56:57 -0400
commit0e5ecac7168366500af1fa9a70fa9ce573f891f3 (patch)
tree53728eb003165e571eec58e897874caaaa99465f
parent0713e5f24b7deb88579dc312cf818b1a0809f02e (diff)
ceph: cleanup local variables in ceph_writepages_start()
Remove two variables and define variables of same type together. Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--fs/ceph/addr.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 5ca887bb5cae..221df531b0c3 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -784,7 +784,6 @@ static int ceph_writepages_start(struct address_space *mapping,
784 pgoff_t index, start, end; 784 pgoff_t index, start, end;
785 int range_whole = 0; 785 int range_whole = 0;
786 int should_loop = 1; 786 int should_loop = 1;
787 pgoff_t max_pages = 0, max_pages_ever = 0;
788 struct ceph_snap_context *snapc = NULL, *last_snapc = NULL, *pgsnapc; 787 struct ceph_snap_context *snapc = NULL, *last_snapc = NULL, *pgsnapc;
789 struct pagevec pvec; 788 struct pagevec pvec;
790 int done = 0; 789 int done = 0;
@@ -808,7 +807,6 @@ static int ceph_writepages_start(struct address_space *mapping,
808 } 807 }
809 if (fsc->mount_options->wsize < wsize) 808 if (fsc->mount_options->wsize < wsize)
810 wsize = fsc->mount_options->wsize; 809 wsize = fsc->mount_options->wsize;
811 max_pages_ever = wsize >> PAGE_SHIFT;
812 810
813 pagevec_init(&pvec, 0); 811 pagevec_init(&pvec, 0);
814 812
@@ -850,26 +848,25 @@ retry:
850 last_snapc = snapc; 848 last_snapc = snapc;
851 849
852 while (!done && index <= end) { 850 while (!done && index <= end) {
853 unsigned i;
854 pgoff_t strip_unit_end = 0;
855 int num_ops = 0, op_idx; 851 int num_ops = 0, op_idx;
856 int pvec_pages, locked_pages = 0; 852 unsigned i, pvec_pages, max_pages, locked_pages = 0;
857 struct page **pages = NULL, **data_pages; 853 struct page **pages = NULL, **data_pages;
858 mempool_t *pool = NULL; /* Becomes non-null if mempool used */ 854 mempool_t *pool = NULL; /* Becomes non-null if mempool used */
859 struct page *page; 855 struct page *page;
860 int want; 856 pgoff_t strip_unit_end = 0;
861 u64 offset = 0, len = 0; 857 u64 offset = 0, len = 0;
862 858
863 max_pages = max_pages_ever; 859 max_pages = wsize >> PAGE_SHIFT;
864 860
865get_more_pages: 861get_more_pages:
866 want = min(end - index, 862 pvec_pages = min_t(unsigned, PAGEVEC_SIZE,
867 min((pgoff_t)PAGEVEC_SIZE, 863 max_pages - locked_pages);
868 max_pages - (pgoff_t)locked_pages) - 1) 864 if (end - index < (u64)(pvec_pages - 1))
869 + 1; 865 pvec_pages = (unsigned)(end - index) + 1;
866
870 pvec_pages = pagevec_lookup_tag(&pvec, mapping, &index, 867 pvec_pages = pagevec_lookup_tag(&pvec, mapping, &index,
871 PAGECACHE_TAG_DIRTY, 868 PAGECACHE_TAG_DIRTY,
872 want); 869 pvec_pages);
873 dout("pagevec_lookup_tag got %d\n", pvec_pages); 870 dout("pagevec_lookup_tag got %d\n", pvec_pages);
874 if (!pvec_pages && !locked_pages) 871 if (!pvec_pages && !locked_pages)
875 break; 872 break;