From: Simon Glass <simon.glass@canonical.com> Add filesystem-resize support. Use ext4_uboot.h compatibility layer and add stubs for: - test_and_set_bit_lock - forwards to test_and_set_bit - div64_u64 - simple 64-bit division - time_is_before_jiffies - always returns false Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/Makefile | 2 +- fs/ext4l/ext4_uboot.h | 19 +++++++++++++++++++ fs/ext4l/resize.c | 6 +----- fs/ext4l/stub.c | 7 +++++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index 4afcc43e34f..ee929539eb8 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -8,7 +8,7 @@ obj-y := interface.o stub.o obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \ extents_status.o file.o fsync.o hash.o ialloc.o \ indirect.o inline.o inode.o mballoc.o migrate.o \ - mmp.o move_extent.o namei.o page-io.o readpage.o \ + mmp.o move_extent.o namei.o page-io.o readpage.o resize.o \ super.o symlink.o xattr.o \ xattr_hurd.o xattr_trusted.o \ xattr_user.o fast_commit.o orphan.o diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 617ec9a8afe..8a3143a6d27 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -2969,4 +2969,23 @@ static inline struct new_utsname *init_utsname(void) #define unlock_two_nondirectories(i1, i2) \ do { (void)(i1); (void)(i2); } while (0) +/* + * Stubs for resize.c + */ + +/* test_and_set_bit_lock - test and set a bit atomically */ +#define test_and_set_bit_lock(nr, addr) test_and_set_bit(nr, addr) + +/* div64_u64 - 64-bit by 64-bit division */ +static inline u64 div64_u64(u64 dividend, u64 divisor) +{ + return dividend / divisor; +} + +/* time_is_before_jiffies - check if time is before current jiffies */ +#define time_is_before_jiffies(a) ({ (void)(a); 0; }) + +/* ext4_update_overhead - declaration for stub.c */ +int ext4_update_overhead(struct super_block *sb, bool force); + #endif /* __EXT4_UBOOT_H__ */ diff --git a/fs/ext4l/resize.c b/fs/ext4l/resize.c index 050f26168d9..a52eac5f8e1 100644 --- a/fs/ext4l/resize.c +++ b/fs/ext4l/resize.c @@ -9,11 +9,7 @@ * This could probably be made into a module, because it is not often in use. */ - -#include <linux/errno.h> -#include <linux/slab.h> -#include <linux/jiffies.h> - +#include "ext4_uboot.h" #include "ext4_jbd2.h" struct ext4_rcu_ptr { diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 1bf1e958e48..93315d10fa8 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -379,9 +379,12 @@ void *kvzalloc(size_t size, gfp_t flags) return calloc(1, size); } -void ext4_kvfree_array_rcu(void *p) +/* ext4_kvfree_array_rcu - now in resize.c */ + +/* ext4_update_overhead - stub for resize.c */ +int ext4_update_overhead(struct super_block *sb, bool force) { - free(p); + return 0; } /* String stubs */ -- 2.43.0