From: Chunhai Guo <guochunhai@vivo.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>,
"linux-erofs@lists.ozlabs.org" <linux-erofs@lists.ozlabs.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Chunhai Guo <guochunhai@vivo.com>
Subject: Re: [PATCH 1/3] erofs: get rid of erofs_{find,insert}_workgroup
Date: Fri, 18 Oct 2024 04:30:35 +0000 [thread overview]
Message-ID: <cd756ca4-e83b-4b10-8792-fc0f1c1ae2fa@vivo.com> (raw)
In-Reply-To: <20241017115705.877515-1-hsiangkao@linux.alibaba.com>
> @@ -789,7 +798,16 @@ static int z_erofs_pcluster_begin(struct z_erofs_decompress_frontend *fe)
> DBG_BUGON(fe->owned_head == Z_EROFS_PCLUSTER_NIL);
>
> if (!(map->m_flags & EROFS_MAP_META)) {
> - grp = erofs_find_workgroup(sb, blknr);
> + while (1) {
> + rcu_read_lock();
> + grp = xa_load(&EROFS_SB(sb)->managed_pslots, blknr);
> + if (erofs_workgroup_get(grp)) {
I guess here should be modified as below, please refer to
erofs_find_workgroup().
if (grp && erofs_workgroup_get(grp)) {
> + DBG_BUGON(blknr != grp->index);
> + rcu_read_unlock();
> + break;
> + }
> + rcu_read_unlock();
> + }
> } else if ((map->m_pa & ~PAGE_MASK) + map->m_plen > PAGE_SIZE) {
> DBG_BUGON(1);
> return -EFSCORRUPTED;
> diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c
> index 37afe2024840..218b0249a482 100644
> --- a/fs/erofs/zutil.c
> +++ b/fs/erofs/zutil.c
> @@ -214,7 +214,7 @@ void erofs_release_pages(struct page **pagepool)
> }
> }
>
> -static bool erofs_workgroup_get(struct erofs_workgroup *grp)
> +bool erofs_workgroup_get(struct erofs_workgroup *grp)
> {
> if (lockref_get_not_zero(&grp->lockref))
> return true;
> @@ -231,54 +231,6 @@ static bool erofs_workgroup_get(struct erofs_workgroup *grp)
> return true;
> }
>
> -struct erofs_workgroup *erofs_find_workgroup(struct super_block *sb,
> - pgoff_t index)
> -{
> - struct erofs_sb_info *sbi = EROFS_SB(sb);
> - struct erofs_workgroup *grp;
> -
> -repeat:
> - rcu_read_lock();
> - grp = xa_load(&sbi->managed_pslots, index);
> - if (grp) {
Please refer to this logic.
> - if (!erofs_workgroup_get(grp)) {
> - /* prefer to relax rcu read side */
> - rcu_read_unlock();
> - goto repeat;
> - }
> -
> - DBG_BUGON(index != grp->index);
> - }
> - rcu_read_unlock();
> - return grp;
> -}
Thanks,
Chunhai
next prev parent reply other threads:[~2024-10-18 4:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 11:57 Gao Xiang
2024-10-17 11:57 ` [PATCH 2/3] erofs: move erofs_workgroup operations into zdata.c Gao Xiang
2024-10-17 11:57 ` [PATCH 3/3] erofs: sunset `struct erofs_workgroup` Gao Xiang
2024-10-18 4:30 ` Chunhai Guo [this message]
2024-10-18 4:43 ` [PATCH 1/3] erofs: get rid of erofs_{find,insert}_workgroup Gao Xiang
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=cd756ca4-e83b-4b10-8792-fc0f1c1ae2fa@vivo.com \
--to=guochunhai@vivo.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
/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®