summaryrefslogtreecommitdiff
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorFengnan Chang <fengnanchang@gmail.com>2022-07-31 11:33:46 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2022-08-05 04:20:55 -0700
commit01fc4b9a6ed8eacb64e5609bab7ac963e1c7e486 (patch)
treefd9b29eea4542fca39e99bf244a1af141cee154f /fs/f2fs/data.c
parent4f8219f8aa175d5a46703631abaae745592efe29 (diff)
f2fs: use onstack pages instead of pvec
Since pvec have 15 pages, it not a multiple of 4, when write compressed pages, write in 64K as a unit, it will call pagevec_lookup_range_tag agagin, sometimes this will take a lot of time. Use onstack pages instead of pvec to mitigate this problem. Signed-off-by: Fengnan Chang <fengnanchang@gmail.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 34a7a9affea0..0b159c555069 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2916,7 +2916,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
{
int ret = 0;
int done = 0, retry = 0;
- struct pagevec pvec;
+ struct page *pages[F2FS_ONSTACK_PAGES];
struct f2fs_sb_info *sbi = F2FS_M_SB(mapping);
struct bio *bio = NULL;
sector_t last_block;
@@ -2947,8 +2947,6 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
int submitted = 0;
int i;
- pagevec_init(&pvec);
-
if (get_dirty_pages(mapping->host) <=
SM_I(F2FS_M_SB(mapping))->min_hot_blocks)
set_inode_flag(mapping->host, FI_HOT_DATA);
@@ -2974,13 +2972,13 @@ retry:
tag_pages_for_writeback(mapping, index, end);
done_index = index;
while (!done && !retry && (index <= end)) {
- nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end,
- tag);
+ nr_pages = find_get_pages_range_tag(mapping, &index, end,
+ tag, F2FS_ONSTACK_PAGES, pages);
if (nr_pages == 0)
break;
for (i = 0; i < nr_pages; i++) {
- struct page *page = pvec.pages[i];
+ struct page *page = pages[i];
bool need_readd;
readd:
need_readd = false;
@@ -3012,7 +3010,7 @@ readd:
goto lock_page;
if (f2fs_all_cluster_page_ready(&cc,
- &pvec, i, nr_pages, true))
+ pages, i, nr_pages, true))
goto lock_page;
ret2 = f2fs_prepare_compress_overwrite(
@@ -3026,7 +3024,7 @@ readd:
(!f2fs_compress_write_end(inode,
fsdata, page->index, 1) ||
!f2fs_all_cluster_page_ready(&cc,
- &pvec, i, nr_pages, false))) {
+ pages, i, nr_pages, false))) {
retry = 1;
break;
}
@@ -3116,7 +3114,7 @@ next:
if (need_readd)
goto readd;
}
- pagevec_release(&pvec);
+ release_pages(pages, nr_pages);
cond_resched();
}
#ifdef CONFIG_F2FS_FS_COMPRESSION