Skip to content

Commit 0e5ecac

Browse files
ukernelidryomov
authored andcommitted
ceph: cleanup local variables in ceph_writepages_start()
Remove two variables and define variables of same type together. Signed-off-by: "Yan, Zheng" <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 0713e5f commit 0e5ecac

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

fs/ceph/addr.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ static int ceph_writepages_start(struct address_space *mapping,
784784
pgoff_t index, start, end;
785785
int range_whole = 0;
786786
int should_loop = 1;
787-
pgoff_t max_pages = 0, max_pages_ever = 0;
788787
struct ceph_snap_context *snapc = NULL, *last_snapc = NULL, *pgsnapc;
789788
struct pagevec pvec;
790789
int done = 0;
@@ -808,7 +807,6 @@ static int ceph_writepages_start(struct address_space *mapping,
808807
}
809808
if (fsc->mount_options->wsize < wsize)
810809
wsize = fsc->mount_options->wsize;
811-
max_pages_ever = wsize >> PAGE_SHIFT;
812810

813811
pagevec_init(&pvec, 0);
814812

@@ -850,26 +848,25 @@ static int ceph_writepages_start(struct address_space *mapping,
850848
last_snapc = snapc;
851849

852850
while (!done && index <= end) {
853-
unsigned i;
854-
pgoff_t strip_unit_end = 0;
855851
int num_ops = 0, op_idx;
856-
int pvec_pages, locked_pages = 0;
852+
unsigned i, pvec_pages, max_pages, locked_pages = 0;
857853
struct page **pages = NULL, **data_pages;
858854
mempool_t *pool = NULL; /* Becomes non-null if mempool used */
859855
struct page *page;
860-
int want;
856+
pgoff_t strip_unit_end = 0;
861857
u64 offset = 0, len = 0;
862858

863-
max_pages = max_pages_ever;
859+
max_pages = wsize >> PAGE_SHIFT;
864860

865861
get_more_pages:
866-
want = min(end - index,
867-
min((pgoff_t)PAGEVEC_SIZE,
868-
max_pages - (pgoff_t)locked_pages) - 1)
869-
+ 1;
862+
pvec_pages = min_t(unsigned, PAGEVEC_SIZE,
863+
max_pages - locked_pages);
864+
if (end - index < (u64)(pvec_pages - 1))
865+
pvec_pages = (unsigned)(end - index) + 1;
866+
870867
pvec_pages = pagevec_lookup_tag(&pvec, mapping, &index,
871868
PAGECACHE_TAG_DIRTY,
872-
want);
869+
pvec_pages);
873870
dout("pagevec_lookup_tag got %d\n", pvec_pages);
874871
if (!pvec_pages && !locked_pages)
875872
break;

0 commit comments

Comments
 (0)