erofs-utils: lib: migrate and split `c_legacy_compress`
PATCH 1/5 erofs-utils: lib: migrate and split `c_legacy_compress`
Split it into no_zcompact and no_lz4_0padding meta-switches.
Signed-off-by Gao Xiang <[email protected]>
--- include/erofs/config.h | 1 - include/erofs/importer.h | 2 ++ lib/compress.c | 5 +++-- mkfs/main.c | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-)
include/erofs/config.h +0 -1
@@ -39,7 +39,6 @@ struct erofs_configure {const char *c_version;int c_dbg_lvl;bool c_dry_run; -bool c_legacy_compress;char c_timeinherit;char c_chunkbits;bool c_showprogress;
include/erofs/importer.h +2 -0
@@ -41,6 +41,8 @@ struct erofs_importer_params {bool hard_dereference;bool ovlfs_strip;bool dot_omitted; +bool no_zcompact; +bool no_lz4_0padding;bool ztailpacking;bool dedupe;bool fragments;
lib/compress.c +3 -2
@@ -1144,6 +1144,7 @@ static void *z_erofs_write_extents(struct z_erofs_compress_ictx *ctx)static void *z_erofs_write_indexes (struct z_erofs_compress_ictx *ctx) { +const struct erofs_importer_params *params = ctx->im->params;struct erofs_inode *inode = ctx->inode;struct erofs_sb_info *sbi = inode->sbi;struct z_erofs_extent_item *ei, *n;
@@ -1165,7 +1166,7 @@ static void *z_erofs_write_indexes(struct z_erofs_compress_ictx *ctx)*/ if (inode->fragment_size && inode->fragmentoff >>32 ) { inode->datalayout =EROFS_INODE_COMPRESSED_FULL ; - }else if (!cfg.c_legacy_compress && !ctx->dedupe && + }else if (!params->no_zcompact && !ctx->dedupe && inode->z_lclusterbits <=14 ) {if (inode->z_lclusterbits <=12 ) inode->z_advise |=Z_EROFS_ADVISE_COMPACTED_2B ;
@@ -2120,7 +2121,7 @@ int z_erofs_compress_init(struct erofs_importer *im) }else { sbi->available_compr_algs = available_compr_algs; -if (!cfg.c_legacy_compress) +if (!params->no_lz4_0padding)erofs_sb_set_lz4_0padding (sbi);if (available_compr_algs & ~(1 <<Z_EROFS_COMPRESSION_LZ4 ))erofs_sb_set_compr_cfgs (sbi);
mkfs/main.c +2 -2
@@ -312,7 +312,8 @@ static int erofs_mkfs_feat_set_legacy_compress(struct erofs_importer_params *parif (vallen)return -EINVAL ;/* disable compacted indexes and 0padding */ - cfg.c_legacy_compress = en; + params->no_zcompact = true; + params->no_lz4_0padding = true;return 0 ; }
@@ -1501,7 +1502,6 @@ static int mkfs_parse_options_cfg(struct erofs_importer_params *params,static void erofs_mkfs_default_options (struct erofs_importer_params *params) { cfg.c_showprogress = true; - cfg.c_legacy_compress = false; cfg.c_xattr_name_filter = true;#ifdef EROFS_MT_ENABLED cfg.c_mt_workers =erofs_get_available_processors ();
Signature · 1 line
2.43.5
PATCH 2/5 erofs-utils: lib: introduce `struct erofs_xattrmgr`
Leave it as global g_xattrmgr for now in this patch.
Signed-off-by Gao Xiang <[email protected]>
--- include/erofs/xattr.h | 1 + lib/importer.c | 4 + lib/xattr.c | 170 +++++++++++++++++++++--------------------- 3 files changed, 91 insertions(+), 84 deletions(-)
include/erofs/xattr.h +1 -0
@@ -45,6 +45,7 @@ static inline unsigned int xattrblock_offset(struct erofs_inode *vi,struct erofs_importer ; +void erofs_xattr_init (struct erofs_sb_info *sbi);int erofs_scan_file_xattrs (struct erofs_inode *inode);int erofs_prepare_xattr_ibody (struct erofs_inode *inode,bool noroom);char *erofs_export_xattr_ibody (struct erofs_inode *inode);
lib/importer.c +4 -0
@@ -9,6 +9,7 @@#include "erofs/inode.h" #include "erofs/print.h" #include "erofs/lock.h" +#include "erofs/xattr.h" #include "liberofs_cache.h" #include "liberofs_compress.h" #include "liberofs_metabox.h"
@@ -46,6 +47,9 @@ int erofs_importer_init(struct erofs_importer *im)erofs_importer_global_init (); + subsys ="xattr" ; +erofs_xattr_init (sbi); + subsys ="compression" ; err =z_erofs_compress_init (im);if (err)
lib/xattr.c +86 -84
398 lines not on this page · raw message
Signature · 1 line
2.43.5
PATCH 3/5 erofs-utils: lib: switch to per-sb `struct erofs_xattrmgr`
In reply to Gao XiangIt allows the xattr generator to be used for multiple instances.
Signed-off-by Gao Xiang <[email protected]>
--- include/erofs/internal.h | 2 + include/erofs/xattr.h | 4 +- lib/importer.c | 4 +- lib/super.c | 2 +- lib/xattr.c | 123 ++++++++++++++++++++++++--------------- 5 files changed, 85 insertions(+), 50 deletions(-)
include/erofs/internal.h +2 -0
@@ -85,6 +85,7 @@ struct erofs_xattr_prefix_item {struct erofs_mkfs_dfops ;struct erofs_packed_inode ; +struct erofs_xattrmgr ;struct z_erofs_mgr ;struct erofs_metaboxmgr ;
@@ -147,6 +148,7 @@ struct erofs_sb_info {struct erofs_mkfs_dfops *mkfs_dfops;#endif struct erofs_bufmgr *bmgr; +struct erofs_xattrmgr *xamgr;struct z_erofs_mgr *zmgr;struct erofs_metaboxmgr *m2gr;struct erofs_packed_inode *packedinode;
include/erofs/xattr.h +2 -2
@@ -45,7 +45,7 @@ static inline unsigned int xattrblock_offset(struct erofs_inode *vi,struct erofs_importer ; -void erofs_xattr_init (struct erofs_sb_info *sbi); +int erofs_xattr_init (struct erofs_sb_info *sbi);int erofs_scan_file_xattrs (struct erofs_inode *inode);int erofs_prepare_xattr_ibody (struct erofs_inode *inode,bool noroom);char *erofs_export_xattr_ibody (struct erofs_inode *inode);
@@ -54,7 +54,6 @@ int erofs_build_shared_xattrs_from_path(struct erofs_sb_info *sbi, const char *pint erofs_xattr_insert_name_prefix (const char *prefix);void erofs_xattr_cleanup_name_prefixes (void );int erofs_xattr_flush_name_prefixes (struct erofs_importer *im,bool plain); -void erofs_xattr_prefixes_cleanup (struct erofs_sb_info *sbi);int erofs_xattr_prefixes_init (struct erofs_sb_info *sbi); int erofs_setxattr(struct erofs_inode *inode, char *key,
@@ -66,6 +65,7 @@ int erofs_read_xattrs_from_disk(struct erofs_inode *inode);bool erofs_xattr_prefix_matches (const char *key,unsigned int *index,unsigned int *len); +void erofs_xattr_exit (struct erofs_sb_info *sbi); #ifdef __cplusplus }
lib/importer.c +3 -1
@@ -48,7 +48,9 @@ int erofs_importer_init(struct erofs_importer *im)erofs_importer_global_init (); subsys ="xattr" ; -erofs_xattr_init (sbi); + err =erofs_xattr_init (sbi); +if (err) + goto out_err; subsys ="compression" ; err =z_erofs_compress_init (im);
lib/super.c +1 -1
@@ -171,12 +171,12 @@ void erofs_put_super(struct erofs_sb_info *sbi)free (sbi->devs); sbi->devs =NULL ; } -erofs_xattr_prefixes_cleanup (sbi);if (sbi->bmgr) {erofs_buffer_exit (sbi->bmgr); sbi->bmgr =NULL ; }z_erofs_compress_exit (sbi); +erofs_xattr_exit (sbi); sbi->sb_valid = false; }
lib/xattr.c +77 -46
333 lines not on this page · raw message
Signature · 1 line
2.43.5
PATCH 4/5 erofs-utils: lib: migrate `c_inline_xattr_tolerance`
In reply to Gao XiangSigned-off-by Gao Xiang <[email protected]>
--- include/erofs/config.h | 2 - include/erofs/importer.h | 1 + include/erofs/xattr.h | 4 +- lib/config.c | 1 - lib/inode.c | 2 +- lib/xattr.c | 82 +++++++++++++++------------------------- mkfs/main.c | 23 ++++++++--- 7 files changed, 51 insertions(+), 64 deletions(-)
include/erofs/config.h +0 -2
@@ -56,8 +56,6 @@ struct erofs_configure {struct erofs_compr_opts c_compr_opts[EROFS_MAX_COMPR_CFGS ];char c_force_chunkformat;u8 c_mkfs_metabox_algid; -/* < 0, xattr disabled and INT_MAX, always use inline xattrs */ -int c_inline_xattr_tolerance;u32 c_max_decompressed_extent_bytes;u64 c_unix_timestamp;const char *mount_point;
include/erofs/importer.h +1 -0
@@ -41,6 +41,7 @@ struct erofs_importer_params {bool hard_dereference;bool ovlfs_strip;bool dot_omitted; +bool no_xattrs;/* don't store extended attributes */ bool no_zcompact;bool no_lz4_0padding;bool ztailpacking;
include/erofs/xattr.h +2 -2
@@ -49,8 +49,8 @@ int erofs_xattr_init(struct erofs_sb_info *sbi);int erofs_scan_file_xattrs (struct erofs_inode *inode);int erofs_prepare_xattr_ibody (struct erofs_inode *inode,bool noroom);char *erofs_export_xattr_ibody (struct erofs_inode *inode); -int erofs_build_shared_xattrs_from_path (struct erofs_sb_info *sbi,const char *path); - +int erofs_load_shared_xattrs_from_path (struct erofs_sb_info *sbi,const char *path, +long inlinexattr_tolerance);int erofs_xattr_insert_name_prefix (const char *prefix);void erofs_xattr_cleanup_name_prefixes (void );int erofs_xattr_flush_name_prefixes (struct erofs_importer *im,bool plain);
lib/config.c +0 -1
@@ -29,7 +29,6 @@ void erofs_init_configure(void) cfg.c_dbg_lvl =EROFS_WARN ; cfg.c_version =PACKAGE_VERSION ; cfg.c_dry_run = false; - cfg.c_inline_xattr_tolerance =2 ; cfg.c_unix_timestamp =-1 ; cfg.c_max_decompressed_extent_bytes =-1 ; erofs_stdout_tty =isatty (STDOUT_FILENO );
lib/inode.c +1 -1
@@ -1848,7 +1848,7 @@ static int erofs_mkfs_handle_inode(struct erofs_importer *im,return ret; } -if (!rebuild) { +if (!rebuild && !params->no_xattrs) { ret =erofs_scan_file_xattrs (inode);if (ret <0 )return ret;
lib/xattr.c +30 -52
179 lines not on this page · raw message
mkfs/main.c +17 -6
@@ -264,6 +264,13 @@ static void version(void)print_available_compressors (stdout,", " ); } +static struct erofsmkfs_cfg { +/* < 0, xattr disabled and >= INT_MAX, always use inline xattrs */ +long inlinexattr_tolerance; +} mkfscfg = { + .inlinexattr_tolerance =2 , +}; +static unsigned int pclustersize_packed, pclustersize_max;static int pclustersize_metabox =-1 ;static struct erofs_tarfile erofstar = {
@@ -1011,10 +1018,11 @@ static int mkfs_parse_sources(int argc, char *argv[], int optind)static int mkfs_parse_options_cfg (struct erofs_importer_params *params,int argc,char *argv[]) { -char *endptr; -int opt, i, err; -bool quiet = false;bool has_timestamp = false; +bool quiet = false; +char *endptr; +int opt, err; +long i;while ((opt =getopt_long (argc, argv,"C:E:L:T:U:b:d:m:x:z:Vh" , long_options,NULL )) !=-1 ) {
@@ -1049,7 +1057,7 @@ static int mkfs_parse_options_cfg(struct erofs_importer_params *params,erofs_err ("invalid xattr tolerance %s" , optarg);return -EINVAL ; } - cfg.c_inline_xattr_tolerance = i; + mkfscfg.inlinexattr_tolerance = i;break ;case 'E' :
@@ -1782,6 +1790,8 @@ int main(int argc, char **argv) goto exit; } +if (mkfscfg.inlinexattr_tolerance <0 ) + importer_params.no_xattrs = true; importer_params.source = cfg.c_src_path; importer_params.no_datainline = mkfs_no_datainline; importer_params.dot_omitted = mkfs_dot_omitted;
@@ -1819,9 +1829,10 @@ int main(int argc, char **argv) }if (source_mode ==EROFS_MKFS_SOURCE_LOCALDIR ) { - err =erofs_build_shared_xattrs_from_path (&g_sbi, cfg.c_src_path); + err =erofs_load_shared_xattrs_from_path (&g_sbi, cfg.c_src_path, + mkfscfg.inlinexattr_tolerance);if (err) { -erofs_err ("failed to build shared xattrs: %s" , +erofs_err ("failed to load shared xattrs: %s" ,erofs_strerror (err)); goto exit; }
Signature · 1 line
2.43.5
PATCH 5/5 erofs-utils: lib: remove `erofs/hashtable.h`
In reply to Gao XiangThere is no in-tree user anymore.
Signed-off-by Gao Xiang <[email protected]>
--- include/erofs/hashtable.h | 392 -------------------------------------- lib/Makefile.am | 1 - 2 files changed, 393 deletions(-) delete mode 100644 include/erofs/hashtable.h
include/erofs/hashtable.h deleted +0 -392
@@ -1,392 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* Original code taken from 'linux/include/linux/hash{,table}.h' -*/ -#ifndef __EROFS_HASHTABLE_H -#define __EROFS_HASHTABLE_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* -* Fast hashing routine for ints, longs and pointers. -* (C) 2002 Nadia Yvette Chambers, IBM -*/ - -/* -* Statically sized hash table implementation -* (C) 2012 Sasha Levin <[email protected]> -*/ - -#include "defs.h" - -/* -* The "GOLDEN_RATIO_PRIME" is used in ifs/btrfs/brtfs_inode.h and -* fs/inode.c. It's not actually prime any more (the previous primes -* were actively bad for hashing), but the name remains. -*/ -#if BITS_PER_LONG ==32 -#define GOLDEN_RATIO_PRIME GOLDEN_RATIO_32 -#define hash_long (val, bits) hash_32(val, bits) -#elif BITS_PER_LONG ==64 -#define hash_long (val, bits) hash_64(val, bits) -#define GOLDEN_RATIO_PRIME GOLDEN_RATIO_64 -#else -#error Wordsize not 32 or 64 -#endif - -/* -* This hash multiplies the input by a large odd number and takes the -* high bits. Since multiplication propagates changes to the most -* significant end only, it is essential that the high bits of the -* product be used for the hash value. -* -* Chuck Lever verified the effectiveness of this technique: -* http://www.citi.umich.edu/techreports/reports/citi-tr-00-1.pdf -* -* Although a random odd number will do, it turns out that the golden -* ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice -* properties. (See Knuth vol 3, section 6.4, exercise 9.) -* -* These are the negative, (1 - phi) = phi**2 = (3 - sqrt(5))/2, -* which is very slightly easier to multiply by and makes no -* difference to the hash distribution. -*/ -#define GOLDEN_RATIO_32 0x61C88647 -#define GOLDEN_RATIO_64 0x61C8864680B583EBull - -struct hlist_head { -struct hlist_node *first; -}; - -struct hlist_node { -struct hlist_node *next, **pprev; -}; - -/* -* Architectures might want to move the poison pointer offset -* into some well-recognized area such as 0xdead000000000000, -* that is also not mappable by user-space exploits: -*/ -#ifdef CONFIG_ILLEGAL_POINTER_VALUE -# define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL) -#else -# define POISON_POINTER_DELTA 0 -#endif - -/* -* These are non-NULL pointers that will result in page faults -* under normal circumstances, used to verify that nobody uses -* non-initialized list entries. -*/ -#define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA) -#define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA) - -/* -* Double linked lists with a single pointer list head. -* Mostly useful for hash tables where the two pointer list head is -* too wasteful. -* You lose the ability to access the tail in O(1). -*/ - -#define HLIST_HEAD_INIT { .first = NULL } -#define HLIST_HEAD (name) struct hlist_head name = { .first = NULL } -#define INIT_HLIST_HEAD (ptr) ((ptr)->first = NULL) -static inline void INIT_HLIST_NODE (struct hlist_node *h) -{ - h->next =NULL ; - h->pprev =NULL ; -} - -static inline int hlist_unhashed (const struct hlist_node *h) -{ -return !h->pprev; -} - -static inline int hlist_empty (const struct hlist_head *h) -{ -return !h->first; -} - -static inline void __hlist_del (struct hlist_node *n) -{ -struct hlist_node *next = n->next; -struct hlist_node **pprev = n->pprev; - - *pprev = next; -if (next) - next->pprev = pprev; -} - -static inline void hlist_del (struct hlist_node *n) -{ -__hlist_del (n); - n->next =LIST_POISON1 ; - n->pprev =LIST_POISON2 ; -} - -static inline void hlist_del_init (struct hlist_node *n) -{ -if (!hlist_unhashed (n)) { -__hlist_del (n); -INIT_HLIST_NODE (n); - } -} - -static inline void hlist_add_head (struct hlist_node *n,struct hlist_head *h) -{ -struct hlist_node *first = h->first; - - n->next = first; -if (first) - first->pprev = &n->next; - h->first = n; - n->pprev = &h->first; -} - -/* next must be != NULL */ -static inline void hlist_add_before (struct hlist_node *n, -struct hlist_node *next) -{ - n->pprev = next->pprev; - n->next = next; - next->pprev = &n->next; - *(n->pprev) = n; -} - -static inline void hlist_add_behind (struct hlist_node *n, -struct hlist_node *prev) -{ - n->next = prev->next; - prev->next = n; - n->pprev = &prev->next; - -if (n->next) - n->next->pprev = &n->next; -} - -/* after that we'll appear to be on some hlist and hlist_del will work */ -static inline void hlist_add_fake (struct hlist_node *n) -{ - n->pprev = &n->next; -} - -/* -* Move a list from one list head to another. Fixup the pprev -* reference of the first entry if it exists. -*/ -static inline void hlist_move_list (struct hlist_head *old, -struct hlist_head *new) -{ - new->first = old->first; -if (new->first) - new->first->pprev = &new->first; - old->first =NULL ; -} - -#define hlist_entry (ptr, type, member) container_of(ptr, type, member) - -#define hlist_for_each (pos, head) \ - for (pos = (head)->first; pos; pos = pos->next) - -#define hlist_for_each_safe (pos, n, head) \ - for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ - pos = n) - -#define hlist_entry_safe (ptr, type, member) \ - ({ typeof(ptr) ____ptr = (ptr); \ - ____ptr ? hlist_entry(____ptr, type, member) : NULL; \ - }) - -/** -* hlist_for_each_entry - iterate over list of given type -* @pos:the type * to use as a loop cursor. -* @head:the head for your list. -* @member:the name of the hlist_node within the struct. -*/ -#define hlist_for_each_entry (pos, head, member) \ - for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\ - pos; \ - pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) - -/** -* hlist_for_each_entry_continue -* iterate over a hlist continuing after current point -* @pos:the type * to use as a loop cursor. -* @member:the name of the hlist_node within the struct. -*/ -#define hlist_for_each_entry_continue (pos, member) \ - for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\ - pos; \ - pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) - -/** -* hlist_for_each_entry_from -* iterate over a hlist continuing from current point -* @pos: the type * to use as a loop cursor. -* @member: the name of the hlist_node within the struct. -*/ -#define hlist_for_each_entry_from (pos, member) \ - for (; pos; \ - pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) - -/** -* hlist_for_each_entry_safe -* iterate over list of given type safe against removal of list entry -* @pos:the type * to use as a loop cursor. -* @n:another &struct hlist_node to use as temporary storage -* @head:the head for your list. -* @member:the name of the hlist_node within the struct. -*/ -#define hlist_for_each_entry_safe (pos, n, head, member) \ - for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\ - pos && ({ n = pos->member.next; 1; }); \ - pos = hlist_entry_safe(n, typeof(*pos), member)) - -static inline u32 __hash_32 (u32 val) -{ -return val *GOLDEN_RATIO_32 ; -} - -static inline u32 hash_32 (u32 val,unsigned int bits) -{ -/* High bits are more random, so use them. */ -return __hash_32 (val) >> (32 - bits); -} - -static inline u32 hash_64 (u64 val,unsigned int bits) -{ -#if BITS_PER_LONG ==64 -/* 64x64-bit multiply is efficient on all 64-bit processors */ -return val *GOLDEN_RATIO_64 >> (64 - bits); -#else -/* Hash 64 bits using only 32x32-bit multiply. */ -return hash_32 ((u32 )val ^__hash_32 (val >>32 ), bits); -#endif -} - -#define DEFINE_HASHTABLE (name, bits) \ - struct hlist_head name[1 << (bits)] = \ - { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT } - -#define DECLARE_HASHTABLE (name, bits) \ - struct hlist_head name[1 << (bits)] - -#define HASH_SIZE (name) (ARRAY_SIZE(name)) -#define HASH_BITS (name) ilog2(HASH_SIZE(name)) - -/* Use hash_32 when possible to allow for fast 32bit hashing in 64bit kernels*/ -#define hash_min (val, bits) \ - (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits)) - -static inline void __hash_init (struct hlist_head *ht,unsigned int sz) -{ -unsigned int i; - -for (i =0 ; i < sz; i++) -INIT_HLIST_HEAD (&ht[i]); -} - -/** -* hash_init - initialize a hash table -* @hashtable: hashtable to be initialized -* -* Calculates the size of the hashtable from the given parameter, otherwise -* same as hash_init_size. -* -* This has to be a macro since HASH_BITS() will not work on pointers since -* it calculates the size during preprocessing. -*/ -#define hash_init (hashtable) __hash_init(hashtable, HASH_SIZE(hashtable)) - -/** -* hash_add - add an object to a hashtable -* @hashtable: hashtable to add to -* @node: the &struct hlist_node of the object to be added -* @key: the key of the object to be added -*/ -#define hash_add (hashtable, node, key) \ - hlist_add_head(node, &hashtable[hash_min(key, HASH_BITS(hashtable))]) - -/** -* hash_hashed - check whether an object is in any hashtable -* @node: the &struct hlist_node of the object to be checked -*/ -static inline bool hash_hashed (struct hlist_node *node) -{ -return !hlist_unhashed (node); -} - -static inline bool __hash_empty (struct hlist_head *ht,unsigned int sz) -{ -unsigned int i; - -for (i =0 ; i < sz; i++) -if (!hlist_empty (&ht[i])) -return false; - -return true; -} - -/** -* hash_empty - check whether a hashtable is empty -* @hashtable: hashtable to check -* -* This has to be a macro since HASH_BITS() will not work on pointers since -* it calculates the size during preprocessing. -*/ -#define hash_empty (hashtable) __hash_empty(hashtable, HASH_SIZE(hashtable)) - -/** -* hash_del - remove an object from a hashtable -* @node: &struct hlist_node of the object to remove -*/ -static inline void hash_del (struct hlist_node *node) -{ -hlist_del_init (node); -} - -/** -* hash_for_each - iterate over a hashtable -* @name: hashtable to iterate -* @bkt: integer to use as bucket loop cursor -* @obj: the type * to use as a loop cursor for each entry -* @member: the name of the hlist_node within the struct -*/ -#define hash_for_each (name, bkt, obj, member) \ - for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\ - (bkt)++)\ - hlist_for_each_entry(obj, &name[bkt], member) - -/** -* hash_for_each_safe - iterate over a hashtable safe against removal of -* hash entry -* @name: hashtable to iterate -* @bkt: integer to use as bucket loop cursor -* @tmp: a &struct used for temporary storage -* @obj: the type * to use as a loop cursor for each entry -* @member: the name of the hlist_node within the struct -*/ -#define hash_for_each_safe (name, bkt, tmp, obj, member) \ - for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\ - (bkt)++)\ - hlist_for_each_entry_safe(obj, tmp, &name[bkt], member) - -/** -* hash_for_each_possible - iterate over all possible objects hashing to the -* same bucket -* @name: hashtable to iterate -* @obj: the type * to use as a loop cursor for each entry -* @member: the name of the hlist_node within the struct -* @key: the key of the objects to iterate over -*/ -#define hash_for_each_possible (name, obj, member, key) \ - hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member) - -#ifdef __cplusplus -} -#endif - -#endif
lib/Makefile.am +0 -1
@@ -12,7 +12,6 @@ noinst_HEADERS = $(top_srcdir)/include/erofs_fs.h \ $(top_srcdir)/include/erofs/exclude.h \ $(top_srcdir)/include/erofs/flex-array.h \ $(top_srcdir)/include/erofs/hashmap.h \ - $(top_srcdir)/include/erofs/hashtable.h \ $(top_srcdir)/include/erofs/inode.h \ $(top_srcdir)/include/erofs/internal.h \ $(top_srcdir)/include/erofs/io.h \
Signature · 1 line
2.43.5