From: Yue Hu <zbestahu@gmail.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>
Cc: linux-kernel@vger.kernel.org, zhangwen@coolpad.com,
huyue2@coolpad.com, linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH] erofs: remove unneeded icur field from struct z_erofs_decompress_frontend
Date: Mon, 17 Apr 2023 15:15:06 +0800 [thread overview]
Message-ID: <20230417151506.00006565.zbestahu@gmail.com> (raw)
In-Reply-To: <dd1d75a6-38c3-771c-c1ed-2f5dca523c03@linux.alibaba.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=GB18030, Size: 3781 bytes --]
On Mon, 17 Apr 2023 15:00:25 +0800
Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
> On 2023/4/17 14:52, Gao Xiang wrote:
> >
> >
> > On 2023/4/17 14:41, Yue Hu wrote:
> >> From: Yue Hu <huyue2@coolpad.com>
> >>
> >> The icur field is only used in z_erofs_try_inplace_io(). Let's just use
> >> a local variable instead. And no need to check if the pcluster is inline
> >> when setting icur since inline page cannot be used for inplace I/O.
>
> Where do we check if the pcluster is inline?
/* since file-backed online pages are traversed in reverse order */
fe->icur = z_erofs_pclusterpages(fe->pcl);
static inline unsigned int z_erofs_pclusterpages(struct z_erofs_pcluster *pcl)
{
if (z_erofs_is_inline_pcluster(pcl))
return 1;
[...]
>
> >>
> >> Signed-off-by: Yue Hu <huyue2@coolpad.com>
> >
> > Nope, it's a behavior change.
> > Other users could feed more inplace I/O pages before I/O submission
> > to reduce memory consumption, it's common when applying stress model
> > in low memory scenarios.
>
> Oh, I misread it. I think it can be done in this way although
> each following users will now rescan the whole array all the time.
>
> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
>
> >
> > Thanks,
> > Gao Xiang
> >
> >> ---
> >> 02 fs/erofs/zdata.c | 13 +++++--------
> >> 02 1 file changed, 5 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> >> index f759152feffa..f8bf2b227942 100644
> >> --- a/fs/erofs/zdata.c
> >> +++ b/fs/erofs/zdata.c
> >> @@ -554,9 +554,6 @@ struct z_erofs_decompress_frontend {
> >> 0202020202 /* used for applying cache strategy on the fly */
> >> 0202020202 bool backmost;
> >> 0202020202 erofs_off_t headoffset;
> >> -
> >> -020202 /* a pointer used to pick up inplace I/O pages */
> >> -020202 unsigned int icur;
> >> 02 };
> >> 02 #define DECOMPRESS_FRONTEND_INIT(__i) { \
> >> @@ -707,11 +704,13 @@ static bool z_erofs_try_inplace_io(struct z_erofs_decompress_frontend *fe,
> >> 0202020202020202020202020202020202020202 struct z_erofs_bvec *bvec)
> >> 02 {
> >> 0202020202 struct z_erofs_pcluster *const pcl = fe->pcl;
> >> +020202 /* file-backed online pages are traversed in reverse order */
>
> Although please help refine the comment below:
>
> /* scan & fill inplace I/O pages in the reverse order */
Ok, will refine it in v2.
>
> Thanks,
> Gao Xiang
>
> >> +020202 unsigned int icur = pcl->pclusterpages;
> >> -020202 while (fe->icur > 0) {
> >> -02020202020202 if (!cmpxchg(&pcl->compressed_bvecs[--fe->icur].page,
> >> +020202 while (icur > 0) {
> >> +02020202020202 if (!cmpxchg(&pcl->compressed_bvecs[--icur].page,
> >> 020202020202020202020202020202020202 NULL, bvec->page)) {
> >> -0202020202020202020202 pcl->compressed_bvecs[fe->icur] = *bvec;
> >> +0202020202020202020202 pcl->compressed_bvecs[icur] = *bvec;
> >> 02020202020202020202020202 return true;
> >> 020202020202020202 }
> >> 0202020202 }
> >> @@ -877,8 +876,6 @@ static int z_erofs_collector_begin(struct z_erofs_decompress_frontend *fe)
> >> 0202020202 }
> >> 0202020202 z_erofs_bvec_iter_begin(&fe->biter, &fe->pcl->bvset,
> >> 0202020202020202020202020202020202 Z_EROFS_INLINE_BVECS, fe->pcl->vcnt);
> >> -020202 /* since file-backed online pages are traversed in reverse order */
> >> -020202 fe->icur = z_erofs_pclusterpages(fe->pcl);
> >> 0202020202 return 0;
> >> 02 }
next prev parent reply other threads:[~2023-04-17 7:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 6:41 [PATCH] erofs: remove unneeded icur field from struct z_erofs_decompress_frontend Yue Hu
2023-04-17 6:52 ` Gao Xiang
2023-04-17 7:00 ` Gao Xiang
2023-04-17 7:15 ` Yue Hu [this message]
2023-04-17 7:12 ` Gao Xiang
2023-04-17 7:44 ` 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=20230417151506.00006565.zbestahu@gmail.com \
--to=zbestahu@gmail.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=huyue2@coolpad.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).