Re: [PATCH v2 3/4] erofs-utils: add erofs_read_metadata() helper

2023-08-15 Thread Jingbo Xu
On 8/16/23 11:58 AM, Gao Xiang wrote: > > > On 2023/8/16 11:49, Jingbo Xu wrote: >> Add erofs_read_metadata() helper reading variable-sized metadata from >> inode specified by @nid.  Read from meta inode if @nid is 0. >> >> Signed-off-by: Jingbo Xu >> --- >>   include/erofs/internal.h |  2 +

Re: [PATCH v2 3/4] erofs-utils: add erofs_read_metadata() helper

2023-08-15 Thread Gao Xiang
On 2023/8/16 11:49, Jingbo Xu wrote: Add erofs_read_metadata() helper reading variable-sized metadata from inode specified by @nid. Read from meta inode if @nid is 0. Signed-off-by: Jingbo Xu --- include/erofs/internal.h | 2 + lib/data.c | 84 +

[PATCH v2 4/4] erofs-utils: support long xattr name prefixes for erofsfuse

2023-08-15 Thread Jingbo Xu
Make erofs_listxattr() and erofs_getxattr() routine support long xattr name prefixes. Although the on-disk format allows long xattr name prefixes to be placed in the meta inode or packed inode, currently mkfs.erofs will place them in packed inode by default. Thus let's also read long xattr name p

[PATCH v2 2/4] erofs-utils: lib: add match_base_prefix() helper

2023-08-15 Thread Jingbo Xu
Since the introduction of long xattr name prefix, match_prefix() will search among the long xattr name prefixes first and return the matched prefix, while erofs_getxattr() expects a base prefix even when the queried xattr name matches a long prefix. Thus introduce match_base_prefix() helper to do

[PATCH v2 3/4] erofs-utils: add erofs_read_metadata() helper

2023-08-15 Thread Jingbo Xu
Add erofs_read_metadata() helper reading variable-sized metadata from inode specified by @nid. Read from meta inode if @nid is 0. Signed-off-by: Jingbo Xu --- include/erofs/internal.h | 2 + lib/data.c | 84 2 files changed, 86 insertions(

[PATCH v2 0/4] erofs-utils: support long xattr name prefixes

2023-08-15 Thread Jingbo Xu
v2: - add patch 3 to introduce erofs_read_metadata() helper, so that the long xattr name prefixes could also be read from meta inode v1: https://lore.kernel.org/all/20230815091521.74661-1-jeffl...@linux.alibaba.com/ Jingbo Xu (4): erofs-utils: lib: fix potential out-of-bound in xattr_entryl

[PATCH v2 1/4] erofs-utils: lib: fix potential out-of-bound in xattr_entrylist()

2023-08-15 Thread Jingbo Xu
Check the index before accessing array to avoid the potential out-of-bound access. Fixes: c47df5aa2d16 ("erofs-utils: fuse: introduce xattr support") Reviewed-by: Gao Xiang Signed-off-by: Jingbo Xu --- lib/xattr.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/xa

[PATCH v2 12/12] erofs-utils: mkfs: introduce rebuild mode

2023-08-15 Thread Jingbo Xu
Introduce a new rebuild mode merging multiple erofs images generated from either tarerfs index mode (--tar=i): mkfs.erofs --tar=i --aufs layer0.erofs layer0.tar ... mkfs.erofs --tar=i --aufs layerN.erofs layerN.tar mkfs.erofs merge.erofs layerN.erofs ... layer0.ero

[PATCH v2 11/12] erofs-utils: lib: add erofs_rebuild_load_tree() helper

2023-08-15 Thread Jingbo Xu
Add erofs_rebuild_load_tree() helper loading inode tree from given erofs image, and making it merged into a given inode tree in an overlayfs like model. Since we need to read the content of the symlink file from disk when loading tree, add dependency on zlib_LIBS for mkfs.erofs. Signed-off-by: Ji

[PATCH v2 10/12] erofs-utils: lib: add erofs_rebuild_get_dentry() helper

2023-08-15 Thread Jingbo Xu
Rename tarerofs_get_dentry() to erofs_rebuild_get_dentry(). Also make `whout` and 'opq' parameter optional when `aufs` is false. Signed-off-by: Jingbo Xu --- include/erofs/rebuild.h | 19 +++ lib/Makefile.am | 3 +- lib/rebuild.c | 117 ++

[PATCH v2 09/12] erofs-utils: lib: add erofs_rebuild_dump_tree() helper

2023-08-15 Thread Jingbo Xu
Enhance tarerofs_dump_tree() so that it could optionally skip whiteout files when it's supposed to output image in merged view. Rename it to erofs_rebuild_dump_tree(). Signed-off-by: Jingbo Xu --- include/erofs/inode.h| 2 +- include/erofs/internal.h | 2 ++ lib/inode.c | 23

[PATCH v2 08/12] erofs-utils: lib: add erofs_insert_ihash() helper

2023-08-15 Thread Jingbo Xu
Add erofs_insert_ihash() helper inserting inode into inode hash table. Also add prototypes of erofs_iget() and erofs_iget_by_nid() in the header file. Signed-off-by: Jingbo Xu --- include/erofs/inode.h | 3 +++ lib/inode.c | 10 +++--- 2 files changed, 10 insertions(+), 3 deletio

[PATCH v2 07/12] erofs-utils: lib: add erofs_read_xattrs_from_disk() helper

2023-08-15 Thread Jingbo Xu
Add erofs_read_xattrs_from_disk() helper reading extended attributes from disk, add checking if it's an opaque directory. Move all xattr name related macros to xattr.c and introduce erofs_set_opaque_xattr() helper to hide all these details. Signed-off-by: Jingbo Xu --- include/erofs/internal.h

[PATCH v2 06/12] erofs-utils: lib: make erofs_get_unhashed_chunk() global

2023-08-15 Thread Jingbo Xu
... so that it could be called from outside blobchunk.c later. Signed-off-by: Jingbo Xu --- include/erofs/blobchunk.h | 2 ++ lib/blobchunk.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/erofs/blobchunk.h b/include/erofs/blobchunk.h index 010aee1..fb85d

[PATCH v2 05/12] erofs-utils: lib: keep self maintained devname

2023-08-15 Thread Jingbo Xu
Keep self allocated and maintained devname in erofs_sb_info. Reviewed-by: Gao Xiang Signed-off-by: Jingbo Xu --- include/erofs/internal.h | 2 +- lib/io.c | 14 -- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/erofs/internal.h b/include/ero

[PATCH v2 04/12] erofs-utils: lib: fix erofs_init_devices() in multidev mode

2023-08-15 Thread Jingbo Xu
Fix the missing le32_to_cpu(). Read and cache blocks of each device for later use. Initialize sbi->extra_devices from on-disk extra_devices. Fixes: 0ce853a01123 ("erofs-utils: fuse: add multiple device support") Reviewed-by: Gao Xiang Signed-off-by: Jingbo Xu --- lib/super.c | 11 ---

[PATCH v2 02/12] erofs-utils: lib: add list_splice_tail() helper

2023-08-15 Thread Jingbo Xu
Add list_splice_tail() helper. Reviewed-by: Gao Xiang Signed-off-by: Jingbo Xu --- include/erofs/list.h | 20 1 file changed, 20 insertions(+) diff --git a/include/erofs/list.h b/include/erofs/list.h index 3f5da1a..d7a9fee 100644 --- a/include/erofs/list.h +++ b/include/er

[PATCH v2 03/12] erofs-utils: lib: read i_ino in erofs_read_inode_from_disk()

2023-08-15 Thread Jingbo Xu
i_ino[0] is a unique inode serial number in the erofs filesystem where the inode resides, and also serves as the on-disk inode number, while i_ino[1] is a unique number identifying the source inode in the source directory, which is usually derived from st->st_ino. Read on-disk ino and store it in

[PATCH v2 00/12] erofs-utils: mkfs: introduce rebuild mode

2023-08-15 Thread Jingbo Xu
v2: - add Reviewed-by tag from Gao Xiang - patch 7: erofs_inode_tag_opaque() is merged into erofs_read_xattrs_from_disk(); simplify the implementation of erofs_read_xattrs_from_disk() in which erofs_setxattr() is used to set read xattrs directly; move all xattr name related macros to xattr.c;

[PATCH v2 01/12] erofs-utils: fix overriding of i_rdev for special device

2023-08-15 Thread Jingbo Xu
In index mode for tarerofs, tarerofs_write_chunk_indexes() is still called even for files with 0 i_size, and inode->u.chunkformat is initialized accordingly. This will make the previously set inode->u.i_rdev be overridden as u.chunkformat and u.i_rdev are reused in one union. To tidy up the code

Re: [PATCH 1/3] erofs-utils: lib: fix potential out-of-bound in xattr_entrylist()

2023-08-15 Thread Gao Xiang
On 2023/8/15 17:15, Jingbo Xu wrote: Check the index before accessing array to avoid the potential out-of-bound access. Fixes: c47df5aa2d16 ("erofs-utils: fuse: introduce xattr support") Signed-off-by: Jingbo Xu Reviewed-by: Gao Xiang Thanks, Gao Xiang

Re: [PATCH 3/3] erofs-utils: support long xattr name prefixes for erofsfuse

2023-08-15 Thread Gao Xiang
On 2023/8/15 17:15, Jingbo Xu wrote: Make erofs_listxattr() and erofs_getxattr() routine support long xattr name prefixes. Although the on-disk format allows long xattr name prefixes to be placed in the meta inode or packed inode, currently mkfs.erofs will place them in packed inode by defaul

Re: [PATCH 3/3] erofs: remove redundant erofs_fs_type declaration in super.c

2023-08-15 Thread Gao Xiang
On 2023/8/15 17:48, Ferry Meng wrote: As erofs_fs_type has been declared in internal.h, there is no use to declare repeatedly in super.c. Signed-off-by: Ferry Meng Reviewed-by: Gao Xiang Thanks, Gao Xiang

Re: [PATCH 1/3] erofs: clean up redundant comment and adjust code alignment

2023-08-15 Thread Gao Xiang
On 2023/8/15 17:48, Ferry Meng wrote: Remove some redundant comments in erofs/super.c, and avoid unncessary line breaks for cleanup. Signed-off-by: Ferry Meng Reviewed-by: Gao Xiang Thanks, Gao Xiang

Re: [PATCH 1/3] erofs: clean up redundant comment and adjust code alignment

2023-08-15 Thread Gao Xiang
On 2023/8/15 17:48, Ferry Meng wrote: Remove some redundant comments in erofs/super.c, and avoid unncessary line breaks for cleanup. Signed-off-by: Ferry Meng Thanks, Gao Xiang

Re: [PATCH 2/3] erofs: add necessary kmem_cache_create flags for erofs inode cache

2023-08-15 Thread Gao Xiang
On 2023/8/15 17:48, Ferry Meng wrote: To improve memory access efficiency and enable statistics functionality, add SLAB_MEM_SPREAD and SLAB_ACCOUNT flag during erofs_icachep's allocation time. Signed-off-by: Ferry Meng Reviewed-by: Gao Xiang Thanks, Gao Xiang

Re: [PATCH] AOSP: erofs-utils: add missing sbi argument to erofs_blknr in block list

2023-08-15 Thread Gao Xiang
On 2023/8/15 18:24, Yue Hu wrote: From: Yue Hu Commit fc30780ebf90 ("erofs-utils: lib: avoid global sbi dependencies (take 1)") updated the macro erofs_blknr by adding sbi argument. Fixes: fc30780ebf90 ("erofs-utils: lib: avoid global sbi dependencies (take 1)") Signed-off-by: Yue Hu Rev

[PATCH] AOSP: erofs-utils: add missing sbi argument to erofs_blknr in block list

2023-08-15 Thread Yue Hu
From: Yue Hu Commit fc30780ebf90 ("erofs-utils: lib: avoid global sbi dependencies (take 1)") updated the macro erofs_blknr by adding sbi argument. Fixes: fc30780ebf90 ("erofs-utils: lib: avoid global sbi dependencies (take 1)") Signed-off-by: Yue Hu --- lib/block_list.c | 2 +- 1 file changed

[PATCH 2/3] erofs: add necessary kmem_cache_create flags for erofs inode cache

2023-08-15 Thread Ferry Meng
To improve memory access efficiency and enable statistics functionality, add SLAB_MEM_SPREAD and SLAB_ACCOUNT flag during erofs_icachep's allocation time. Signed-off-by: Ferry Meng --- fs/erofs/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/erofs/super.c b/f

[PATCH 1/3] erofs: clean up redundant comment and adjust code alignment

2023-08-15 Thread Ferry Meng
Remove some redundant comments in erofs/super.c, and avoid unncessary line breaks for cleanup. Signed-off-by: Ferry Meng --- fs/erofs/super.c | 22 -- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 566f68ddfa36..ae5caf

[PATCH 3/3] erofs: remove redundant erofs_fs_type declaration in super.c

2023-08-15 Thread Ferry Meng
As erofs_fs_type has been declared in internal.h, there is no use to declare repeatedly in super.c. Signed-off-by: Ferry Meng --- fs/erofs/super.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 82f41d09f8d8..78a94955dd61 100644 --- a/fs/erofs/super.c

[PATCH 3/3] erofs-utils: support long xattr name prefixes for erofsfuse

2023-08-15 Thread Jingbo Xu
Make erofs_listxattr() and erofs_getxattr() routine support long xattr name prefixes. Although the on-disk format allows long xattr name prefixes to be placed in the meta inode or packed inode, currently mkfs.erofs will place them in packed inode by default. Thus let's also read long xattr name p

[PATCH 2/3] erofs-utils: lib: add match_base_prefix() helper

2023-08-15 Thread Jingbo Xu
Since the introduction of long xattr name prefix, match_prefix() will search among the long xattr name prefixes first and return the matched prefix, while erofs_getxattr() expects a base prefix even when the queried xattr name matches a long prefix. Thus introduce match_base_prefix() helper to do

[PATCH 1/3] erofs-utils: lib: fix potential out-of-bound in xattr_entrylist()

2023-08-15 Thread Jingbo Xu
Check the index before accessing array to avoid the potential out-of-bound access. Fixes: c47df5aa2d16 ("erofs-utils: fuse: introduce xattr support") Signed-off-by: Jingbo Xu --- lib/xattr.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/xattr.c b/lib/xattr.c inde

[PATCH 0/3] erofs-utils: support long xattr name prefixes for erofsfuse

2023-08-15 Thread Jingbo Xu
The first two are preparing for patch 3, which implements the support for long xattr name prefixes for erofsfuse. Patch 3 is basically synced from kernel commits: erofs: add helpers to load long xattr name prefixes erofs: handle long xattr name prefixes properly erofs: enab

Re: [PATCH v4 01/48] mm: move some shrinker-related function declarations to mm/internal.h

2023-08-15 Thread Qi Zheng via Linux-erofs
On 2023/8/15 16:36, Muchun Song wrote: On Aug 7, 2023, at 19:08, Qi Zheng wrote: The following functions are only used inside the mm subsystem, so it's better to move their declarations to the mm/internal.h file. 1. shrinker_debugfs_add() 2. shrinker_debugfs_detach() 3. shrinker_debugfs_

Re: [PATCH v4 12/48] gfs2: dynamically allocate the gfs2-qd shrinker

2023-08-15 Thread Muchun Song
> On Aug 7, 2023, at 19:09, Qi Zheng wrote: > > Use new APIs to dynamically allocate the gfs2-qd shrinker. > > Signed-off-by: Qi Zheng Reviewed-by: Muchun Song

Re: [PATCH v4 02/48] mm: vmscan: move shrinker-related code into a separate file

2023-08-15 Thread Muchun Song
> On Aug 7, 2023, at 19:08, Qi Zheng wrote: > > The mm/vmscan.c file is too large, so separate the shrinker-related > code from it into a separate file. No functional changes. > > Signed-off-by: Qi Zheng Reviewed-by: Muchun Song

Re: [PATCH v4 01/48] mm: move some shrinker-related function declarations to mm/internal.h

2023-08-15 Thread Muchun Song
> On Aug 7, 2023, at 19:08, Qi Zheng wrote: > > The following functions are only used inside the mm subsystem, so it's > better to move their declarations to the mm/internal.h file. > > 1. shrinker_debugfs_add() > 2. shrinker_debugfs_detach() > 3. shrinker_debugfs_remove() > > Signed-off-by: