From: Josef Schlehofer <pepe.schlehofer@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: "Tom Rini" <trini@konsulko.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Bradley Morgan" <bradley.morgan@linux.dev>,
linux-btrfs@vger.kernel.org, "Marek Behún" <kabel@kernel.org>,
"Qu Wenruo" <wqu@suse.com>
Subject: [PATCH 1/6] fs: btrfs: Avoid a 64-bit modulo in __btrfs_devread()
Date: Wed, 25 Nov 2026 13:42:54 +0100 [thread overview]
Message-ID: <20261125124259.95636-2-pepe.schlehofer@gmail.com> (raw)
In-Reply-To: <20261125124259.95636-1-pepe.schlehofer@gmail.com>
On 32-bit PowerPC, GCC turns the u64 '%' in __btrfs_devread() into a
call to __umoddi3(), which U-Boot's private libgcc does not provide.
The shift by log2blksz on the line above already requires a power-of-two
block size, so take the offset within the block with a mask.
Suggested-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Cc: Marek Behún <kabel@kernel.org>
Cc: Qu Wenruo <wqu@suse.com>
Cc: Tom Rini <trini@konsulko.com>
---
fs/btrfs/compat.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/compat.h b/fs/btrfs/compat.h
index 4596b9d1dd3..e6784884835 100644
--- a/fs/btrfs/compat.h
+++ b/fs/btrfs/compat.h
@@ -60,7 +60,7 @@ static inline int __btrfs_devread(struct blk_desc *desc,
int ret;
sector = offset >> desc->log2blksz;
- byte_offset = offset % desc->blksz;
+ byte_offset = offset & (desc->blksz - 1);
/* fs_devread() return 0 for error, >0 for success */
ret = fs_devread(desc, part, sector, byte_offset, size, buf);
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-11-25 12:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 12:42 [PATCH 0/6] Avoid 64-bit divisions that need __udivdi3() or __umoddi3() Josef Schlehofer
2026-11-25 12:42 ` Josef Schlehofer [this message]
2026-11-25 20:11 ` [PATCH 1/6] fs: btrfs: Avoid a 64-bit modulo in __btrfs_devread() Qu Wenruo
2026-11-25 12:42 ` [PATCH 5/6] fs: btrfs: Remove the unused dev.c Josef Schlehofer
2026-11-25 20:14 ` Qu Wenruo
2026-11-26 9:15 ` Josef Schlehofer
2026-11-26 9:20 ` Qu Wenruo
2026-11-25 12:42 ` [PATCH 6/6] fs: btrfs: Avoid the remaining 64-bit divisions Josef Schlehofer
2026-11-25 20:15 ` Qu Wenruo
2026-11-25 15:45 ` [PATCH 0/6] Avoid 64-bit divisions that need __udivdi3() or __umoddi3() Bradley Morgan
2026-11-25 15:51 ` Tom Rini
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=20261125124259.95636-2-pepe.schlehofer@gmail.com \
--to=pepe.schlehofer@gmail.com \
--cc=bradley.morgan@linux.dev \
--cc=chleroy@kernel.org \
--cc=kabel@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=wqu@suse.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