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>
This commit is contained in:
@@ -5,5 +5,5 @@
|
||||
|
||||
obj-y := interface.o stub.o
|
||||
|
||||
obj-y += balloc.o bitmap.o block_validity.o ext4_jbd2.o extents.o hash.o \
|
||||
ialloc.o indirect.o
|
||||
obj-y += balloc.o bitmap.o block_validity.o ext4_jbd2.o extents.o \
|
||||
extents_status.o hash.o ialloc.o indirect.o
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
(C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
|
||||
*/
|
||||
|
||||
#ifndef _FS_EXT4_ACL_H
|
||||
#define _FS_EXT4_ACL_H
|
||||
|
||||
#include <linux/posix_acl_xattr.h>
|
||||
|
||||
#define EXT4_ACL_VERSION 0x0001
|
||||
@@ -72,3 +75,4 @@ ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
|
||||
}
|
||||
#endif /* CONFIG_EXT4_FS_POSIX_ACL */
|
||||
|
||||
#endif /* _FS_EXT4_ACL_H */
|
||||
|
||||
@@ -58,10 +58,10 @@ typedef struct { atomic_t refs; } refcount_t;
|
||||
typedef int rwlock_t;
|
||||
/* spinlock_t is defined in linux/compat.h */
|
||||
|
||||
#define read_lock(l) do { } while (0)
|
||||
#define read_unlock(l) do { } while (0)
|
||||
#define write_lock(l) do { } while (0)
|
||||
#define write_unlock(l) do { } while (0)
|
||||
#define read_lock(l) do { (void)(l); } while (0)
|
||||
#define read_unlock(l) do { (void)(l); } while (0)
|
||||
#define write_lock(l) do { (void)(l); } while (0)
|
||||
#define write_unlock(l) do { (void)(l); } while (0)
|
||||
|
||||
/* RB tree types - stubs */
|
||||
struct rb_node {
|
||||
@@ -177,7 +177,8 @@ struct dir_context {
|
||||
loff_t pos;
|
||||
};
|
||||
|
||||
/* iomap types */
|
||||
/* iomap types - only define if linux/iomap.h not included */
|
||||
#ifndef _LINUX_IOMAP_H
|
||||
#define IOMAP_MAPPED 0
|
||||
#define IOMAP_INLINE 1
|
||||
#define IOMAP_UNWRITTEN 2
|
||||
@@ -200,6 +201,7 @@ struct iomap_ops {
|
||||
int (*iomap_end)(struct inode *inode, loff_t pos, loff_t length,
|
||||
ssize_t written, unsigned flags, struct iomap *iomap);
|
||||
};
|
||||
#endif /* _LINUX_IOMAP_H */
|
||||
|
||||
/* fiemap types */
|
||||
#define FIEMAP_FLAG_SYNC 0x00000001
|
||||
@@ -313,12 +315,14 @@ extern struct user_namespace init_user_ns;
|
||||
/* Group permission - stub */
|
||||
#define in_group_p(gid) (0)
|
||||
|
||||
/* Quota operations - stubs */
|
||||
/* Quota operations - stubs (only define if quotaops.h not included) */
|
||||
#ifndef _LINUX_QUOTAOPS_H
|
||||
#define dquot_alloc_block_nofail(inode, nr) ({ (void)(inode); (void)(nr); 0; })
|
||||
#define dquot_initialize(inode) ({ (void)(inode); 0; })
|
||||
#define dquot_free_inode(inode) do { (void)(inode); } while (0)
|
||||
#define dquot_alloc_inode(inode) ({ (void)(inode); 0; })
|
||||
#define dquot_drop(inode) do { (void)(inode); } while (0)
|
||||
#endif /* _LINUX_QUOTAOPS_H */
|
||||
|
||||
/* Trace stubs for ialloc.c */
|
||||
#define trace_ext4_load_inode_bitmap(...) do { } while (0)
|
||||
@@ -358,12 +362,13 @@ extern struct user_namespace init_user_ns;
|
||||
#define fscrypt_prepare_new_inode(dir, i, e) ({ (void)(dir); (void)(i); (void)(e); 0; })
|
||||
#define fscrypt_set_context(inode, handle) ({ (void)(inode); (void)(handle); 0; })
|
||||
|
||||
/* ACL and security stubs */
|
||||
/* ACL and security stubs - only if acl.h won't be included */
|
||||
#ifndef _FS_EXT4_ACL_H
|
||||
#define ext4_init_acl(h, i, d) ({ (void)(h); (void)(i); (void)(d); 0; })
|
||||
#define ext4_init_security(h, i, d, q) ({ (void)(h); (void)(i); (void)(d); (void)(q); 0; })
|
||||
#endif
|
||||
/* Note: ext4_init_security is already handled in xattr.h */
|
||||
|
||||
/* xattr stubs */
|
||||
#define __ext4_xattr_set_credits(sb, i, b, isz, cr) ({ (void)(sb); (void)(i); (void)(b); (void)(isz); (void)(cr); 0; })
|
||||
/* xattr stubs - __ext4_xattr_set_credits is declared in xattr.h */
|
||||
|
||||
/* inode state stubs */
|
||||
#define is_bad_inode(inode) (0)
|
||||
@@ -420,7 +425,7 @@ extern struct user_namespace init_user_ns;
|
||||
#define rb_next(node) ((node)->rb_right)
|
||||
#define rb_prev(node) ((node)->rb_left)
|
||||
#define rb_insert_color(node, root) do { } while (0)
|
||||
#define rb_erase(node, root) do { } while (0)
|
||||
#define rb_erase(node, root) do { (void)(node); (void)(root); } while (0)
|
||||
#define rb_link_node(node, parent, rb_link) do { *(rb_link) = (node); } while (0)
|
||||
#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
|
||||
#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \
|
||||
@@ -784,4 +789,67 @@ static inline int in_range(unsigned long val, unsigned long start,
|
||||
|
||||
/* ext4_sb_bread_nofail is stubbed in interface.c */
|
||||
|
||||
/* extents_status.c stubs */
|
||||
|
||||
/* shrinker - memory reclaim infrastructure (stub for U-Boot) */
|
||||
struct shrink_control {
|
||||
gfp_t gfp_mask;
|
||||
int nid;
|
||||
unsigned long nr_to_scan;
|
||||
unsigned long nr_scanned;
|
||||
};
|
||||
|
||||
struct shrinker {
|
||||
unsigned long (*count_objects)(struct shrinker *, struct shrink_control *);
|
||||
unsigned long (*scan_objects)(struct shrinker *, struct shrink_control *);
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
static inline struct shrinker *shrinker_alloc(unsigned int flags,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void shrinker_register(struct shrinker *s)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void shrinker_free(struct shrinker *s)
|
||||
{
|
||||
}
|
||||
|
||||
/* ktime functions */
|
||||
static inline ktime_t ktime_get(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline s64 ktime_to_ns(ktime_t kt)
|
||||
{
|
||||
return kt;
|
||||
}
|
||||
|
||||
static inline ktime_t ktime_sub(ktime_t a, ktime_t b)
|
||||
{
|
||||
return a - b;
|
||||
}
|
||||
|
||||
/* write lock variants */
|
||||
#define write_trylock(lock) ({ (void)(lock); 1; })
|
||||
|
||||
/* percpu counter init/destroy */
|
||||
#define percpu_counter_init(fbc, val, gfp) ({ (fbc)->count = (val); 0; })
|
||||
#define percpu_counter_destroy(fbc) do { } while (0)
|
||||
|
||||
/* ratelimit macros */
|
||||
#define DEFAULT_RATELIMIT_INTERVAL (5 * 1000)
|
||||
#define DEFAULT_RATELIMIT_BURST 10
|
||||
#define DEFINE_RATELIMIT_STATE(name, interval, burst) \
|
||||
int name __attribute__((unused)) = 0
|
||||
#define __ratelimit(state) ({ (void)(state); 1; })
|
||||
|
||||
/* seq_file tokens */
|
||||
#define SEQ_START_TOKEN ((void *)1)
|
||||
|
||||
#endif /* __EXT4_UBOOT_H__ */
|
||||
|
||||
@@ -1741,6 +1741,7 @@ int ext4_seq_es_shrinker_info_show(struct seq_file *seq, void *v)
|
||||
max->vfs_inode.i_ino, max->i_es_all_nr, max->i_es_shk_nr,
|
||||
div_u64(es_stats->es_stats_max_scan_time, 1000));
|
||||
|
||||
(void)es_stats; /* Used only by seq_printf which is stubbed */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -248,12 +248,7 @@ struct ext4_sb_info;
|
||||
struct ext4_es_tree;
|
||||
struct extent_status;
|
||||
|
||||
int ext4_es_cache_extent(struct inode *inode, unsigned long lblk,
|
||||
unsigned long len, unsigned long long pblk,
|
||||
unsigned int status)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* ext4_es_cache_extent is now in extents_status.c */
|
||||
|
||||
int ext4_issue_zeroout(struct inode *inode, unsigned long long lblk,
|
||||
unsigned long long pblk, unsigned long long len)
|
||||
@@ -261,13 +256,15 @@ int ext4_issue_zeroout(struct inode *inode, unsigned long long lblk,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ext4_es_insert_extent(struct inode *inode, unsigned long lblk,
|
||||
unsigned long len, unsigned long long pblk,
|
||||
unsigned int status)
|
||||
/* ext4_es_insert_extent is now in extents_status.c */
|
||||
|
||||
/* ext4_remove_pending is now in extents_status.c */
|
||||
|
||||
void ext4_da_release_space(struct inode *inode, int to_free)
|
||||
{
|
||||
}
|
||||
|
||||
void ext4_remove_pending(struct inode *inode, unsigned long lblk)
|
||||
void ext4_da_update_reserve_space(struct inode *inode, int used, int quota_claim)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -306,10 +303,7 @@ int ext4_chunk_trans_blocks(struct inode *inode, int nrblocks)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ext4_is_pending(struct inode *inode, unsigned long lblk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* ext4_is_pending is now in extents_status.c */
|
||||
|
||||
int ext4_meta_trans_blocks(struct inode *inode, int lblk, int pblk)
|
||||
{
|
||||
@@ -355,24 +349,11 @@ void ext4_truncate_page_cache_block_range(struct inode *inode, loff_t start,
|
||||
/* ext4_iomap_report_ops - just a symbol needed for linking */
|
||||
char ext4_iomap_report_ops;
|
||||
|
||||
int ext4_es_lookup_extent(struct inode *inode, unsigned long lblk,
|
||||
unsigned long *next_lblk, void *es)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* ext4_es_lookup_extent is now in extents_status.c */
|
||||
|
||||
int ext4_es_remove_extent(struct inode *inode, unsigned long lblk,
|
||||
unsigned long len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* ext4_es_remove_extent is now in extents_status.c */
|
||||
|
||||
int ext4_es_find_extent_range(struct inode *inode, void *matching_fn,
|
||||
unsigned long lblk, unsigned long end,
|
||||
void *es)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* ext4_es_find_extent_range is now in extents_status.c */
|
||||
|
||||
void ext4_mb_mark_bb(struct super_block *sb, unsigned long long block,
|
||||
int len, int state)
|
||||
|
||||
Reference in New Issue
Block a user