Skip to content

Avoid 64-bit divisions that need __udivdi3() or __umoddi3()

Josef Schlehofer linux-btrfs u-boot 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6fs: btrfs: Avoid a 64-bit modulo in __btrfs_devread()fs/btrfs/compat.h+1 -11 reply
2/6fs/squashfs: Avoid 64-bit divisionsfs/squashfs/sqfs.c fs/squashfs/sqfs_inode.c+14 -120 replies
3/6mmc: Use div_u64() in mmc_berase()drivers/mmc/mmc_write.c+1 -11 reply
4/6powerpc: mpc8xxx: Avoid a 64-bit division in get_win_cnt()arch/powerpc/cpu/mpc8xxx/fsl_pamu.c+1 -11 reply
5/6fs: btrfs: Remove the unused dev.cfs/btrfs/Makefile fs/btrfs/dev.c+1 -263 replies
6/6fs: btrfs: Avoid the remaining 64-bit divisionsfs/btrfs/compat.h fs/btrfs/volumes.c fs/btrfs/volumes.h+17 -171 reply

Reviews trailers per patch

5 of 6 patches have a Reviewed-by or Acked-by.

PatchBradley MorganQu WenruoPeng Fan
1/6R-b
2/6
3/6R-b
4/6A-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 0/6] Avoid 64-bit divisions that need __udivdi3() or __umoddi3()

U-Boot's private libgcc does not provide __udivdi3() and __umoddi3(). v3 of the mpc85xx LTO series links mpc85xx LTO builds with it and added both routines [1]. Christophe Leroy asked why the callers do not avoid '/' and '%' on 64-bit operands instead, and Tom Rini asked to update the common code [2].

Patches 1-4 avoid the divisions that make the mpc85xx LTO builds call __udivdi3() or __umoddi3(), in btrfs, squashfs, mmc_berase() and get_win_cnt() of the mpc8xxx PAMU code. They do not depend on each other. Patch 5 removes fs/btrfs/dev.c, which nothing uses and which holds another 64-bit modulo. Patch 6 converts the remaining divisions in btrfs. U-Boot never runs them, but builds without LTO still link the ones in the RAID5/6 code. My reply in that thread announced these conversions for v4 of the LTO series. They are sent on their own instead.

Patch 2 and my big-endian fix for squashfs [3] conflict in sqfs_read_nest(). I will rebase whichever of them goes in second.

Build tested with a buildman world build on a fork's CI, and sandbox test.py gives the same results as before. Run tested on qemu-ppce500 (btrfs) and qemu_arm (btrfs, squashfs, mmc erase), and on a Turris 1.1 with the mpc85xx LTO patches on top, which boots from an SD card and loads files from btrfs. The PAMU change is build tested only.

[1] https://lore.kernel.org/u-boot/[email protected]/
[2] https://lore.kernel.org/u-boot/20261119200924.GB3176972@bill-the-cat/
[3] https://lore.kernel.org/u-boot/[email protected]/

Josef Schlehofer (6):
fs: btrfs: Avoid a 64-bit modulo in __btrfs_devread() fs/squashfs: Avoid 64-bit divisions
mmc: Use div_u64() in mmc_berase()
powerpc: mpc8xxx: Avoid a 64-bit division in get_win_cnt()
fs: btrfs: Remove the unused dev.c
fs: btrfs: Avoid the remaining 64-bit divisions

 arch/powerpc/cpu/mpc8xxx/fsl_pamu.c |  2 +-
 drivers/mmc/mmc_write.c             |  2 +-
 fs/btrfs/Makefile                   |  2 +-
 fs/btrfs/compat.h                   |  8 ++------
 fs/btrfs/dev.c                      | 25 -------------------------
 fs/btrfs/volumes.c                  | 19 +++++++++++--------
 fs/btrfs/volumes.h                  |  9 +++++----
 fs/squashfs/sqfs.c                  | 21 +++++++++++----------
 fs/squashfs/sqfs_inode.c            |  5 +++--
 9 files changed, 35 insertions(+), 58 deletions(-)
 delete mode 100644 fs/btrfs/dev.c

base-commit: 79497816056122c49b3b135e14cbac59374e636c

Signature · 1 line
2.54.0 (Apple Git-157)