From nobody Tue Apr 7 04:19:57 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5C75C3EC2E2; Mon, 16 Mar 2026 19:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773687766; cv=none; b=r+22LtYqhp9CKG/EycSCqW9zRE10H11MUsIhPksQbk3wDSM3TjlmvTpyCLN2QaXkT30ZfOR+/R5zlHAFv5HKKu/tMserWL4jf8L8JbanOMqnVbDnWTn9ShY+2wkwgzr7aeHG/ucGqj1ZqyXUTAmtpmEE/hFJOAbPpmu8k5g4Jc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773687766; c=relaxed/simple; bh=CUkhw3xl8xIRjoR4RbMKIcmO3c0dZFO7usOuKJlm4c4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Co8BaSrH4OJ9PbTt9IOPyuTMiOUQ5qO7uF/aP36NSNlwov7MMZtU+LfU5YxAbFgHYo8qgvEX0Et3Ji+8aHl4u9aPMQr3yYbPbQn+jlKmkzjzHQDbzZXlyQcHFX651wy7585kix524+25+04vy1Xe7J9lPP+6OuTILh/MvC6BINg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mJW4Vh0H; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mJW4Vh0H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B275FC2BCB3; Mon, 16 Mar 2026 19:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773687766; bh=CUkhw3xl8xIRjoR4RbMKIcmO3c0dZFO7usOuKJlm4c4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mJW4Vh0HAFzhHgFoWvUIXGQKWxXFMsnpcqEiyNCLCT3r9CSByh3g0E0fND07bqgRb 0Hb1/kBe+iFnKWX0GeqaraDUgsCr26BkJNw8y0jepowt3oWEKI6XlGubU2aNf4FV+T MaGVsXE5OfF/nu+sGW4eYjCggEDdSbn1lGoAVtCH3f2TssdyXZ9nFPfhJyhw4TO5aT HeFEzmdP3r491jMRfD3yhl7CQCiRNE/qzgWRCtYKnp0fOOK3PqSrpl2jRpf+ZyHtbu +FtVYvn+e4ucu/WfVKkzpjv8y4IqkVTPNhad4QZ4gwZV3J+pPEUX2b+REKYDripGw3 mLJz/25prB3iA== From: Jeff Layton Date: Mon, 16 Mar 2026 15:02:23 -0400 Subject: [PATCH v3 2/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260316-iino-u64-v3-2-d1076b8f7a20@kernel.org> References: <20260316-iino-u64-v3-0-d1076b8f7a20@kernel.org> In-Reply-To: <20260316-iino-u64-v3-0-d1076b8f7a20@kernel.org> To: Ryusuke Konishi , Viacheslav Dubeyko , Christian Brauner , Mimi Zohar , Roberto Sassu , Dmitry Kasatkin , Eric Snowberg , Paul Moore , James Morris , "Serge E. Hallyn" Cc: David Laight , linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jeff Layton , kernel test robot X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2169; i=jlayton@kernel.org; h=from:subject:message-id; bh=CUkhw3xl8xIRjoR4RbMKIcmO3c0dZFO7usOuKJlm4c4=; b=owEBbQKS/ZANAwAKAQAOaEEZVoIVAcsmYgBpuFPQVZMUYX+O8fn7SpAIPVmqwkRvPuMz5JaPj Tv7vfY/ClOJAjMEAAEKAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCabhT0AAKCRAADmhBGVaC FQZ9D/9E+wUpb9S2ol0rfVLUqP434oMLE4Z/2pT0pJ8AOVE2CMqfbA/2KzU2Y3HrHnYJAirEMNN v6WbqhZFaeVxOomaU9Gb5Kyasvd2dBEFWgjXc0U39kzMsyAhE3WRUGEk66Eqvi0bzdKYCpyfjbO fSO1JrbT9RPgHhlv2KCWiGhm5/5LRoaYd8k65+YMi4mLkIRhxInG6v9DCfMwjKStdoK37I93Rgq eUF78aT52ToEax/9u1vW+my6MkKSm9nXzvDsioOE2o5GoFAt2Nk1fxuO0qWHyCzVYKGN8i2ksvr bxODCyGUoOCQ3mq327mQeMlGAUOoXFwmV5nVstqNFhZIRIdsk281GbAajSZc1ScDrrfR2CDbzmp z1CbSRGcEs9h4OoJEho7gi4uldeXUAE3YDIJK68UaTAZJS6J+1aa5XXLTNrUGrN2lk4lzhIOWxZ kqv31A8mDElVKBLeF4c7/OwTGCi4cKDEFgK1sDVDpmOykQ+m5trn8jwUYwUVLQmF2pZ18gExtn3 9GEfptvkU/Hg/GUtoK+8nfuFNq6KHuAkxNHMXxSCjIYJxNURiy725EnzbTg7yzDshNOeeKbX8EU anxZv7rNTnkkyKqA5QiwbyAFmgbzIx5NlsDHGsrSuki0nrK+IxKwhU3dqFi78WkRCdTO+84Lcaq +s47Dz1vuvvgACA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 With the change to make inode->i_ino a u64, the build started failing on 32-bit ARM with: ERROR: modpost: "__aeabi_uldivmod" [fs/nilfs2/nilfs2.ko] undefined! Fix this by using udiv_u64() for the division. For finding the index into the group, switch to using a bitwise & operation since that's more efficient. With this change however, NILFS_BMAP_GROUP_DIV must be a power of two, so add a compile-time assertion for that. Fixes: 998a59d371c2 ("treewide: fix missed i_ino format specifier conversio= ns") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202603100602.KPxiClIO-lkp@int= el.com/ Reviewed-by: Viacheslav Dubeyko Acked-by: Ryusuke Konishi Signed-off-by: Jeff Layton --- fs/nilfs2/bmap.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 824f2bd91c167965ec3a660202b6e6c5f1fe007e..5f0f1f283af0208e1879e2e84b0= b5b9629fd6b8a 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c @@ -450,18 +450,25 @@ __u64 nilfs_bmap_find_target_seq(const struct nilfs_b= map *bmap, __u64 key) return NILFS_BMAP_INVALID_PTR; } =20 -#define NILFS_BMAP_GROUP_DIV 8 +#define NILFS_BMAP_GROUP_DIV 8 /* must be power of 2 */ + __u64 nilfs_bmap_find_target_in_group(const struct nilfs_bmap *bmap) { struct inode *dat =3D nilfs_bmap_get_dat(bmap); unsigned long entries_per_group =3D nilfs_palloc_entries_per_group(dat); - unsigned long group =3D bmap->b_inode->i_ino / entries_per_group; + unsigned long group; + u32 index; + + BUILD_BUG_ON_NOT_POWER_OF_2(NILFS_BMAP_GROUP_DIV); + + group =3D div_u64(bmap->b_inode->i_ino, entries_per_group); + index =3D bmap->b_inode->i_ino & (NILFS_BMAP_GROUP_DIV - 1); =20 return group * entries_per_group + - (bmap->b_inode->i_ino % NILFS_BMAP_GROUP_DIV) * - (entries_per_group / NILFS_BMAP_GROUP_DIV); + index * (entries_per_group / NILFS_BMAP_GROUP_DIV); } =20 + static struct lock_class_key nilfs_bmap_dat_lock_key; static struct lock_class_key nilfs_bmap_mdt_lock_key; =20 --=20 2.53.0