Re: [PATCH v2] erofs-utils: dump: print filesystem blocksize

2024-04-15 Thread Gao Xiang via Linux-erofs
Hi Sandeep, On Mon, Apr 15, 2024 at 11:35:38AM -0700, Sandeep Dhavale wrote: > mkfs.erofs supports creating filesystem images with different > blocksizes. Add filesystem blocksize in super block dump so > its easier to inspect the filesystem. > > The field is added after FS magic, so the output

[PATCH] erofs-utils: fix build error when `-Waddress-of-temporary` is on

2023-09-20 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Actually, it's false positive and only used for build assertion. Reported-by: Kelvin Zhang Signed-off-by: Gao Xiang --- include/erofs_fs.h | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/erofs_fs.h b/include/erofs_fs.h index

[PATCH 10/10] erofs: enable big pcluster feature

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Enable COMPR_CFGS and BIG_PCLUSTER since the implementations are all settled properly. Signed-off-by: Gao Xiang --- fs/erofs/erofs_fs.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h index

[PATCH 08/10] erofs: support parsing big pcluster compact indexes

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Different from non-compact indexes, several lclusters are packed as the compact form at once and an unique base blkaddr is stored for each pack, so each lcluster index would take less space on avarage (e.g. 2 bytes for COMPACT_2B.) btw, that is also why BIG_PCLUSTER switch should

[PATCH 07/10] erofs: support parsing big pcluster compress indexes

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang When INCOMPAT_BIG_PCLUSTER sb feature is enabled, legacy compress indexes will also have the same on-disk header compact indexes to keep per-file configurations instead of leaving it zeroed. If ADVISE_BIG_PCLUSTER is set for a file, CBLKCNT will be loaded for each pcluster in

[PATCH 06/10] erofs: adjust per-CPU buffers according to max_pclusterblks

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Adjust per-CPU buffers on demand since big pcluster definition is available. Also, bail out unsupported pcluster size according to Z_EROFS_PCLUSTER_MAX_SIZE. Signed-off-by: Gao Xiang --- fs/erofs/decompressor.c | 16 fs/erofs/internal.h | 2 ++ 2 files

[PATCH 05/10] erofs: add big physical cluster definition

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Big pcluster indicates the size of compressed data for each physical pcluster is no longer fixed as block size, but could be more than 1 block (more accurately, 1 logical pcluster) When big pcluster feature is enabled for head0/1, delta0 of the 1st non-head lcluster index will

[PATCH 04/10] erofs: fix up inplace I/O pointer for big pcluster

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang When picking up inplace I/O pages, it should be traversed in reverse order in aligned with the traversal order of file-backed online pages. Also, index should be updated together when preloading compressed pages. Previously, only page-sized pclustersize was supported so no

[PATCH 02/10] erofs: introduce multipage per-CPU buffers

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang To deal the with the cases which inplace decompression is infeasible for some inplace I/O. Per-CPU buffers was introduced to get rid of page allocation latency and thrash for low-latency decompression algorithms such as lz4. For the big pcluster feature, introduce multipage

[PATCH 03/10] erofs: introduce physical cluster slab pools

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Since multiple pcluster sizes could be used at once, the number of compressed pages will become a variable factor. It's necessary to introduce slab pools rather than a single slab cache now. This limits the pclustersize to 1M (Z_EROFS_PCLUSTER_MAX_SIZE), and get rid of the

[PATCH 00/10] erofs: add big pcluster compression support

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Hi folks, This is the formal version of EROFS big pcluster support, which means EROFS can compress data into more than 1 fs block after this patchset. {p,l}cluster are EROFS-specific concepts, standing for `logical cluster' and `physical cluster' correspondingly. Logical

[PATCH 01/10] erofs: reserve physical_clusterbits[]

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Formal big pcluster design is actually more powerful / flexable than the previous thought whose pclustersize was fixed as power-of-2 blocks, which was obviously inefficient and space-wasting. Instead, pclustersize can now be set independently for each pcluster, so various

[PATCH v3 4/4] erofs: add on-disk compression configurations

2021-03-29 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Add a bitmap for available compression algorithms and a variable-sized on-disk table for compression options in preparation for upcoming big pcluster and LZMA algorithm, which follows the end of super block. To parse the compression options, the bitmap is scanned one by one. For

[PATCH v2 4/4] erofs: add on-disk compression configurations

2021-03-28 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Add a bitmap for available compression algorithms and a variable-sized on-disk table for compression options in preparation for upcoming big pcluster and LZMA algorithm, which follows the end of super block. To parse the compression options, the bitmap is scanned one by one. For

[PATCH v2 3/4] erofs: introduce on-disk lz4 fs configurations

2021-03-28 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Introduce z_erofs_lz4_cfgs to store all lz4 configurations. Currently it's only max_distance, but will be used for new features later. Reviewed-by: Chao Yu Signed-off-by: Gao Xiang --- fs/erofs/decompressor.c | 15 +-- fs/erofs/erofs_fs.h | 6 ++

[PATCH v2 0/4] erofs: introduce on-disk compression configurations

2021-03-28 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Hi folks, When we provides support for different algorithms or big pcluster, it'd be necessary to record some configuration in the per-fs basis. For example, when big pcluster feature for lz4 is enabled, we need to know the largest pclustersize in the whole fs instance to

[PATCH v2 2/4] erofs: support adjust lz4 history window size

2021-03-28 Thread Gao Xiang via Linux-erofs
From: Huang Jianan lz4 uses LZ4_DISTANCE_MAX to record history preservation. When using rolling decompression, a block with a higher compression ratio will cause a larger memory allocation (up to 64k). It may cause a large resource burden in extreme cases on devices with small memory and a large

[PATCH v2 1/4] erofs: introduce erofs_sb_has_xxx() helpers

2021-03-28 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Introduce erofs_sb_has_xxx() to make long checks short, especially for later big pcluster & LZMA features. Reviewed-by: Chao Yu Signed-off-by: Gao Xiang --- fs/erofs/decompressor.c | 3 +-- fs/erofs/internal.h | 9 + fs/erofs/super.c| 2 +- 3 files

[PATCH] erofs: add unsupported inode i_format check

2021-03-28 Thread Gao Xiang via Linux-erofs
From: Gao Xiang If any unknown i_format fields are set (may be of some new incompat inode features), mark such inode as unsupported. Just in case of any new incompat i_format fields added in the future. Fixes: 431339ba9042 ("staging: erofs: add inode operations") Cc: # 4.19+ Signed-off-by:

[PATCH 4/4] erofs: add on-disk compression configurations

2021-03-26 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Add a bitmap for available compression algorithms and a variable-sized on-disk table for compression options in preparation for upcoming big pcluster and LZMA algorithm, which follows the end of super block. To parse the compression options, the bitmap is scanned one by one. For

[PATCH 3/4] erofs: introduce on-disk lz4 fs configurations

2021-03-26 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Introduce z_erofs_lz4_cfgs to store all lz4 configurations. Currently it's only max_distance, but will be used for new features later. Signed-off-by: Gao Xiang --- fs/erofs/decompressor.c | 15 +-- fs/erofs/erofs_fs.h | 6 ++ fs/erofs/internal.h | 8

[PATCH 2/4] erofs: support adjust lz4 history window size

2021-03-26 Thread Gao Xiang via Linux-erofs
From: Huang Jianan lz4 uses LZ4_DISTANCE_MAX to record history preservation. When using rolling decompression, a block with a higher compression ratio will cause a larger memory allocation (up to 64k). It may cause a large resource burden in extreme cases on devices with small memory and a large

[PATCH 1/4] erofs: introduce erofs_sb_has_xxx() helpers

2021-03-26 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Introduce erofs_sb_has_xxx() to make long checks short, especially for later big pcluster & LZMA features. Signed-off-by: Gao Xiang --- fs/erofs/decompressor.c | 3 +-- fs/erofs/internal.h | 9 + fs/erofs/super.c| 2 +- 3 files changed, 11 insertions(+), 3

[PATCH v2] erofs: complete a missing case for inplace I/O

2021-03-21 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Add a missing case which could cause unnecessary page allocation but not directly use inplace I/O instead, which increases runtime extra memory footprint. The detail is, considering an online file-backed page, the right half of the page is chosen to be cached (e.g. the end page

[PATCH v2] erofs: fix bio->bi_max_vecs behavior change

2021-03-05 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Martin reported an issue that directory read could be hung on the latest -rc kernel with some certain image. The root cause is that commit baa2c7c97153 ("block: set .bi_max_vecs as actual allocated vector number") changes .bi_max_vecs behavior. bio->bi_max_vecs is set as actual

[PATCH] erofs: fix bio->bi_max_vecs behavior change

2021-03-05 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Martin reported an issue that directory read could be hung on the latest -rc kernel with some certain image. The root cause is that commit baa2c7c97153 ("block: set .bi_max_vecs as actual allocated vector number") changes .bi_max_vecs behavior. bio->bi_max_vecs is set as actual

[PATCH v4] erofs-utils: fuse: fix random readlink error

2021-02-28 Thread Gao Xiang via Linux-erofs
From: Hu Weiwen readlink should fill a **null-terminated** string in the buffer [1]. To achieve this: 1) memset(0) for unmapped extents; 2) make erofsfuse_read() properly returning the actual bytes read; 3) insert a null character if the path is truncated. [1]

[WIP] erofs/erofs-utils: support multiple block compression

2021-02-27 Thread Gao Xiang via Linux-erofs
Hi all, For anyone who interests, I've made a preliminary kernel implementation and it seems to work now. I'm cleaning up these patchset and hopefully send it out later. The code can be fetched from: git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git -b experimental-bigpcluster

Re: [PATCH v3] erofs: support adjust lz4 history window size

2021-02-23 Thread Gao Xiang via Linux-erofs
On Tue, Feb 23, 2021 at 03:44:18PM +0800, Gao Xiang wrote: > On Tue, Feb 23, 2021 at 03:31:19PM +0800, Huang Jianan via Linux-erofs wrote: > > lz4 uses LZ4_DISTANCE_MAX to record history preservation. When > > using rolling decompression, a block with a higher compression > > ratio will cause a

[PATCH v3] erofs-utils: fix battach on full buffer blocks

2021-02-14 Thread Gao Xiang via Linux-erofs
From: Hu Weiwen When the subsequent erofs_battach() is called on an buffer block of which (bb->buffers.off % EROFS_BLKSIZ == 0), `tail_blkaddr' won't be updated correctly. This bug can be reproduced by: mkdir bug-repo head -c 4032 /dev/urandom > bug-repo/1 head -c 4095 /dev/urandom > bug-repo/2

[PATCH v2 2/2] erofs-utils: more sanity check for buffer allocation optimization

2021-02-14 Thread Gao Xiang via Linux-erofs
From: Gao Xiang In case that new buffer allocation optimization logic is potentially broken. Signed-off-by: Gao Xiang --- changes since v1: - add a more check "used_before != cur->buffers.off % EROFS_BLKSIZ" lib/cache.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff

[PATCH v2 1/2] erofs-utils: don't reuse full mapped buffer blocks

2021-02-14 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Full mapped buffer blocks aren't the targets for reusing. Fixes: 185b0bcdef4b ("erofs-utils: optimize buffer allocation logic") Signed-off-by: Gao Xiang --- changes since v1: - update commit message since "erofs-utils: fix battach on full buffer blocks" has been considered

Re: [PATCH v2] erofs-utils: fix battach on full buffer block

2021-02-14 Thread Gao Xiang via Linux-erofs
Hi Weiwen, On Fri, Jan 22, 2021 at 12:26:06AM +0800, Hu Weiwen wrote: > When __erofs_battach() is called on an buffer block of which > (bb->buffers.off % EROFS_BLKSIZ == 0), `tail_blkaddr' will not be > updated correctly. This bug can be reproduced by: > > mkdir bug-repo > head -c 4032

Re: [PATCH v2] erofs-utils: fuse: fix random readlink error

2021-02-09 Thread Gao Xiang via Linux-erofs
Hi Weiwen, On Sat, Jan 30, 2021 at 02:07:47AM +0800, Hu Weiwen wrote: > readlink should fill a **null-terminated** string in the buffer. > > To achieve this: > 1) memset(0) for unmapped extents; > 2) make erofsfuse_read() properly returning the actual bytes read; > 3) insert a null character if

[PATCH 2/2] erofs-utils: more sanity check for buffer allocation optimization

2021-02-09 Thread Gao Xiang via Linux-erofs
From: Gao Xiang In case that new buffer allocation optimization logic is potentially broken. Signed-off-by: Gao Xiang --- lib/cache.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/cache.c b/lib/cache.c index e8840ac5dd31..c4851168ede7 100644 --- a/lib/cache.c

[PATCH 1/2] erofs-utils: don't reuse full mapped buffer blocks

2021-02-09 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Otherwise it could cause data corruption since erofs_battach() doesn't support full buffer blocks (and oob would be misjudged.) Fixes: 185b0bcdef4b ("erofs-utils: optimize buffer allocation logic") Signed-off-by: Gao Xiang --- lib/cache.c | 8 1 file changed, 4

[PATCH] erofs: initialized fields can only be observed after bit is set

2021-02-09 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Currently, although set_bit() & test_bit() pairs are used as a fast- path for initialized configurations. However, these atomic ops are actually relaxed forms. Instead, load-acquire & store-release form is needed to make sure uninitialized fields won't be observed in advance here

Re: [PATCH] erofs-utils: fix mkfs flush inode i_u

2021-01-31 Thread Gao Xiang via Linux-erofs
On Sun, Jan 31, 2021 at 05:45:25PM +0800, Hu Weiwen wrote: > When choosing which field of i_u to use, it should be `inode->i_mode & S_IFMT' > > Previously, the default branch is always taken. Fortunately, all 3 field has > the same data type, and they are in the same union, so it happens to work.

Re: [PATCH] erofs-utils: fix BUILD_BUG_ON

2021-01-31 Thread Gao Xiang via Linux-erofs
On Sun, Jan 31, 2021 at 05:47:32PM +0800, Hu Weiwen wrote: > Signed-off-by: Hu Weiwen Reviewed-by: Gao Xiang Thanks, Gao Xiang > --- > include/erofs/defs.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/erofs/defs.h b/include/erofs/defs.h > index

[PATCH v7 3/3] erofs-utils: optimize buffer allocation logic

2021-01-22 Thread Gao Xiang via Linux-erofs
From: Hu Weiwen When using EROFS to pack our dataset which consists of millions of files, mkfs.erofs is very slow compared with mksquashfs. The bottleneck is `erofs_balloc' and `erofs_mapbh' function, which iterate over all previously allocated buffer blocks, making the complexity of the

[PATCH v7 2/3] erofs-utils: introduce erofs_bfind_for_attach()

2021-01-22 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Seperate erofs_balloc() to make the logic more clearer. Cc: Hu Weiwen Signed-off-by: Gao Xiang --- lib/cache.c | 81 + 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/lib/cache.c b/lib/cache.c index

[PATCH v7 1/3] erofs-utils: get rid of `end' argument from erofs_mapbh()

2021-01-22 Thread Gao Xiang via Linux-erofs
From: Hu Weiwen `end` arguement is completely broken now. Also, it could be reintroduced later if needed. Signed-off-by: Hu Weiwen Signed-off-by: Gao Xiang --- include/erofs/cache.h | 2 +- lib/cache.c | 6 ++ lib/compress.c| 2 +- lib/inode.c | 10

[PATCH v7 0/3] erofs-utils: optimize buffer allocation logic

2021-01-22 Thread Gao Xiang via Linux-erofs
Hi all, This introduces bucket lists for mapped buffer block to boost up buffer allocation and buffer mapping. Thanks to Weiwen for contribution! changes since v6: - introduce erofs_bfind_for_attach to clean up erofs_balloc(); - use a new formula mentioned by Jianan to calculate used_before;

[PATCH] erofs: fix shift-out-of-bounds of blkszbits

2021-01-19 Thread Gao Xiang via Linux-erofs
From: Gao Xiang syzbot generated a crafted bitszbits which can be shifted out-of-bounds[1]. So directly print unsupported blkszbits instead of blksize. [1] https://lore.kernel.org/r/c72ddd05b9444...@google.com Reported-by: syzbot+c68f467cd7c45860e...@syzkaller.appspotmail.com

[RFC PATCH v0 4/4] erofs-utils: fuse: add LZMA algorithm support

2021-01-17 Thread Gao Xiang via Linux-erofs
From: Gao Xiang This patch adds LZMA compression algorithms to erofsfuse to test if LZMA fixed-sized output algorithm works as expected. Cc: Lasse Collin Signed-off-by: Gao Xiang --- lib/data.c | 7 +++--- lib/decompress.c | 62 2 files

[RFC PATCH v0 3/4] erofs-utils: mkfs: add LZMA algorithm support

2021-01-17 Thread Gao Xiang via Linux-erofs
From: Gao Xiang This patch adds LZMA compression algorithms to erofs-utils compression framework by using upstream liblzma. Cc: Lasse Collin Signed-off-by: Gao Xiang --- include/erofs_fs.h | 3 +- lib/Makefile.am | 1 + lib/compress.c | 5 ++- lib/compressor.c

[RFC PATCH v0 1/4] erofs-utils: clevel set up as an individual function

2021-01-17 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Compression level passed in can be verified then. Also, in order for preparation of upcoming LZMA fixed-sized output compression. Signed-off-by: Gao Xiang --- lib/compress.c | 11 ++- lib/compressor.c | 22 +++--- lib/compressor.h |

[RFC PATCH v0 2/4] erofs-utils: add liblzma dependency

2021-01-17 Thread Gao Xiang via Linux-erofs
From: Gao Xiang liblzma [1] has an experimental fixed-sized output LZMA compression support now. Let's use it to have a try! TODO: complete configure.ac / Makefile.am Cc: Lasse Collin Signed-off-by: Gao Xiang --- fuse/Makefile.am | 2 +- lib/Makefile.am | 1 + mkfs/Makefile.am | 2

[RFC PATCH v0 0/4] erofs-utils: add LZMA fixed-sized output compression support

2021-01-17 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Hi folks, Thanks to Lasse, liblzma finally has a preliminary usable fixed-sized output compression support. I've made a quick integration and it seems work. The preliminary C/R result of this is: 459382784 enwik9_4k.squashfs.xz.img 401649664 enwik9_8k.squashfs.xz.img

[PATCH v4 2/2] erofs-utils: optimize buffer allocation logic

2021-01-15 Thread Gao Xiang via Linux-erofs
From: Hu Weiwen When using EROFS to pack our dataset which consists of millions of files, mkfs.erofs is very slow compared with mksquashfs. The bottleneck is `erofs_balloc` and `erofs_mapbh` function, which iterate over all previously allocated buffer blocks, making the complexity of the

[PATCH v3 2/2] erofs-utils: optimize mkfs to O(N), N = #files

2021-01-15 Thread Gao Xiang via Linux-erofs
From: Hu Weiwen When using EROFS to pack our dataset which consists of millions of files, mkfs.erofs is very slow compared with mksquashfs. The bottleneck is `erofs_balloc` and `erofs_mapbh` function, which iterate over all previously allocated buffer blocks, making the complexity of the

[PATCH v3 1/2] erofs-utils: get rid of `end' argument from erofs_mapbh()

2021-01-15 Thread Gao Xiang via Linux-erofs
From: Hu Weiwen `end` arguement is completely broken now. Also, it could be readded later if needed. Signed-off-by: Hu Weiwen Signed-off-by: Gao Xiang --- Hi Weiwen, Sorry for late update. I've cleaned up the patchset (mainly [PATCH 2/2], could you kindly recheck it on your side if it works,

[RFC PATCH v0 2/3] erofs-utils: mkfs: support multiple block compression

2020-12-30 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Store compressed block count to the compressed index so that EROFS can compress from variable-sized input to variable-sized compressed blocks and make the in-place decompression possible as well. TODO: support storing compressed block count for compact indexes. Signed-off-by:

[RFC PATCH v0 1/3] erofs-utils: add -C# for the maximum size of pclusters

2020-12-30 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Set up -C >= EROFS_BLKSIZ (more specifically, >= lclustersize) to enable big pcluster feature. Signed-off-by: Gao Xiang --- include/erofs/config.h | 2 ++ lib/config.c | 1 + mkfs/main.c| 14 +- 3 files changed, 16 insertions(+), 1

[RFC PATCH v0 3/3] erofs-utils: fuse: support multiple block compression

2020-12-30 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Add multiple block compression runtime support for erofsfuse. Signed-off-by: Gao Xiang --- lib/data.c | 4 +-- lib/zmap.c | 72 +- 2 files changed, 68 insertions(+), 8 deletions(-) diff --git a/lib/data.c b/lib/data.c index

[RFC PATCH v0 0/3] erofs-utils: support multiple block compression

2020-12-30 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Hi folks, This is the first RFC patch of multiple block compression (including erofsfuse) after I carefully think over the on-disk design to support multiblock in-place decompression. Compression ratio results (POC, lz4hc, lz4-1.9.3, not final result): 10

[PATCH] AOSP: erofs-utils: fix sub-directory prefix for canned fs_config

2020-12-25 Thread Gao Xiang via Linux-erofs
From: Gao Xiang "failed to find [%s] in canned fs_config" was observed by using "--fs-config-file" option as reported by Yue Hu [1]. The root cause was that the mountpoint prefix to subdirectories is also needed if "--mount-point" presents. However, such prefix cannot be added by just using

[PATCH] erofs-utils: fuse: disable backtrace if unsupported

2020-12-17 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Let's enable backtrace conditionally since it's a GNU extension. Fixes: 5e35b75ad499 ("erofs-utils: introduce fuse implementation") Signed-off-by: Gao Xiang --- configure.ac | 3 ++- fuse/main.c | 8 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git

[PATCH v2] erofs: force inplace I/O under low memory scenario

2020-12-09 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Try to forcely switch to inplace I/O under low memory scenario in order to avoid direct memory reclaim due to cached page allocation. Reviewed-by: Chao Yu Signed-off-by: Gao Xiang --- v2: refine the gfp definition. fs/erofs/compress.h | 3 +++ fs/erofs/zdata.c| 48

[PATCH] erofs-utils: mkfs: fix uuid.h location

2020-12-08 Thread Gao Xiang via Linux-erofs
From: Gao Xiang As Karel reported [1], "The subdirectory in #include is unnecessary (or wrong), if you use PKG_CHECK_MODULES([libuuid], [uuid]) than it returns the subdirectory as -I, see $ pkg-config --cflags uuid -I/usr/include/uuid so the correct way is #include ".

[PATCH] erofs-utils: fix multiple definition of `sbi'

2020-12-08 Thread Gao Xiang via Linux-erofs
As nl6720 reported [1], lib/inode.o (mkfs) and lib/super.o (erofsfuse) could be compiled together by some options. Fix it now. [1] https://lore.kernel.org/r/10789285.Na0ui7I3VY@walnut Reported-by: nl6720 Signed-off-by: Gao Xiang --- Hi nl6720, could you verify this patch? Thanks in advance!

[PATCH] erofs: force inplace I/O under low memory scenario

2020-12-07 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Try to forcely switch to inplace I/O under low memory scenario in order to avoid direct memory reclaim due to cached page allocation. Signed-off-by: Gao Xiang --- This was commercially used internally for years, but due to customized page->mapping before, it cannot cleanly

[PATCH v2] erofs-utils: document erofsfuse in README

2020-12-05 Thread Gao Xiang via Linux-erofs
From: Gao Xiang We are about to release erofs-utils 1.2, add some words to README about erofsfuse itself. Signed-off-by: Gao Xiang --- changes since v1: - fix some typos; - add libfuse dependency and "How to build erofsfuse" section. README | 90

[PATCH] erofs-utils: document erofsfuse in README

2020-12-05 Thread Gao Xiang via Linux-erofs
From: Gao Xiang We are about to release erofs-utils 1.2, add some words to README about erofsfuse itself. Signed-off-by: Gao Xiang --- README | 79 +- 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/README b/README index

[PATCH v2] erofs-utils: update i_nlink stat for directories

2020-12-05 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Previously, nlink of directories was treated as 1 for simplicity. Since st_nlink for dirs is actually not well defined, nlink=1 seems to pacify `find' (even without -noleaf option) and other utilities. AFAICT, isofs, romfs and cramfs always set it to 1, Overlayfs sets it to 1

[PATCH] erofs-utils: update i_nlink stat for directories

2020-12-04 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Previously, nlink of directories is treated as 1 for simplicity. Since st_nlink for dirs is actualy not well defined, nlink=1 seems to pacify `find' (even without -noleaf option) and other utilities. AFAICT, isofs, romfs and cramfs always set it to 1, Overlayfs sets it to 1

[PATCH v2 2/2] erofs-utils: fix cross-device submounts

2020-12-04 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Use device ID and inode number to identify hardlinks rather than inode number only. Fixes: a17497f0844a ("erofs-utils: introduce inode operations") Signed-off-by: Gao Xiang --- changes since v1: - fix improper inline comment update; include/erofs/internal.h | 7 ++-

[PATCH 2/2] erofs-utils: fix cross-device sub-mounts

2020-12-04 Thread Gao Xiang via Linux-erofs
From: Gao Xiang From: Gao Xiang Use device ID and inode number to identify hardlinks rather than inode number only. Fixes: a17497f0844a ("erofs-utils: introduce inode operations") Signed-off-by: Gao Xiang --- include/erofs/internal.h | 7 ++- lib/inode.c | 18

[PATCH 1/2] erofs-utils: don't create hardlinked directories

2020-12-04 Thread Gao Xiang via Linux-erofs
From: Gao Xiang From: Gao Xiang Fix an issue which behaves the same as the following mkisofs BZ due to bindmount: https://bugzilla.redhat.com/show_bug.cgi?id=1749860 Fixes: a17497f0844a ("erofs-utils: introduce inode operations") Signed-off-by: Gao Xiang --- regression testcases will be

[PATCH] erofs-utils: update .gitignore

2020-12-02 Thread Gao Xiang via Linux-erofs
Add more extensions to .gitignore. Signed-off-by: Gao Xiang --- .gitignore | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3a39a1e82e55..8bdd50518074 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,16 @@ .* *~ +*.[ao] *.diff

[PATCH v4 3/3] erofs-utils: fuse: add compressed file support

2020-11-27 Thread Gao Xiang via Linux-erofs
From: Huang Jianan This patch adds a simple approach (~ 700 LOC) to EROFS fixed-sized output decompression without inplace I/O or decompression inplace so it's easy to be ported everywhere with less constraint. However, the on-disk compressed index parser (aka. zmap) is largely kept in line

[PATCH v4 1/3] erofs-utils: introduce fuse implementation

2020-11-27 Thread Gao Xiang via Linux-erofs
From: Li Guifu Let's add a simple erofsfuse approach, and benefits are: - images can be supported on various platforms; - new unpack tool can be developed based on this; - new on-disk features can be iterated, verified effectively. This commit only addresses reading uncompressed regular

[PATCH v3 3/3] erofs-utils: fuse: add compressed file support

2020-11-27 Thread Gao Xiang via Linux-erofs
From: Huang Jianan This patch adds a simple approach (~ 700 LOC) to EROFS fixed-sized output decompression without inplace I/O or decompression inplace so it's easy to be ported everywhere with less constraint. However, the on-disk compressed index parser (aka. zmap) is largely kept in line

[PATCH v3 2/3] erofs-utils: fuse: support symlink & special inode

2020-11-27 Thread Gao Xiang via Linux-erofs
From: Huang Jianan This patch adds symlink and special inode (e.g. block dev, char, socket, pipe inode) support. Signed-off-by: Huang Jianan Signed-off-by: Guo Weichao Signed-off-by: Gao Xiang --- fuse/main.c | 10 ++ lib/namei.c | 22 ++ 2 files changed, 28

[PATCH v3 0/3] erofs-utils: introduce fuse implementation

2020-11-27 Thread Gao Xiang via Linux-erofs
From: Gao Xiang changes since v2: - erofs_dbg() -> erofs_dump() in signal_handle_sigsegv() (Guifu); - get rid of unnecessary new lines (Guifu). changes since v1: - fix off-by-one error of namebuf in erofs_fill_dentries(); - drop unused "struct erofs_super_block super;" in lib/super.c; -

[PATCH v2 3/3] erofs-utils: fuse: add compressed file support

2020-11-21 Thread Gao Xiang via Linux-erofs
From: Gao Xiang From: Huang Jianan This patch adds a simple approach (~ 700 LOC) to EROFS fixed-sized output decompression without inplace I/O or decompression inplace so it's easy to be ported everywhere with less constraint. However, the on-disk compressed index parser (aka. zmap) is

[PATCH v2 2/3] erofs-utils: fuse: support symlink & special inode

2020-11-21 Thread Gao Xiang via Linux-erofs
From: Gao Xiang From: Huang Jianan This patch adds symlink and special inode (e.g. block dev, char, socket, pipe inode) support. Signed-off-by: Huang Jianan Signed-off-by: Guo Weichao Signed-off-by: Gao Xiang --- fuse/main.c | 10 ++ lib/namei.c | 22 ++ 2

[PATCH v2 0/3] erofs-utils: introduce fuse implementation

2020-11-21 Thread Gao Xiang via Linux-erofs
From: Gao Xiang changes since v1: - fix off-by-one error of namebuf in erofs_fill_dentries(); - drop unused "struct erofs_super_block super;" in lib/super.c; - fix clang/32-bit build errors founded by travis CI. Hi all, I've finished cleaning up erofsfuse - a fuse implementation of erofs

[PATCH v2 1/3] erofs-utils: introduce fuse implementation

2020-11-21 Thread Gao Xiang via Linux-erofs
From: Gao Xiang From: Li Guifu Let's add a simple erofsfuse approach, and benefits are: - images can be supported on various platforms; - new unpack tool can be developed based on this; - new on-disk features can be iterated, verified effectively. This commit only addresses reading

[PATCH v3 2/2] erofs-utils: update README

2020-11-20 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Make it easier to understand... Signed-off-by: Gao Xiang --- v3: more typo fixes: "algrithm" => "algorithm"; "it's still not recommended to use" => "it's still not recommended using"; "developped" => "developed"; "unoffical" => "unofficial". README | 74

[PATCH v2 1/2] erofs-utils: drop known issue in README

2020-11-20 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Since lz4-1.9.3 has been released, https://github.com/lz4/lz4/releases/tag/v1.9.3 Move this lz4hc issue (lz4 <= 1.9.2) to "Comments" instead. Signed-off-by: Gao Xiang --- v2: fix "lz4 <= 1.8.2" to "lz4 <= 1.9.2" typo. README | 27 --- 1 file changed,

[PATCH 2/3] erofs-utils: fuse: support symlink & special inode

2020-11-20 Thread Gao Xiang via Linux-erofs
From: Huang Jianan This patch adds symlink and special inode (e.g. block dev, char, socket, pipe inode) support. Signed-off-by: Huang Jianan Signed-off-by: Guo Weichao Signed-off-by: Gao Xiang --- fuse/main.c | 10 ++ lib/namei.c | 22 ++ 2 files changed, 28

[PATCH 3/3] erofs-utils: fuse: add compressed file support

2020-11-20 Thread Gao Xiang via Linux-erofs
From: Huang Jianan This patch adds a simple approach (~ 700 LOC) to EROFS fixed-sized output decompression without inplace I/O or decompression inplace so it's easy to be ported everywhere with less constraint. However, the on-disk compressed index parser (aka. zmap) is largely kept in line

[PATCH 1/3] erofs-utils: introduce fuse implementation

2020-11-20 Thread Gao Xiang via Linux-erofs
From: Li Guifu Let's add a simple erofsfuse approach, and benefits are: - images can be supported on various platforms; - new unpack tool can be developed based on this; - new on-disk features can be iterated, verified effectively. This commit only addresses reading uncompressed regular

[PATCH 0/3] erofs-utils: introduce fuse implementation

2020-11-20 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Hi all, I've finished cleanup erofsfuse - a fuse implementation of erofs just now. It's now considered as multithread safe since it's currently stateless by killing useless caches and using high-level libfuse APIs(also libfuse itself is MT-safe). Therefore, I don't need to

[PATCH 4.19.y] erofs: derive atime instead of leaving it empty

2020-11-16 Thread Gao Xiang via Linux-erofs
From: Gao Xiang commit d3938ee23e97bfcac2e0eb6b356875da73d700df upstream. EROFS has _only one_ ondisk timestamp (ctime is currently documented and recorded, we might also record mtime instead with a new compat feature if needed) for each extended inode since EROFS isn't mainly for archival

[PATCH v2 2/2] erofs-utils: update README

2020-11-16 Thread Gao Xiang via Linux-erofs
Make it easier to understand... Signed-off-by: Gao Xiang --- changes since v1: - fix more typos and descriptions. README | 70 +++--- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/README b/README index

[PATCH 2/2] erofs-utils: update README

2020-11-16 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Make it easier to understand... Signed-off-by: Gao Xiang --- README | 63 ++ 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/README b/README index 7a7ac5d5cb6f..a69607a32e57 100644 --- a/README +++

[PATCH 1/2] erofs-utils: drop known issue in README

2020-11-16 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Since lz4-1.9.3 has been released, https://github.com/lz4/lz4/releases/tag/v1.9.3 Move this lz4hc issue (lz4 <= 1.8.2) to "Comments" instead. Signed-off-by: Gao Xiang --- README | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git

[WIP] [PATCH v4 12/12] erofs-utils: fuse: fix up configure.ac / Makefile.am

2020-11-14 Thread Gao Xiang via Linux-erofs
Signed-off-by: Gao Xiang --- Makefile.am | 6 +- configure.ac | 19 +++ fuse/Makefile.am | 10 +++--- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 24f4a7b3d5ad..b804aa90efa9 100644 --- a/Makefile.am +++

[WIP] [PATCH v4 10/12] erofs-utils: fuse: rename readir.c to dir.c

2020-11-14 Thread Gao Xiang via Linux-erofs
Signed-off-by: Gao Xiang --- fuse/Makefile.am | 2 +- fuse/{readir.c => dir.c} | 2 +- fuse/main.c | 7 ++- fuse/readir.h| 17 - 4 files changed, 8 insertions(+), 20 deletions(-) rename fuse/{readir.c => dir.c} (98%) delete mode 100644

[WIP] [PATCH v4 09/12] erofs-utils: fuse: clean up readdir

2020-11-14 Thread Gao Xiang via Linux-erofs
Signed-off-by: Gao Xiang --- fuse/main.c | 2 +- fuse/readir.c | 155 +++--- fuse/readir.h | 4 +- 3 files changed, 74 insertions(+), 87 deletions(-) diff --git a/fuse/main.c b/fuse/main.c index 9ac8149c88d9..a4b7a3692c19 100644 ---

[WIP] [PATCH v4 06/12] erofs-utils: fuse: get rid of erofs_vnode

2020-11-14 Thread Gao Xiang via Linux-erofs
Signed-off-by: Gao Xiang --- fuse/main.c | 7 ++- fuse/namei.c | 110 +++ fuse/namei.h | 3 +- fuse/read.c | 86 +- fuse/readir.c| 9 ++-- include/erofs/internal.h

[WIP] [PATCH v4 07/12] erofs-utils: fuse: move namei.c to lib/

2020-11-14 Thread Gao Xiang via Linux-erofs
Signed-off-by: Gao Xiang --- fuse/Makefile.am | 2 +- fuse/main.c | 1 - fuse/namei.h | 14 -- fuse/read.c | 1 - fuse/readir.c| 1 - include/erofs/internal.h | 3 +++ lib/Makefile.am | 2 +- {fuse =>

[WIP] [PATCH v4 08/12] erofs-utils: fuse: kill read.c

2020-11-14 Thread Gao Xiang via Linux-erofs
Signed-off-by: Gao Xiang --- fuse/Makefile.am | 2 +- fuse/main.c | 34 +-- fuse/read.c | 59 fuse/read.h | 17 include/erofs/internal.h | 6 ++-- lib/data.c |

[WIP] [PATCH v4 05/12] erofs: clean up compress data read

2020-11-14 Thread Gao Xiang via Linux-erofs
Signed-off-by: Gao Xiang --- fuse/Makefile.am | 2 +- fuse/namei.c | 17 ++-- fuse/read.c | 87 +++- include/erofs/internal.h | 22 -- lib/Makefile.am | 2 +- lib/data.c | 73

[WIP] [PATCH v4 00/12] erofs-utils: introduce fuse implementation

2020-11-14 Thread Gao Xiang via Linux-erofs
Hi, v3: https://lore.kernel.org/r/2020110218.1995-1-hsiang...@aol.com v2: https://lore.kernel.org/r/20201024130959.23720-1-hsiang...@aol.com background & v1: https://lore.kernel.org/r/20201017051621.7810-1-hsiang...@aol.com All main logic has been cleaned up. Send out delta patches this

[WIP] [PATCH v4 03/12] erofs-utils: fuse: add compressed file support

2020-11-14 Thread Gao Xiang via Linux-erofs
From: Huang Jianan Signed-off-by: Huang Jianan Signed-off-by: Guo Weichao Signed-off-by: Gao Xiang --- fuse/Makefile.am | 4 +- fuse/namei.c | 11 +- fuse/read.c| 77 ++- fuse/zmap.c| 417 +

[WIP] [PATCH v4 04/12] erofs-utils: fuse: clean up path walking

2020-11-14 Thread Gao Xiang via Linux-erofs
Signed-off-by: Gao Xiang --- fuse/namei.c | 82 +-- fuse/namei.h | 2 -- fuse/read.c | 16 ++ fuse/readir.c | 10 ++- 4 files changed, 39 insertions(+), 71 deletions(-) diff --git a/fuse/namei.c b/fuse/namei.c index

[WIP] [PATCH v4 02/12] erofs-utils: fuse: add special file support

2020-11-14 Thread Gao Xiang via Linux-erofs
From: Huang Jianan Signed-off-by: Huang Jianan Signed-off-by: Guo Weichao Signed-off-by: Gao Xiang --- fuse/main.c | 2 ++ fuse/namei.c | 14 ++ fuse/read.c | 26 ++ fuse/read.h | 1 +

  1   2   3   4   5   >