From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Yuwen Chen <ywen.chen@foxmail.com>, xiang@kernel.org
Cc: chao@kernel.org, huyue2@coolpad.com, jefflexu@linux.alibaba.com,
linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] erofs: simplify the code using for_each_set_bit
Date: Thu, 18 Dec 2025 11:02:52 +0800 [thread overview]
Message-ID: <d4a41ddd-726c-4dee-a563-12b2b83d071c@linux.alibaba.com> (raw)
In-Reply-To: <tencent_9E5D8E4520DCDEE3CBAE5BE70D79F95FFD08@qq.com>
On 2025/12/18 10:57, Yuwen Chen wrote:
> When mounting the EROFS file system, it is necessary to check the
> available compression algorithms. At this time, the for_each_set_bit
> function can be used to simplify the code logic.
>
> Signed-off-by: Yuwen Chen <ywen.chen@foxmail.com>
> ---
>
> v1 -> v2:
> - revert the modifications to the fs/erofs/internal.h
>
> fs/erofs/decompressor.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
> index 2ec9b2bb628d6..be1e19b620523 100644
> --- a/fs/erofs/decompressor.c
> +++ b/fs/erofs/decompressor.c
> @@ -405,7 +405,7 @@ int z_erofs_parse_cfgs(struct super_block *sb, struct erofs_super_block *dsb)
> {
> struct erofs_sb_info *sbi = EROFS_SB(sb);
> struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
> - unsigned int algs, alg;
> + unsigned long algs, alg;
> erofs_off_t offset;
> int size, ret = 0;
>
> @@ -423,13 +423,10 @@ int z_erofs_parse_cfgs(struct super_block *sb, struct erofs_super_block *dsb)
>
> erofs_init_metabuf(&buf, sb);
> offset = EROFS_SUPER_OFFSET + sbi->sb_size;
> - alg = 0;
> - for (algs = sbi->available_compr_algs; algs; algs >>= 1, ++alg) {
> + algs = sbi->available_compr_algs;
Can you update as what I suggested?
Assign `algs` first, and then assign sbi->available_compr_algs.
Thanks,
Gao Xiang
prev parent reply other threads:[~2025-12-18 3:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 2:57 Yuwen Chen
2025-12-18 3:02 ` Gao Xiang [this message]
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=d4a41ddd-726c-4dee-a563-12b2b83d071c@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.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=ywen.chen@foxmail.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®