[PATCH v2 0/9] initrd: cleanup and erofs support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Julian Stecklina <julian.stecklina@xxxxxxxxxxxxxxxxxxxxx>
---
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/20250320-initrd-erofs-v1-1-35bbb293468a@xxxxxxxxxxxxxxxxxxxxx

---
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,
-- 
Julian Stecklina <julian.stecklina@xxxxxxxxxxxxxxxxxxxxx>






[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux