Commit Graph

22 Commits

Author SHA1 Message Date
Simon Glass
60a16564a1 ext4l: Add extents_status.c compilation support
Add the extent status tree implementation to the ext4l build. This
module tracks extent status in memory to support delayed allocation
and SEEK_DATA/SEEK_HOLE operations.

Changes:
- Add extents_status.o to Makefile
- Add include guard to acl.h
- Add shrinker, ktime, and ratelimit stubs to ext4_uboot.h
- Guard iomap definitions in ext4_uboot.h when iomap.h is included
- Guard dquot macros when quotaops.h is included
- Remove stub functions now provided by extents_status.c
- Add ext4_da_release_space/update_reserve_space stubs

Series-to: u-boot
Cover-letter:
ext4l: Adjust some of the smaller files (part C)
This series makes various changes to allow some of the ext4l files to
compile successfully.

It provides a basic Kconfig to allow selecting ext4l (ext4 from Linu)
instead of the existing ext4 implementation.

To reduce the large number of include/linux files somewhat and to avoid
exceesive diffs against the Linux files, a new ext4_uboot.h header is
created. This will expand over time.
END

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-18 12:34:17 -07:00
Simon Glass
f04cd9dbc2 ext4l: Add extents.c compilation support
Add extents.c (extent handling) to the build and provide stubs.

Changes to extents.c:
- Replace Linux includes with ext4_uboot.h

Changes to ext4_uboot.h:
- Add __GFP_MOVABLE, __GFP_FS memory allocation flags
- Add FIEMAP_EXTENT_* flags for fiemap operations
- Add FALLOC_FL_* flags for fallocate operations
- Add O_SYNC flag and struct file with f_mapping
- Add struct iomap and iomap_ops for I/O mapping
- Add IOMAP_* type constants
- Add struct fiemap_extent_info and FIEMAP_FLAG_* constants
- Add i_blkbits member to inode struct

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-18 12:34:17 -07:00
Simon Glass
334ad928b4 ext4l: Add balloc.c compilation support
Add balloc.c (block allocation) to the build and provide stubs.

Changes to balloc.c:
- Replace Linux includes with ext4_uboot.h

Changes to mballoc.h:
- Replace Linux includes with ext4_uboot.h

Changes to ext4_uboot.h:
- Add REQ_META, REQ_PRIO, REQ_RAHEAD block I/O request flags
- Add CAP_SYS_ADMIN, CAP_SYS_RESOURCE capability stubs
- Add capable() stub that always returns true
- Add s_id member to super_block struct

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-18 12:34:17 -07:00
Simon Glass
ff44e2dbb4 ext4l: Add ext4_jbd2.c compilation support
Add ext4_jbd2.c to the build and provide the necessary stubs. To avoid
build warnings while we build out the required interfacing, start a new
stub.c file containing empty functions.

Changes to ext4_jbd2.c:
- Remove trace/events/ext4.h include (not needed)
- Stub out ext4_check_bdev_write_error() since U-Boot lacks async
  I/O error tracking
- Add return after BUG() to silence non-void function warning

Changes to ext4_jbd2.h:
- Include ext4_uboot.h instead of linux/fs.h

Changes to ext4_uboot.h:
- Add sb_writers struct and SB_FREEZE constants
- Add _RET_IP_ macro
- Add mapping_large_folio_support() stub
- Add WARN_ON_ONCE/WARN_ON as proper stubs
- Add BUG(), might_sleep(), sb_rdonly() stubs
- Add trace function stubs
- Add buffer operation stubs (wait_on_buffer, mark_buffer_dirty, etc.)
- Add inode_needs_sync stub
- Include linux/sched.h for current task

Changes to include/linux/buffer_head.h:
- Add inline bh_*_bit functions for buffer state management
- Use bh_ prefixed functions in BUFFER_FNS/TAS_BUFFER_FNS macros

Changes to include/linux/fs.h:
- Add bd_disk to block_device struct

Changes to include/linux/workqueue.h:
- Fix flush_work macro to avoid unused value warning

Add stub functions to interface.c for jbd2 journal functions:
- jbd2__journal_start, jbd2_journal_stop
- jbd2_journal_free_reserved, jbd2_journal_start_reserved
- jbd2_journal_extend, jbd2_journal_get_write_access
- jbd2_journal_set_triggers, jbd2_journal_forget
- jbd2_journal_revoke, jbd2_journal_get_create_access
- jbd2_journal_dirty_metadata
- __ext4_error, __ext4_std_error, ext4_decode_error

Keep full Linux jbd2.h with compatibility header includes.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-18 12:34:17 -07:00
Simon Glass
4c245023bb ext4l: Add hash.c compilation support
Add hash.c to the ext4l build with required compatibility headers.

Create ext4_uboot.h with minimal definitions needed for hash.c:
- rol32() rotation function
- struct inode and super_block stubs
- struct qstr and dx_hash_info for directory hashing
- DX_HASH_* constants and EXT4_HTREE_EOF_32BIT
- fscrypt stub functions (encryption not supported)
- ext4_warning macros (stubbed out)

Modify hash.c to use ext4_uboot.h instead of Linux kernel headers.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-18 12:34:17 -07:00
Simon Glass
7c5788a85d ext4l: Add CONFIG_FS_EXT4L build infrastructure
Add the basic build infrastructure for the ext4l filesystem:

- Add FS_EXT4L Kconfig option in fs/ext4l/Kconfig
- Add ext4l to fs/Kconfig and fs/Makefile
- Add fstype_info entry in fs_legacy.c with unsupported stubs
- Add minimal interface.c with stub probe/close functions

This allows sandbox to build with CONFIG_FS_EXT4L=y. The filesystem
doesn't work yet - all operations return unsupported.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-18 12:34:16 -07:00
Simon Glass
5ce331eb7e ext4l: bring in Kconfig and Makefile
Copy Kconfig and Makefile from Linux v6.18 fs/ext4 directory.

- Kconfig: configuration options for ext4
- Makefile: build rules

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
00e5dc76b5 ext4l: bring in xattr files
Copy xattr.c, xattr.h, xattr_hurd.c, xattr_security.c, xattr_trusted.c,
and xattr_user.c from Linux v6.18 fs/ext4 directory.

These files implement extended attribute support for ext4:
- xattr.c/h: core xattr implementation
- xattr_hurd: Hurd translator xattr handler
- xattr_security: security label xattr handler
- xattr_trusted: trusted xattr handler
- xattr_user: user xattr handler

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
98ddbdae46 ext4l: bring in resize, symlink, sysfs, truncate, verity, and readpage
Copy resize.c, symlink.c, sysfs.c, truncate.h, verity.c, and readpage.c
from Linux v6.18 fs/ext4 directory.

- resize: online filesystem resize support
- symlink: symbolic link operations
- sysfs: sysfs attribute interface
- truncate.h: truncate-related declarations
- verity: fs-verity support
- readpage: page reading operations

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
1d6c60270f ext4l: bring in migrate, mmp, move_extent, orphan, and page-io
Copy migrate.c, mmp.c, move_extent.c, orphan.c, and page-io.c from
Linux v6.18 fs/ext4 directory.

- migrate: migration between indirect and extent mapping
- mmp: multi-mount protection
- move_extent: extent moving ioctl support
- orphan: orphan inode handling
- page-io: page I/O operations

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
096fea33ba ext4l: bring in inode-test, ioctl, and mballoc headers
Copy inode-test.c, ioctl.c, mballoc.h, and mballoc-test.c from Linux
v6.18 fs/ext4 directory.

- inode-test: KUnit tests for inode timestamp handling
- ioctl: filesystem ioctl handlers
- mballoc.h: multiblock allocator header
- mballoc-test: KUnit tests for multiblock allocator

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
4b9dfbed5f ext4l: bring in indirect and inline
Copy indirect.c and inline.c from Linux v6.18 fs/ext4 directory.

- indirect: indirect block mapping for ext2/ext3 compatibility
- inline: inline data support for small files stored in inode

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
1e271714d9 ext4l: bring in file, fsmap, and ialloc
Copy file.c, fsmap.c, fsmap.h, and ialloc.c from Linux v6.18 fs/ext4
directory.

- file: file operations (open, read, write, mmap, etc.)
- fsmap: filesystem block mapping for GETFSMAP ioctl
- ialloc: inode allocation

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
9295071662 ext4l: bring in ext4_jbd2 and fast_commit
Copy ext4_jbd2.c, ext4_jbd2.h, fast_commit.c, and fast_commit.h from
Linux v6.18 fs/ext4 directory.

- ext4_jbd2: ext4-specific JBD2 journal interface wrappers
- fast_commit: fast commit journal optimization

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
2e527f71fe ext4l: bring in extents_status, fsync, and hash
Copy extents_status.c, extents_status.h, fsync.c, and hash.c from
Linux v6.18 fs/ext4 directory.

- extents_status: extent status tree for tracking extent state
- fsync: file synchronization operations
- hash: directory entry hashing for htree directories

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
8af80aa97e ext4l: bring in files a-d
Copy acl.c, acl.h, balloc.c, bitmap.c, block_validity.c, crypto.c, and
dir.c from Linux v6.18 fs/ext4 directory.

- acl: POSIX ACL support
- balloc: block allocation helpers
- bitmap: bitmap manipulation utilities
- block_validity: block validity checking
- crypto: filesystem encryption support
- dir: directory entry handling

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
a3faa9e2d4 ext4l: bring in ext4.h
Copy ext4.h from Linux v6.18 fs/ext4 directory. This is the main header
file defining structures, constants, and function prototypes for ext4.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
cab2feaa92 ext4l: bring in super.c
Copy super.c from Linux v6.18 fs/ext4 directory. This file implements
superblock operations including mount, unmount, and filesystem options.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
4153a0b94d ext4l: bring in namei.c
Copy namei.c from Linux v6.18 fs/ext4 directory. This file implements
directory operations including lookup, create, link, unlink, and rename.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
d32c25d292 ext4l: bring in mballoc.c
Copy mballoc.c from Linux v6.18 fs/ext4 directory. This file implements
the multiblock allocator for efficient block allocation.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
08a334993a ext4l: bring in inode.c
Copy inode.c from Linux v6.18 fs/ext4 directory. This file implements
inode operations including reading, writing, and truncating files.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00
Simon Glass
e07c4209c1 ext4l: bring in extents.c
Copy extents.c and ext4_extents.h from Linux v6.18 fs/ext4 directory.
These files implement the extent-based block mapping used by ext4.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 13:19:59 +00:00