[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200918135436.17689-2-hsiangkao@redhat.com>
Date: Fri, 18 Sep 2020 21:54:34 +0800
From: Gao Xiang <hsiangkao@...hat.com>
To: linux-erofs@...ts.ozlabs.org, Chao Yu <yuchao0@...wei.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Chao Yu <chao@...nel.org>,
Gao Xiang <hsiangkao@...hat.com>
Subject: [PATCH 2/4] erofs: fold in should_decompress_synchronously()
should_decompress_synchronously() has one single condition
for now, so fold it instead.
Signed-off-by: Gao Xiang <hsiangkao@...hat.com>
---
fs/erofs/zdata.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index df6fa691097f..d483e9fee41c 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -1297,24 +1297,18 @@ static int z_erofs_readpage(struct file *file, struct page *page)
return err;
}
-static bool should_decompress_synchronously(struct erofs_sb_info *sbi,
- unsigned int nr)
-{
- return nr <= sbi->ctx.max_sync_decompress_pages;
-}
-
static void z_erofs_readahead(struct readahead_control *rac)
{
struct inode *const inode = rac->mapping->host;
struct erofs_sb_info *const sbi = EROFS_I_SB(inode);
- bool sync = should_decompress_synchronously(sbi, readahead_count(rac));
+ unsigned int nr_pages = readahead_count(rac);
+ bool sync = (nr_pages <= sbi->ctx.max_sync_decompress_pages);
struct z_erofs_decompress_frontend f = DECOMPRESS_FRONTEND_INIT(inode);
struct page *page, *head = NULL;
LIST_HEAD(pagepool);
- trace_erofs_readpages(inode, readahead_index(rac),
- readahead_count(rac), false);
+ trace_erofs_readpages(inode, readahead_index(rac), nr_pages, false);
f.headoffset = readahead_pos(rac);
--
2.18.1
Powered by blists - more mailing lists