From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82B04125A9 for ; Thu, 18 Dec 2025 03:03:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.97 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766026985; cv=none; b=AEYoYnZyNNUEkMaC+Wu4wL0CvkmqvyyHIOC8F2iPlHXxCqDEvjxdRleZMSk3zFH/geTlqOZlbkmzkXvxOex6xjZxDmYcvgxVkvvTn0Rw72f1c1fu7KrhdJPb45PBwurXuj4nGpSW13d7PB7IE4pSZRDgLooHAFdzMuYYYQb/RDw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766026985; c=relaxed/simple; bh=fAokLdHKmbiIlO6vEami68z97eCTWYFHukpu50QAphI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dpqM/1JBm4PZw67GaEtro/3OMlc0zJABSa6R43rgNM3xQoQhY4Id7jXmiOvLIrQ6/codawk0PmEKxUu9FJcor8dFlDCndq0fbSF+CK70C0zktdSFS4UqCXYgTM+BUz9VwztQIQmGtrFg2GIclXO387DO56RCJn62KKIwxu2rCho= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=waGc9MRm; arc=none smtp.client-ip=115.124.30.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="waGc9MRm" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1766026974; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=/p9v/7P8G2nkpG33YfeBu+GqgEjXSnj2Lz7Bm8EiiFs=; b=waGc9MRmJxPShr7I4PccPgrxByW1ST2n3QUmVByUOCksaTdjh3KV8hV2hOFE76ctcAphO9b3ekiKVVyvnfOWEjtg+etj7ywaBGiChWJiCnPRZKsbExQalXEQniNGWdu+75lJWTDFD22JhWJyH5umZ/j0kRByjfHrXv+u5Q0ZELg= Received: from 30.221.132.6(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Wv6Uryb_1766026972 cluster:ay36) by smtp.aliyun-inc.com; Thu, 18 Dec 2025 11:02:53 +0800 Message-ID: Date: Thu, 18 Dec 2025 11:02:52 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] erofs: simplify the code using for_each_set_bit To: Yuwen Chen , xiang@kernel.org Cc: chao@kernel.org, huyue2@coolpad.com, jefflexu@linux.alibaba.com, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org References: From: Gao Xiang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 > --- > > 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