initrd: cleanup and erofs support
Get series with b4
b4 am [email protected] change-id 20250320-initrd-erofs-76e925fdf68cVersions newest first
- v2 Latest9 patches 2 repliesIn review
- v11 patch 27 repliesSuperseded
Changes in v2 from the cover letter
- Remove more legacy code
- Introduce initrd_fs_detect
- Move all other initrd filesystems to the new API
- Link to v1: https://lore.kernel.org/r/[email protected]
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | initrd: remove ASCII spinnerinit/ | +0 | 1 reply | |
| 2/9 | initrd: fix double fput for truncated ramdisksinit/ | +7 | 0 replies | |
| 3/9 | initrd: add a generic mechanism to add fs detectorsinclude/ include/ init/ | +70 | 1 reply | |
| 4/9 | fs: minix: register an initrd fs detectorfs/ fs/ init/ | +29 | 0 replies | |
| 5/9 | fs: cramfs: register an initrd fs detectorfs/ fs/ init/ | +48 | 0 replies | |
| 6/9 | fs: romfs: register an initrd fs detectorfs/ fs/ init/ | +26 | 0 replies | |
| 7/9 | fs: squashfs: register an initrd fs detectorfs/ fs/ init/ | +28 | 0 replies | |
| 8/9 | fs: ext2, ext4: register an initrd fs detectorfs/ fs/ fs/ +2 more | +36 | 0 replies | |
| 9/9 | fs: erofs: register an initrd fs detectorfs/ fs/ | +24 | 0 replies |
Reviews trailers per patch
1 of 9 patches has a Reviewed-by or Acked-by.
| Patch | David Disseldorp |
|---|---|
| 1/9 | R-b |
| 2/9 | |
| 3/9 | |
| 4/9 | |
| 5/9 | |
| 6/9 | |
| 7/9 | |
| 8/9 | |
| 9/9 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/9] initrd: cleanup and erofs support
On my journey towards adding erofs support for initrd, Al Viro suggested to move the filesystem detection code into the respective filesystem modules. This patch series implements this, while also adding erofs support.
To achieve this, I added a macro initrd_fs_detect() that allows filesystem modules to add a filesystem detection hooks. I then moved all existing filesystem detection code to this new API. While I was there I also tried to clean up some of the code.
I've tested these changes with the following kinds of initrd images:
- ext2
- Minix v1
- cramfs (padded/unpadded)
- romfs
- squashfs
- erofs
initrds are still relevant, because they have some advantages over initramfs. They don't require unpacking all files before starting the init process and allows them to stay compressed in memory. They also allow using advanced file system features, such as extended attributes. In the NixOS community, we are heavy users of erofs, due to its sweet spot of compression, speed and features.
That being said, I'm totally in favor of cutting down the supported filesystems for initrd and further simplify the code. I would be surprised, if anyone is using ext2 or Minix v1 filesystems (64 MiB filesystem size limit!) or cramfs (16 MiB file size limit!) as an initrd these days! Squashfs and erofs seem genuinely useful, though.
---
Changes in v2:
- Remove more legacy code
- Introduce initrd_fs_detect
- Move all other initrd filesystems to the new API
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Julian Stecklina (9):
initrd: remove ASCII spinner
initrd: fix double fput for truncated ramdisks
initrd: add a generic mechanism to add fs detectors
fs: minix: register an initrd fs detector
fs: cramfs: register an initrd fs detector
fs: romfs: register an initrd fs detector
fs: squashfs: register an initrd fs detector
fs: ext2, ext4: register an initrd fs detector
fs: erofs: register an initrd fs detector
fs/cramfs/Makefile | 5 ++ fs/cramfs/initrd.c | 41 +++++++++++++ fs/erofs/Makefile | 5 ++ fs/erofs/initrd.c | 19 ++++++ fs/ext2/Makefile | 5 ++ fs/ext2/initrd.c | 27 +++++++++ fs/ext4/Makefile | 4 ++ fs/minix/Makefile | 5 ++ fs/minix/initrd.c | 23 +++++++ fs/romfs/Makefile | 4 ++ fs/romfs/initrd.c | 22 +++++++ fs/squashfs/Makefile | 5 ++ fs/squashfs/initrd.c | 23 +++++++ include/asm-generic/vmlinux.lds.h | 6 ++ include/linux/ext2_fs.h | 9 --- include/linux/initrd.h | 37 ++++++++++++ init/do_mounts_rd.c | 122 ++++++++------------------------------ 17 files changed, 257 insertions(+), 105 deletions(-)
---
base-commit: 88d324e69ea9f3ae1c1905ea75d717c08bdb8e15
change-id: 20250320-initrd-erofs-76e925fdf68c
Best regards,
Signature · 1 line
Julian Stecklina <[email protected]>