From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Daniel Palmer <daniel@thingy.jp>
Cc: jnhuang95@gmail.com, angelo@kernel-space.org, u-boot@lists.denx.de
Subject: Re: [PATCH] fs/erofs: Fix build for m68k
Date: Sun, 26 Apr 2026 00:12:27 +0800 [thread overview]
Message-ID: <aezn6_Jpj1RG-RxF@google.com> (raw)
In-Reply-To: <20260419100123.2427364-1-daniel@thingy.jp>
Hi Daniel,
On Sun, Apr 19, 2026 at 07:01:23PM +0900, Daniel Palmer wrote:
> Currently the use of roundup() causes GCC to emit a reference
> to __udivdi3() on m68k and we don't have that:
>
> /usr/bin/m68k-linux-gnu-ld.bfd: fs/erofs/data.o: in function `erofs_map_blocks':
> u-boot/fs/erofs/data.c:81:(.text.erofs_map_blocks+0x126): undefined reference to `__udivdi3'
> /usr/bin/m68k-linux-gnu-ld.bfd: u-boot/fs/erofs/data.c:81:(.text.erofs_map_blocks+0x458): undefined reference to `__udivdi3'
>
> We could add it but since unit is 4 or 8 we can actually just
> switch the code to use round_up() instead and not output
> __udivdi3() in the first place.
>
> Signed-off-by: Daniel Palmer <daniel@thingy.jp>
> ---
> fs/erofs/data.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/erofs/data.c b/fs/erofs/data.c
> index b58ec6fcc666..95873846f62d 100644
> --- a/fs/erofs/data.c
> +++ b/fs/erofs/data.c
> @@ -78,7 +78,7 @@ int erofs_map_blocks(struct erofs_inode *inode,
> unit = EROFS_BLOCK_MAP_ENTRY_SIZE; /* block map */
>
> chunknr = map->m_la >> vi->u.chunkbits;
> - pos = roundup(iloc(vi->nid) + vi->inode_isize +
> + pos = round_up(iloc(vi->nid) + vi->inode_isize +
> vi->xattr_isize, unit) + unit * chunknr;
Since round_up(x, y) requires y to be a power of two, I was wondering
if it might be worth adding an assertion here to ensure this?
Additionally, a bit further down in erofs_map_blocks(), there is
another instance where roundup() is used. I haven't checked the
generated assembly, but I'm guessing it didn't fail because gcc was
smart enough to optimize it into a right shift? Since erofs_blksiz() is
defined as (1u << sbi.blkszbits), it is also guaranteed to be a power
of two. Perhaps we should replace that one with round_up() as well, for
safety and consistency?
Regards,
Kuan-Wei
>
> err = erofs_blk_read(buf, erofs_blknr(pos), 1);
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-04-25 16:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-19 10:01 [PATCH] fs/erofs: Fix build for m68k Daniel Palmer
2026-04-25 16:12 ` Kuan-Wei Chiu [this message]
2026-04-27 9:40 ` Daniel Palmer
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=aezn6_Jpj1RG-RxF@google.com \
--to=visitorckw@gmail.com \
--cc=angelo@kernel-space.org \
--cc=daniel@thingy.jp \
--cc=jnhuang95@gmail.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.