Re: [PATCH] erofs: use wrapper i_blocksize() in erofs_file_read_iter()

2023-03-06 Thread Gao Xiang
On 2023/3/6 15:55, Yue Hu wrote: From: Yue Hu linux/fs.h has a wrapper for this operation. Signed-off-by: Yue Hu Reviewed-by: Gao Xiang Thanks, Gao Xiang --- fs/erofs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c

Re: [PATCH 1/2] erofs-utils: get rid of z_erofs_do_map_blocks() forward declaration

2023-03-06 Thread Gao Xiang
On 2023/3/6 17:25, Yue Hu wrote: On Mon, 6 Mar 2023 17:00:25 +0800 Gao Xiang wrote: On 2023/3/6 16:54, Yue Hu wrote: From: Yue Hu Keep in sync with the kernel commit 999f2f9a63f4 ("erofs: get rid of z_erofs_do_map_blocks() forward declaration"). Does z_erofs_do_map_blocks

Re: [PATCH 1/2] erofs-utils: get rid of z_erofs_do_map_blocks() forward declaration

2023-03-06 Thread Gao Xiang
On 2023/3/6 16:54, Yue Hu wrote: From: Yue Hu Keep in sync with the kernel commit 999f2f9a63f4 ("erofs: get rid of z_erofs_do_map_blocks() forward declaration"). Does z_erofs_do_map_blocks() already keep in sync with the kernel implementation? Anyway, it's just another question

[PATCH] erofs: fix wrong kunmap when using LZMA on HIGHMEM platforms

2023-03-05 Thread Gao Xiang
/0x28 ---[ end trace ]--- The bug is trivial and should be fixed now. It has no impact on !HIGHMEM platforms. Fixes: 622ceaddb764 ("erofs: lzma compression support") Cc: # 5.16+ Signed-off-by: Gao Xiang --- fs/erofs/decompressor_lzma.c | 2 +- 1 file changed, 1 inser

[PATCH 5/5] erofs-utils: dedupe more in the packed inode if possible

2023-03-04 Thread Gao Xiang
In addition to just compare the in-memory data. Signed-off-by: Gao Xiang --- lib/compress.c | 3 ++- lib/fragments.c | 25 - 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/compress.c b/lib/compress.c index f38c795..afa3bf7 100644 --- a/lib

[PATCH 3/5] erofs-utils: avoid using a static srcpath

2023-03-04 Thread Gao Xiang
To avoid unnecessary memory overhead. Signed-off-by: Gao Xiang --- include/erofs/internal.h | 2 +- lib/inode.c | 10 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/erofs/internal.h b/include/erofs/internal.h index 08a3877..d4ae3b8 100644

[PATCH 2/5] erofs-utils: switch sha256 algorithm directly from LibTomCrypt

2023-03-04 Thread Gao Xiang
LibTomCrypt was released into public domain so that we don't need to worry about license issues against Apache-2.0 later. Signed-off-by: Gao Xiang --- lib/blobchunk.c | 4 +- lib/dedupe.c| 4 +- lib/sha256.c| 306 lib/sha256.h

[PATCH 4/5] erofs-utils: handle mmap failure when packing a whole file

2023-03-04 Thread Gao Xiang
Directly read/write if mmap failure. Signed-off-by: Gao Xiang --- lib/fragments.c | 43 +++ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/lib/fragments.c b/lib/fragments.c index ebff4b5..30e9ba6 100644 --- a/lib/fragments.c +++ b/lib

[PATCH 1/5] erofs-utils: fix delta[1] out-of-bound of compact indexes

2023-03-04 Thread Gao Xiang
delta[1] should not exceed (1 << lclusterbits) - 1, usually 4095 blocks, which means a single compressed extent which isn't less than 16MiB could trigger this issue (it very rare happens). Fixes: 76b822726ff8 ("erofs-utils: introduce compacted compression indexes") Signed-o

[PATCH 1/5] erofs-utils: fix delta[1] out-of-bound of compact indexes

2023-03-04 Thread Gao Xiang
delta[1] should not exceed (1 << lclusterbits) - 1, usually 4095 blocks, which means a single compressed extent which isn't less than 16MiB could trigger this issue (it very rare happens). Fixes: 76b822726ff8 ("erofs-utils: introduce compacted compression indexes") Signed-o

Re: [PATCH] erofs: avoid useless memory allocation

2023-03-03 Thread Gao Xiang
On 2023/3/3 17:45, Yue Hu wrote: On Fri, 3 Mar 2023 16:52:18 +0900 Noboru Asai wrote: The variable 'vi->xattr_shared_count' could be ZERO. Signed-off-by: Noboru Asai --- fs/erofs/xattr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c index

Re: [PATCH] erofs: avoid useless memory allocation

2023-03-02 Thread Gao Xiang
On 2023/3/3 15:52, Noboru Asai wrote: The variable 'vi->xattr_shared_count' could be ZERO. Signed-off-by: Noboru Asai Reviewed-by: Gao Xiang Thanks, Gao Xiang --- fs/erofs/xattr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c in

Re: [PATCH v2] erofs: mark z_erofs_lzma_init/erofs_pcpubuf_init w/ __init

2023-03-02 Thread Gao Xiang
On 2023/3/3 14:37, Yangtao Li wrote: They are used during the erofs module init phase. Let's mark it as __init like any other function. Signed-off-by: Yangtao Li Reviewed-by: Gao Xiang Thanks, Gao Xiang --- v2: -change in internal.h fs/erofs/decompressor_lzma.c | 2 +- fs/erofs

Re: [PATCH] erofs: fix validation in z_erofs_do_map_blocks()

2023-03-02 Thread Gao Xiang
eased yet, so it won't impact anything at all. Thanks, Gao Xiang --- fs/erofs/zmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index 8bf6d30518b6..902b166a5a5e 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -572,7 +572,7

Re: [PATCH] erofs: mark z_erofs_lzma_init/erofs_pcpubuf_init w/ __init

2023-03-02 Thread Gao Xiang
int nrpages) return ret; } -void erofs_pcpubuf_init(void) +void __init erofs_pcpubuf_init(void) { int cpu; Update them in internal.h as well? Yeah, please help revise, thanks! Thanks, Gao Xiang

Re: [PATCH] erofs: mark z_erofs_lzma_init/erofs_pcpubuf_init w/ __init

2023-03-02 Thread Gao Xiang
On 2023/3/3 11:14, Yangtao Li wrote: They are used during the erofs module init phase. Let's mark it as __init like any other function. Signed-off-by: Yangtao Li Reviewed-by: Gao Xiang Thanks, Gao Xiang --- fs/erofs/decompressor_lzma.c | 2 +- fs/erofs/pcpubuf.c | 2

Re: [PATCH] erofs: don't warn ztailpacking feature anymore

2023-03-02 Thread Gao Xiang
On 2023/2/27 16:44, Yue Hu wrote: From: Yue Hu The ztailpacking feature has been merged for a year, it has been mostly stable now. Signed-off-by: Yue Hu Reviewed-by: Gao Xiang Thanks, Gao Xiang --- fs/erofs/super.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/erofs

Re: [PATCH v4 2/2] erofs: set block size to the on-disk block size

2023-03-02 Thread Gao Xiang
supported block size smaller than PAGE_SIZE now, disable all these images with such separated directory block size until we supported this feature later. Signed-off-by: Jingbo Xu Reviewed-by: Gao Xiang Thanks, Gao Xiang

Re: [PATCH v3 1/2] erofs: avoid hardcoded blocksize for subpage block support

2023-03-02 Thread Gao Xiang
>s_blocksize; const size_t dirsize = i_size_read(dir); - unsigned int i = ctx->pos / EROFS_BLKSIZ; - unsigned int ofs = ctx->pos % EROFS_BLKSIZ; + unsigned int i = erofs_blknr(sb, ctx->pos); + unsigned int ofs = erofs_blkoff(sb, ctx->pos); in

Re: [PATCH v3 2/2] erofs: set block size to the on-disk block size

2023-03-02 Thread Gao Xiang
blkszbits); + goto out; + } Also, if (blkszbits != PAGE_SHIFT && dsb->dirblkbits) { erofs_err("dirblkbits %u isn't supported", dsb->dirblkbits); goto out; } Thanks, Gao Xiang

Re: [PATCH] erofs: support for mounting a single block device with multiple devices

2023-02-28 Thread Gao Xiang
(sb)->devs; struct erofs_device_info *dif; + bool flatdev = !!sb->s_bdev; I'd like to land it in sbi and set it in advance? Also, did you test this patch? Thanks, Gao Xiang int id; - /* primary device by default */ map->m_bdev = sb->s_bdev;

[PATCH 1/3] erofs-utils: get rid of useless nr_dup

2023-02-28 Thread Gao Xiang
Also refine the longest detection. Fixes: 990c7e383795 ("erofs-utils: mkfs: support fragment deduplication") Signed-off-by: Gao Xiang --- lib/fragments.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/fragments.c b/lib/fragments.c ind

[PATCH 3/3] erofs-utils: add `-Eall-fragments` option

2023-02-28 Thread Gao Xiang
It's almost the same as `-Efragments` option, except that will explicitly pack the whole data into the special inode instead. Signed-off-by: Gao Xiang --- configure.ac | 1 + include/erofs/config.h| 1 + include/erofs/fragments.h | 1 + lib/compress.c| 32

Re: [PATCH v5] erofs: add per-cpu threads for decompression as an option

2023-02-27 Thread Gao Xiang
On 2023/2/28 13:51, Sandeep Dhavale wrote: On Mon, Feb 27, 2023 at 9:01 PM Gao Xiang wrote: Hi Sandeep, On 2023/2/28 12:47, Sandeep Dhavale via Linux-erofs wrote: Hi all, I completed the tests and the results are consistent with our previous observation. We can see that removing

Re: [PATCH v5] erofs: add per-cpu threads for decompression as an option

2023-02-27 Thread Gao Xiang
| | +-+---++-+ Otherwise it looks good to me for now, hopefully helpful to Android users. Thanks, Gao Xiang Thanks, Sandeep.

Re: [PATCH] erofs: don't warn ztailpacking feature anymore

2023-02-27 Thread Gao Xiang
On 2023/2/27 16:44, Yue Hu wrote: From: Yue Hu The ztailpacking feature has been merged for a year, it has been mostly stable now. Signed-off-by: Yue Hu Let's update erofs-utils as well? --- fs/erofs/super.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/erofs/super.c

Re: [PATCH v5] erofs: add per-cpu threads for decompression as an option

2023-02-23 Thread Gao Xiang
On 2023/2/24 02:52, Gao Xiang wrote: Hi Eric, On 2023/2/24 02:29, Eric Biggers wrote: Hi, On Wed, Feb 08, 2023 at 05:33:22PM +0800, Gao Xiang wrote: From: Sandeep Dhavale Using per-cpu thread pool we can reduce the scheduling latency compared to workqueue implementation. With this patch

Re: [PATCH v5] erofs: add per-cpu threads for decompression as an option

2023-02-23 Thread Gao Xiang
Hi Eric, On 2023/2/24 02:29, Eric Biggers wrote: Hi, On Wed, Feb 08, 2023 at 05:33:22PM +0800, Gao Xiang wrote: From: Sandeep Dhavale Using per-cpu thread pool we can reduce the scheduling latency compared to workqueue implementation. With this patch scheduling latency and variation

[PATCH v2 3/3] erofs-utils: support randomizing algorithms in debugging mode

2023-02-22 Thread Gao Xiang
It's used for multiple algorithms selftest. Signed-off-by: Gao Xiang --- include/erofs/config.h | 1 + lib/compress.c | 12 mkfs/main.c| 5 + 3 files changed, 18 insertions(+) diff --git a/include/erofs/config.h b/include/erofs/config.h index aee2815

[PATCH v2 1/3] erofs-utils: ignore comments and blank lines in compress hints

2023-02-22 Thread Gao Xiang
Identify lines starting with '#' as a comment. Signed-off-by: Gao Xiang --- lib/compress_hints.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/compress_hints.c b/lib/compress_hints.c index 92964eb..3e5c8c8 100644 --- a/lib/compress_hints.c +++ b/lib/compress_hints.c @@ -101,6

[PATCH v2 2/3] erofs-utils: support multiple algorithms in a single image

2023-02-22 Thread Gao Xiang
compression with 4k plusters and other files will use "lzma" compression with 16k pclusters. Note that the largest pcluster size should be specified with the "-C" option, otherwise all larger pclusters will be limited. Signed-off-by: Gao Xiang --- changes since v1: - mo

[PATCH] erofs-utils: get rid of PAGE_SIZE leftovers

2023-02-22 Thread Gao Xiang
commit c47df5aa2d16 ("erofs-utils: fuse: introduce xattr support") introduced two new references. Signed-off-by: Gao Xiang --- lib/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/xattr.c b/lib/xattr.c index 0ca89a4..024ecbe 100644 --- a/lib/xattr.c

[PATCH] erofs-utils: support randomizing algorithms in debugging mode

2023-02-22 Thread Gao Xiang
It's used for multiple algorithms selftest. Signed-off-by: Gao Xiang --- include/erofs/config.h | 1 + lib/compress.c | 11 +++ mkfs/main.c| 5 + 3 files changed, 17 insertions(+) diff --git a/include/erofs/config.h b/include/erofs/config.h index 17db98c

[PATCH 2/2] erofs-utils: support multiple algorithms in an image

2023-02-22 Thread Gao Xiang
compression with 4k plusters and other files will use "lzma" compression with 16k pclusters. Note that the largest pcluster size should be specified with "-C" option, otherwise all larger pclusters will be limited. Signed-off-by: Gao Xiang --- include/erofs/compress_hints.h | 1

[PATCH 1/2] erofs-utils: ignore comments and blank lines in compress hints

2023-02-22 Thread Gao Xiang
Identify lines starting with '#' as a comment. Signed-off-by: Gao Xiang --- lib/compress_hints.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/compress_hints.c b/lib/compress_hints.c index 92964eb..3e5c8c8 100644 --- a/lib/compress_hints.c +++ b/lib/compress_hints.c @@ -101,6

[GIT PULL] erofs updates for 6.3-rc1

2023-02-19 Thread Gao Xiang
have been in -next for a while. Thanks, Gao Xiang The following changes since commit 2241ab53cbb5cdb08a6b2d4688feb13971058f65: Linux 6.2-rc5 (2023-01-21 16:27:01 -0800) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git tags/erofs-for-6.3-rc1

Re: [PATCH] erofs: fix an error code in z_erofs_init_zip_subsystem()

2023-02-16 Thread Gao Xiang
On 2023/2/16 20:13, Dan Carpenter wrote: Return -ENOMEM if alloc_workqueue() fails. Don't return success. Fixes: d8a650adf429 ("erofs: add per-cpu threads for decompression as an option") Signed-off-by: Dan Carpenter Reviewed-by: Gao Xiang Thanks, Gao Xiang --- fs/ero

Re: [PATCH 1/2] erofs: convert hardcoded blocksize to sb->s_blocksize

2023-02-16 Thread Gao Xiang
*m, * if the 1st NONHEAD lcluster is actually PLAIN or HEAD type * rather than CBLKCNT, it's a 1 lcluster-sized pcluster. */ - m->compressedblks = 1 << (lclusterbits - LOG_BLOCK_SIZE); + m->compressedblks = 1 << (lclusterbits - sb->s_blocksize_bits); break; case Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD: if (m->delta[0] != 1) @@ -422,7 +423,7 @@ static int z_erofs_get_extent_compressedlen(struct z_erofs_maprecorder *m, return -EFSCORRUPTED; } out: - map->m_plen = (u64)m->compressedblks << LOG_BLOCK_SIZE; + map->m_plen = (u64)m->compressedblks << sb->s_blocksize_bits; return 0; err_bonus_cblkcnt: erofs_err(m->inode->i_sb, @@ -565,7 +566,7 @@ static int z_erofs_do_map_blocks(struct inode *inode, } else if (fragment && m.lcn == vi->z_tailextent_headlcn) { map->m_flags |= EROFS_MAP_FRAGMENT; } else { - map->m_pa = blknr_to_addr(m.pblk); + map->m_pa = erofs_pos(inode->i_sb, m.pblk); err = z_erofs_get_extent_compressedlen(, initial_lcn); if (err) goto unmap_out; @@ -592,7 +593,7 @@ static int z_erofs_do_map_blocks(struct inode *inode, if ((flags & EROFS_GET_BLOCKS_FIEMAP) || ((flags & EROFS_GET_BLOCKS_READMORE) && map->m_algorithmformat == Z_EROFS_COMPRESSION_LZMA && -map->m_llen >= EROFS_BLKSIZ)) { +map->m_llen >= inode->i_sb->s_blocksize)) { map->m_llen >= i_blocksize(inode) Otherwise it looks good to me. Thanks, Gao Xiang

Re: [PATCH v2 2/4] erofs: maintain cookies of share domain in self-contained list

2023-02-08 Thread Gao Xiang
On 2023/2/9 13:18, Jingbo Xu wrote: We'd better not touch sb->s_inodes list and inode->i_count directly. Let's maintain cookies of share domain in a self-contained list in erofs. Besides, relinquish cookie with the mutex held. Otherwise if a cookie is registered when the old cookie with the

Re: [PATCH v2 3/4] erofs: relinquish volume with mutex held

2023-02-08 Thread Gao Xiang
Zhu Do we need to backport this to old kernels? IOWs, whether "Fixes:" tag is needed? Thanks, Gao Xiang --- fs/erofs/fscache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index 2f5930e177cc..a6f030966147 100644 ---

Re: [PATCH] MAINTAINERS: erofs: Add Documentation/ABI/testing/sysfs-fs-erofs

2023-02-08 Thread Gao Xiang
On 2023/2/9 13:20, Yangtao Li wrote: Add this doc to the erofs maintainers entry. Signed-off-by: Yangtao Li Reviewed-by: Gao Xiang Thanks, Gao Xiang --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index d0485b58b9d9..7d50e5df4508 100644

Re: [PATCH] Documentation/ABI: sysfs-fs-erofs: update supported features

2023-02-08 Thread Gao Xiang
On 2023/2/9 13:11, Yue Hu wrote: From: Yue Hu Add missing feaures for sysfs-fs-erofs feature doc. Signed-off-by: Yue Hu Reviewed-by: Gao Xiang Thanks, Gao Xiang --- Documentation/ABI/testing/sysfs-fs-erofs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH] erofs-utils: mkfs: don't skip `lost+found`

2023-02-08 Thread Gao Xiang
It's somewhat strange to skip the `lost+found` directory. Fixes: a17497f0844a ("erofs-utils: introduce inode operations") Signed-off-by: Gao Xiang --- lib/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/inode.c b/lib/inode.c index 87613c6..6fd2

Re: [PATCH] erofs: make kobj_type structures constant

2023-02-08 Thread Gao Xiang
by: Thomas Weißschuh Acked-by: Gao Xiang Thanks, Gao Xiang --- fs/erofs/sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c index fd476961f742..435e515c0792 100644 --- a/fs/erofs/sysfs.c +++ b/fs/erofs/sysfs.c @@ -179,

Re: [PATCH v3 2/2] erofs: remove unused EROFS_GET_BLOCKS_RAW flag

2023-02-08 Thread Gao Xiang
) data for compressed files. However it's never used actually and let's remove it now. Signed-off-by: Jingbo Xu Reviewed-by: Gao Xiang Thanks, Gao Xiang --- fs/erofs/data.c | 14 ++ fs/erofs/fscache.c | 2 +- fs/erofs/internal.h | 10

Re: [PATCH v3 1/2] erofs: update print symbols for various flags in trace

2023-02-08 Thread Gao Xiang
On 2023/2/9 10:48, Jingbo Xu wrote: As new flags introduced, the corresponding print symbols for trace are not added accordingly. Add these missing print symbols for these flags. Signed-off-by: Jingbo Xu Reviewed-by: Gao Xiang Thanks, Gao Xiang --- v3: print symbols

Re: [PATCH v2 1/2] erofs: update print symbols for various flags in trace

2023-02-08 Thread Gao Xiang
next patch? Otherwise it looks good to me. Thanks, Gao XIang + { EROFS_GET_BLOCKS_FIEMAP, "FIEMAP" }, \ + { EROFS_GET_BLOCKS_READMORE,"READMORE" }, \ + { EROFS_GET_BLOCKS_FINDTAIL,"FINDTAIL" }) #define show_mflags(flags) __

[PATCH v5] erofs: add per-cpu threads for decompression as an option

2023-02-08 Thread Gao Xiang
at LPC 2022. Link to LPC 2022 slides and talk at [1] [1] https://lpc.events/event/16/contributions/1338/ Signed-off-by: Sandeep Dhavale [ Gao Xiang: At least, we have to add this until WQ_UNBOUND workqueue issue [2] on many arm64 devices is resolved. ] [2] https://lore.kernel.org/r

Re: [PATCH v4] erofs: replace erofs_unzipd workqueue with per-cpu threads

2023-02-08 Thread Gao Xiang
On 2023/2/8 14:58, Sandeep Dhavale wrote: On Mon, Feb 6, 2023 at 6:55 PM Gao Xiang wrote: On 2023/2/7 03:41, Sandeep Dhavale wrote: On Mon, Feb 6, 2023 at 2:01 AM Gao Xiang wrote: Hi Sandeep, On Fri, Jan 06, 2023 at 07:35:01AM +, Sandeep Dhavale wrote: Using per-cpu thread pool

Re: [PATCH v4] erofs: replace erofs_unzipd workqueue with per-cpu threads

2023-02-06 Thread Gao Xiang
On 2023/2/7 03:41, Sandeep Dhavale wrote: On Mon, Feb 6, 2023 at 2:01 AM Gao Xiang wrote: Hi Sandeep, On Fri, Jan 06, 2023 at 07:35:01AM +, Sandeep Dhavale wrote: Using per-cpu thread pool we can reduce the scheduling latency compared to workqueue implementation. With this patch

Re: [PATCH v4] erofs: replace erofs_unzipd workqueue with per-cpu threads

2023-02-06 Thread Gao Xiang
pu kthread worker > * Updated commit message I've just modified your v4 patch based on erofs -dev branch with my previous suggestion [1], but I haven't tested it. Could you help check if the updated patch looks good to you and test it on your side? If there are unexpecte

[PATCH 6/6] erofs: tidy up internal.h

2023-02-04 Thread Gao Xiang
Reorder internal.h code so that removing unneeded macros and more. No logic changes. Signed-off-by: Gao Xiang --- fs/erofs/internal.h | 84 +++-- 1 file changed, 28 insertions(+), 56 deletions(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h

[PATCH 5/6] erofs: get rid of z_erofs_do_map_blocks() forward declaration

2023-02-04 Thread Gao Xiang
The code can be neater without forward declarations. Let's get rid of z_erofs_do_map_blocks() forward declaration. Signed-off-by: Gao Xiang --- fs/erofs/zmap.c | 242 1 file changed, 119 insertions(+), 123 deletions(-) diff --git a/fs/erofs

[PATCH 3/6] erofs: remove tagged pointer helpers

2023-02-04 Thread Gao Xiang
Just open-code the remaining one to simplify the code. Signed-off-by: Gao Xiang --- fs/erofs/tagptr.h | 107 -- fs/erofs/zdata.c | 26 +++ fs/erofs/zdata.h | 1 - 3 files changed, 6 insertions(+), 128 deletions(-) delete mode 100644 fs

[PATCH 4/6] erofs: move zdata.h into zdata.c

2023-02-04 Thread Gao Xiang
Definitions in zdata.h are only used in zdata.c and for internal use only. No logic changes. Signed-off-by: Gao Xiang --- fs/erofs/zdata.c | 166 +++- fs/erofs/zdata.h | 177 --- 2 files changed, 165 insertions

[PATCH 2/6] erofs: avoid tagged pointers to mark sync decompression

2023-02-04 Thread Gao Xiang
We could just use a boolean in z_erofs_decompressqueue for sync decompression to simplify the code. Signed-off-by: Gao Xiang --- fs/erofs/zdata.c | 42 -- fs/erofs/zdata.h | 2 +- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/fs/erofs

[PATCH 1/6] erofs: get rid of erofs_inode_datablocks()

2023-02-04 Thread Gao Xiang
erofs_inode_datablocks() has the only one caller, let's just get rid of it entirely. No logic changes. Signed-off-by: Gao Xiang --- fs/erofs/internal.h | 6 -- fs/erofs/namei.c| 18 +- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/fs/erofs/internal.h

Re: [PATCH v3] erofs: replace erofs_unzipd workqueue with per-cpu threads

2023-02-03 Thread Gao Xiang
ave two modes, 1) per-cpu kworker mode; 2) unbounded workqueue (as a fallback / just use this if per-cpu kworker is disabled) and 1) can be turned off by Kconfig as well if users don't need to use it, but important to resolve the current Android scheduling issue. Thanks, Gao Xiang

Re: [PATCH 1/2] erofs: simplify instantiation of pseudo mount in fscache mode

2023-02-02 Thread Gao Xiang
On 2023/2/3 15:14, Gao Xiang wrote: On 2023/2/3 11:47, Jingbo Xu wrote: Introduce a pseudo fs type dedicated to the pseudo mount of fscache mode, so that the logic of real mount won't be messed up with that of pseudo mount, making the implementation of fscache mode more self-contained

Re: [PATCH 1/2] erofs: simplify instantiation of pseudo mount in fscache mode

2023-02-02 Thread Gao Xiang
uot;erofs_anonfs", + .init_fs_context = erofs_fc_anon_get_tree, + .kill_sb= kill_anon_super, + }; Please don't add another filesystem type, thanks. Thanks, Gao Xiang

Re: [PATCH 3/3] erofs: call erofs_map_dev() inside erofs_map_blocks()

2023-02-02 Thread Gao Xiang
since it can handle non-inode IO requests, so let's keep this rather than mergeing all code into erofs_map_blocks() Thanks, Gao Xiang Signed-off-by: Jingbo Xu --- fs/erofs/data.c | 21 ++--- fs/erofs/fscache.c | 20 ++-- fs/erofs/internal.h | 3 ++- 3

Re: [PATCH 1/3] erofs: add print symbols for various flags in trace

2023-02-02 Thread Gao Xiang
never used actually. Could we just gid of this flag (EROFS_GET_BLOCKS_RAW)? Thanks, Gao Xiang + { EROFS_GET_BLOCKS_FIEMAP, "FIEMAP" }, \ + { EROFS_GET_BLOCKS_READMORE,"READMORE" }, \ + { EROFS_GET_BLOCKS_FINDTAIL,"

[PATCH] erofs-utils: fix chunk-based image handling without real data

2023-01-31 Thread Gao Xiang
Otherwise it will report: erofs: total metadata: 982 blocks erofs: Could not format the device : [Error 5] Input/output error Fixes: 03cbf7b8f7f7 ("erofs-utils: mkfs: support chunk-based uncompressed files") Signed-off-by: Gao Xiang --- lib/blobchunk.c | 2 ++ 1 file

[PATCH] erofs-utils: fuse: fix warnings on MacOS

2023-01-31 Thread Gao Xiang
Reported by the latest nightly build: https://github.com/erofs/erofsnightly/actions/runs/4050082667/jobs/6969376259 Signed-off-by: Gao Xiang --- fuse/main.c | 9 +++-- lib/config.c | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fuse/main.c b/fuse/main.c index

[PATCH v2] erofs-utils: support chunk-based sparse files

2023-01-30 Thread Gao Xiang
Scan holes for chunk-based inodes if either --chunksize=# or -Ededupe (without compression) is specified so that sparse files can be made, which has already been supported since Linux 5.15. Signed-off-by: Gao Xiang --- changes since v1: - fix `off64_t` compile error on MacOS. lib/blobchunk.c

[PATCH] erofs-utils: support chunk-based sparse files

2023-01-27 Thread Gao Xiang
Scan holes for chunk-based inodes if either --chunksize=# or -Ededupe (without compression) is specified so that sparse files can be made, which has already been supported since Linux 5.15. Signed-off-by: Gao Xiang --- lib/blobchunk.c | 71 ++--- 1

Re: [PATCH] workqueue: Add WQ_SCHED_FIFO

2023-01-18 Thread Gao Xiang
On Wed, Jan 18, 2023 at 06:41:26PM -0800, Sandeep Dhavale via Linux-erofs wrote: > On Sat, Jan 14, 2023 at 1:01 PM Nathan Huckleberry wrote: > > > > On Fri, Jan 13, 2023 at 6:20 PM Gao Xiang > > wrote: > > > > > > Hi Nathan! > > > > > >

[GIT PULL] erofs fixes for 6.2-rc5

2023-01-18 Thread Gao Xiang
_ON in iomap_iter_done() (Siddh); - Fix improper kvcalloc() use with __GFP_NOFAIL (me); - Add missing `domain_id` mount option in documentation (Jingbo); - Clean up fscache option parsing (Jingbo). ---- Gao Xiang (1): erofs: fix kvcal

[PATCH v2 2/2] erofs: simplify iloc()

2023-01-14 Thread Gao Xiang
From: Gao Xiang Actually we could pass in inodes directly to clean up all callers. Also rename iloc() as erofs_iloc(). Signed-off-by: Gao Xiang --- changes since v1: - fix compile errors reported by intel lkp. fs/erofs/data.c | 9 +++-- fs/erofs/inode.c | 2

[PATCH 2/2] erofs: simplify iloc()

2023-01-14 Thread Gao Xiang
From: Gao Xiang Actually we could pass in inodes directly to clean up all callers. Also rename iloc() as erofs_iloc(). Signed-off-by: Gao Xiang --- fs/erofs/data.c | 9 +++-- fs/erofs/inode.c| 2 +- fs/erofs/internal.h | 16 +--- fs/erofs/xattr.c| 20

[PATCH 1/2] erofs: get rid of debug_one_dentry()

2023-01-14 Thread Gao Xiang
From: Gao Xiang Since erofsdump is available, no need to keep this debugging functionality at all. Also drop a useless comment since it's the VFS behavior. Signed-off-by: Gao Xiang --- fs/erofs/dir.c | 17 - 1 file changed, 17 deletions(-) diff --git a/fs/erofs/dir.c b/fs

Re: [PATCH v2 1/2] erofs: cleanup erofs_iget()

2023-01-13 Thread Gao Xiang
6.2-rc3 next-20230113] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: > https://github.com/intel-lab-lkp/lin

Re: [PATCH] workqueue: Add WQ_SCHED_FIFO

2023-01-13 Thread Gao Xiang
as well. Anyway, I second this proposal if possible: Acked-by: Gao Xiang Thanks, Gao Xiang [1]: https://lore.kernel.org/linux-erofs/20230106073502.4017276-1-dhav...@google.com/ [2]: https://lore.kernel.org/linux-f2fs-devel/20220802192437.1895492-1-daeh...@gmail.com/ [3]: https://lore.kernel.org

[PATCH v2 2/2] erofs: remove linux/buffer_head.h dependency

2023-01-13 Thread Gao Xiang
EROFS actually never uses buffer heads, therefore just get rid of BH_xxx definitions and linux/buffer_head.h inclusive. Reviewed-by: Yue Hu Reviewed-by: Jingbo Xu Signed-off-by: Gao Xiang --- fs/erofs/internal.h | 20 ++-- fs/erofs/super.c| 1 - 2 files changed, 6

[PATCH v2 1/2] erofs: cleanup erofs_iget()

2023-01-13 Thread Gao Xiang
Move inode hash function into inode.c and simplify erofs_iget(). No logic changes. Reviewed-by: Yue Hu Signed-off-by: Gao Xiang --- changes since v1: - use ino ^= nid >> sizeof(ino_t) * 8 as suggested by Jingbo. fs/erofs/inode.c| 40 +--- fs

[PATCH 2/2] erofs: remove linux/buffer_head.h dependency

2023-01-12 Thread Gao Xiang
EROFS actually never uses buffer heads, therefore just get rid of BH_xxx definitions and linux/buffer_head.h inclusive. Signed-off-by: Gao Xiang --- fs/erofs/internal.h | 20 ++-- fs/erofs/super.c| 1 - 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/fs

[PATCH 1/2] erofs: clean up erofs_iget()

2023-01-12 Thread Gao Xiang
Move inode hash function into inode.c and simplify erofs_iget(). Signed-off-by: Gao Xiang --- fs/erofs/inode.c| 40 +--- fs/erofs/internal.h | 9 - 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/fs/erofs/inode.c b/fs/erofs

Re: [PATCH v2 1/2] erofs: add documentation for 'domain_id' mount option

2023-01-12 Thread Gao Xiang
On 2023/1/12 14:54, Jingbo Xu wrote: Since the EROFS share domain feature for fscache mode has been available since Linux v6.1, let's add documentation for 'domain_id' mount option. Cc: linux-...@vger.kernel.org Reviewed-by: Jia Zhu Signed-off-by: Jingbo Xu Reviewed-by: Gao Xiang

Re: [PATCH 2/2] erofs: clean up parsing of fscache related options

2023-01-11 Thread Gao Xiang
On 2023/1/11 16:15, Jingbo Xu wrote: ... to avoid the mess of conditional preprocessing as we are continually adding fscache related mount options. Signed-off-by: Jingbo Xu Reviewd-by: Gao Xiang Thanks, Gao Xiang

Re: [PATCH 1/2] erofs: add documentation for 'domain_id' mount option

2023-01-11 Thread Gao Xiang
Specify a domain ID in fscache mode so that different images with the same blobs under a given domain ID can share storage. Thanks, Gao Xiang === = Sysfs Entries

[PATCH v2] erofs: fix kvcalloc() misuse with __GFP_NOFAIL

2023-01-09 Thread Gao Xiang
e (de)compressed_pages on stack if possible") Fixes: 4f05687fd703 ("erofs: introduce struct z_erofs_decompress_backend") Reviewed-by: Chao Yu Signed-off-by: Gao Xiang --- changes since v1: - should use kfree() instead of kvfree() as well (Chao); - add Chao's r-v-b. fs/erofs/zdata.c | 12

Re: [PATCH] erofs: fix kvcalloc() misuse with __GFP_NOFAIL

2023-01-09 Thread Gao Xiang
Hi Chao, On 2023/1/9 18:34, Chao Yu wrote: On 2023/1/6 13:06, Gao Xiang wrote: On 2023/1/6 11:19, Gao Xiang wrote: As reported by syzbot [1], kvcalloc() cannot work with  __GFP_NOFAIL. Let's use kcalloc() instead. [1] https://lore.kernel.org/r/7796bd05f1852...@google.com

[LSF/MM/BPF TOPIC] Image-based read-only filesystem: further use cases & directions

2023-01-09 Thread Gao Xiang
://lwn.net/SubscriberLink/918893/4d389217f9b8d679 [7] https://lwn.net/Articles/895907 Thanks, Gao Xiang

Re: [PATCH v3] erofs: replace erofs_unzipd workqueue with per-cpu threads

2023-01-05 Thread Gao Xiang
s well for others to refer. I think look into (and try) this version later this week. Thanks, Gao Xiang --- fs/erofs/Kconfig | 11 +++ fs/erofs/zdata.c | 201 +-- fs/erofs/zdata.h | 4 +- 3 files changed, 192 insertions(+), 24 deletions(-) diff

Re: [PATCH] erofs: fix kvcalloc() misuse with __GFP_NOFAIL

2023-01-05 Thread Gao Xiang
On 2023/1/6 11:19, Gao Xiang wrote: As reported by syzbot [1], kvcalloc() cannot work with __GFP_NOFAIL. Let's use kcalloc() instead. [1] https://lore.kernel.org/r/7796bd05f1852...@google.com Reported-by: syzbot+c3729cda01706a04f...@syzkaller.appspotmail.com Fixes

[PATCH] erofs: fix kvcalloc() misuse with __GFP_NOFAIL

2023-01-05 Thread Gao Xiang
As reported by syzbot [1], kvcalloc() cannot work with __GFP_NOFAIL. Let's use kcalloc() instead. [1] https://lore.kernel.org/r/7796bd05f1852...@google.com Reported-by: syzbot+c3729cda01706a04f...@syzkaller.appspotmail.com Signed-off-by: Gao Xiang --- fs/erofs/zdata.c | 8

[PATCH] erofs-utils: dump: drop unneeded spaces for alignment

2023-01-05 Thread Gao Xiang
I don't think they are useful other than leading to unnecessary complexity. Cc: Yue Hu Signed-off-by: Gao Xiang --- dump/main.c | 56 + 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/dump/main.c b/dump/main.c index bc4e028

[PATCH] erofs-utils: dump: avoid printing `Extent size` field

2023-01-03 Thread Gao Xiang
inode.extent_isize is only meaningful during mkfs for now. Signed-off-by: Gao Xiang --- dump/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dump/main.c b/dump/main.c index 93dce8b..86a244c 100644 --- a/dump/main.c +++ b/dump/main.c @@ -388,7 +388,6 @@ static void

Re: [RFC] fs-verity and encryption for EROFS

2022-12-30 Thread Gao Xiang
Hi Eric, On Fri, Dec 30, 2022 at 01:13:49PM -0800, Eric Biggers wrote: > Hi Gao, > > On Thu, Dec 22, 2022 at 11:24:34AM +0800, Gao Xiang wrote: > > ( + more lists ) > > > > On Wed, Dec 21, 2022 at 02:41:40PM +0800, Gao Xiang wrote: > > > Hi folks, >

Re: [RFC] fs-verity and encryption for EROFS

2022-12-21 Thread Gao Xiang
( + more lists ) On Wed, Dec 21, 2022 at 02:41:40PM +0800, Gao Xiang wrote: > Hi folks, > > (As Eric suggested, I post it on list now..) > > In order to outline what we could do next to benefit various image-based > distribution use cases (especially for sign

Re: [PATCH] EROFS: Replace erofs_unzipd workqueue with per-cpu threads

2022-12-21 Thread Gao Xiang
(bios, >pending_bios)) > return; > - /* Use workqueue and sync decompression for atomic contexts only */ > + /* Use kthread_workers and sync decompression for atomic contexts only > */ > if (in_atomic() || irqs_disabled()) { > - queue_work(z_erofs_workqueue, >u.work); > + kthread_queue_work(z_erofs_kthread_pool[raw_smp_processor_id()], > +>u.work); Should we need to handle cpu online/offline as well? Thanks, Gao Xiang

Re: [PATCH] erofs-utils: fsck: support interlaced uncompressed pcluster

2022-12-20 Thread Gao Xiang
raw, > .out = buffer, > .decodedskip = 0, > + .interlaced_offset = 0, Could we use .interlace_offset = map.m_algorithmformat == Z_EROFS_COMPRESSION_INTERLACED ?

[RFC] fs-verity and encryption for EROFS

2022-12-20 Thread Gao Xiang
encryption solution for data sharing for confidential container images... Thanks, Gao Xiang

Re: [PATCH v4 1/3] configure: Use 64bit off_t

2022-12-20 Thread Gao Xiang
Hi Khem, On Thu, Dec 15, 2022 at 12:58:40AM -0800, Khem Raj wrote: > Pass -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 via CFLAGS > this enabled large file support on 32bit architectures > > Signed-off-by: Khem Raj I use this version, rebase to -dev branch and apply them. Thanks, Gao Xiang

Re: BUG: unable to handle kernel paging request in z_erofs_decompress_queue

2022-12-20 Thread Gao Xiang
On Tue, Dec 20, 2022 at 05:42:21PM +0200, Tudor Ambarus wrote: > Hi, Gao, > > On 15.12.2022 16:24, Gao Xiang wrote: > > Hi Tudor, > > > > On Thu, Dec 15, 2022 at 02:58:10PM +0200, Tudor Ambarus wrote: > > > Hi, Gao, Chao, Yue, Jeffle, all, >

Re: BUG: unable to handle kernel paging request in z_erofs_decompress_queue

2022-12-15 Thread Gao Xiang
could be alternative ways to fix this rather than backport the whole multi-reference pcluster feature. Yet I think no need to worry since such image is pretty crafted and should be used as normal images. Thanks, Gao Xiang > > Thanks, > ta > > [1] > https://syzkaller.appspot.com/bug?id=a9b56d324d0de9233ad80633826fac76836d792a

Re: [PATCH v3 2/3] erofs: replace [l]stat64 by equivalent [l]stat

2022-12-15 Thread Gao Xiang
On Wed, Dec 14, 2022 at 10:47:57PM -0800, Khem Raj wrote: > Signed-off-by: Khem Raj Reviewed-by: Gao Xiang Thanks, Gao Xiang > --- > lib/inode.c | 10 +- > lib/xattr.c | 4 ++-- > mkfs/main.c | 4 ++-- > 3 files changed, 9 insertions(+), 9 deletions(-) > >

Re: [PATCH v3 1/3] configure: use AC_SYS_LARGEFILE

2022-12-15 Thread Gao Xiang
https://lore.kernel.org/linux-xfs/1480552932-614-1-git-send-email-ebigg...@google.com Otherwise looks good to me. Thanks, Gao Xiang > + > # Checks for programs. > AM_PROG_AR > AC_PROG_CC > @@ -319,6 +321,9 @@ if test "x$enable_lzma" = "xyes"; then >

Re: [PATCH 2/3] erofs_fs.h: Make LFS mandatory for all usecases

2022-12-14 Thread Gao Xiang
e interest to work on this? (I'm about to release erofs-utils 1.6 in a month.. It would be helpful to clean up such stuff in this version.) Thanks, Gao Xiang > > > Thanks, > > Gao Xiang

Re: [PATCH] erofs-utils: fix fragmentoff overflow for large packed inode

2022-12-13 Thread Gao Xiang
; > + if (ret < 0) > + return ERR_PTR(-errno); This should be in a seperate patch, please don't fix it here. > + > ret = fstat64(fd, ); > if (ret) > return ERR_PTR(-errno); > @@ -1223,7 +1226,9 @@ struct erofs_inode > *erofs_mkfs_build_special_from_fd(int fd, const char *name) > > ret = erofs_write_compressed_file(inode, fd); > if (ret == -ENOSPC) { > - lseek(fd, 0, SEEK_SET); > + ret = lseek(fd, 0, SEEK_SET); > + if (ret < 0) Same here. Thanks, Gao Xiang > + return ERR_PTR(-errno); > ret = write_uncompressed_file_from_fd(inode, fd); > } > > -- > 2.17.1

<    4   5   6   7   8   9   10   11   12   13   >