From: Yue Hu <zbestahu@gmail.com>
To: xiang@kernel.org, chao@kernel.org, jefflexu@linux.alibaba.com,
linux-erofs@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org, huyue2@coolpad.com, zhangwen@coolpad.com
Subject: [PATCH] erofs: don't calculate new start when expanding read length
Date: Thu, 25 May 2023 13:51:47 +0800 [thread overview]
Message-ID: <20230525055147.13220-1-zbestahu@gmail.com> (raw)
From: Yue Hu <huyue2@coolpad.com>
We only expand the trailing edge and not the leading edge. So no need
to obtain new start again. Let's use the existing ->headoffset instead.
Signed-off-by: Yue Hu <huyue2@coolpad.com>
---
fs/erofs/zdata.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index 874fee35af32..bab8dcb8e848 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -1828,26 +1828,24 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f,
{
struct inode *inode = f->inode;
struct erofs_map_blocks *map = &f->map;
- erofs_off_t cur, end;
+ erofs_off_t cur, end, headoffset = f->headoffset;
int err;
if (backmost) {
if (rac)
- end = f->headoffset + readahead_length(rac) - 1;
+ end = headoffset + readahead_length(rac) - 1;
else
- end = f->headoffset + PAGE_SIZE - 1;
+ end = headoffset + PAGE_SIZE - 1;
map->m_la = end;
err = z_erofs_map_blocks_iter(inode, map,
EROFS_GET_BLOCKS_READMORE);
if (err)
return;
- /* expend ra for the trailing edge if readahead */
+ /* expand ra for the trailing edge if readahead */
if (rac) {
- loff_t newstart = readahead_pos(rac);
-
cur = round_up(map->m_la + map->m_llen, PAGE_SIZE);
- readahead_expand(rac, newstart, cur - newstart);
+ readahead_expand(rac, headoffset, cur - headoffset);
return;
}
end = round_up(end, PAGE_SIZE);
--
2.17.1
next reply other threads:[~2023-05-25 5:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-25 5:51 Yue Hu [this message]
2023-05-25 5:56 ` Gao Xiang
2023-05-25 7:06 ` Yue Hu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230525055147.13220-1-zbestahu@gmail.com \
--to=zbestahu@gmail.com \
--cc=chao@kernel.org \
--cc=huyue2@coolpad.com \
--cc=jefflexu@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
--cc=zhangwen@coolpad.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®