From: Jonathan Calmels <jcalmels@nvidia.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>
Cc: linux-erofs@lists.ozlabs.org, oliver.yang@linux.alibaba.com
Subject: Re: [PATCH] erofs-utils: lib: separate plain and compressed filesystems formally
Date: Fri, 12 Jun 2026 01:06:43 -0700 [thread overview]
Message-ID: <aiu9zFNhYaXn_xtk@nvidia.com> (raw)
In-Reply-To: <20260612022001.2665293-1-hsiangkao@linux.alibaba.com>
On Fri, Jun 12, 2026 at 10:20:01AM +0800, Gao Xiang wrote:
> External email: Use caution opening links or attachments
>
>
> Source kernel commit: 7cef3c8341940febf75db6c25199cd83fb74d52f
>
> !lz4_0padding is simply an ancient layout which is mainly used for
> Linux kernels < 5.3 (prior to the initial EROFS formal version) and
> generated with the option `-Elegacy-compress` by mkfs.erofs between
> 1.0 and 1.8.x.
>
> So recently Linux 7.0+ kernels simply use lz4_0padding as another
> indicator of whether it's an (LZ4) compressed filesystem. Follow
> the new behavior for erofs-utils too to fix an incremental data
> build issue [1].
>
> Reported-by: Jonathan Calmels <jcalmels@nvidia.com>
> [1] https://lore.kernel.org/r/20260611235404.1620899-1-jcalmels@nvidia.com
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
> Hi Jonathan,
>
> Could you confirm if this issue works for you?
>
> Thanks,
> Gao Xiang
>
Yes this approach works too, thanks!
> lib/decompress.c | 20 ++++++++------------
> 1 file changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/lib/decompress.c b/lib/decompress.c
> index d23135e0cd43..e6d14f4cbd94 100644
> --- a/lib/decompress.c
> +++ b/lib/decompress.c
> @@ -466,17 +466,12 @@ static int z_erofs_decompress_lz4(struct z_erofs_decompress_req *rq)
> char *dest = rq->out;
> char *src = rq->in;
> char *buff = NULL;
> - bool support_0padding = false;
> unsigned int inputmargin = 0;
> struct erofs_sb_info *sbi = rq->sbi;
>
> - if (erofs_sb_has_lz4_0padding(sbi)) {
> - support_0padding = true;
> -
> - inputmargin = z_erofs_fixup_insize((u8 *)src, rq->inputsize);
> - if (inputmargin >= rq->inputsize)
> - return -EFSCORRUPTED;
> - }
> + inputmargin = z_erofs_fixup_insize((u8 *)src, rq->inputsize);
> + if (inputmargin >= rq->inputsize)
> + return -EFSCORRUPTED;
>
> if (rq->decodedskip) {
> buff = malloc(rq->decodedlength);
> @@ -485,7 +480,7 @@ static int z_erofs_decompress_lz4(struct z_erofs_decompress_req *rq)
> dest = buff;
> }
>
> - if (rq->partial_decoding || !support_0padding)
> + if (rq->partial_decoding)
> ret = LZ4_decompress_safe_partial(src + inputmargin, dest,
> rq->inputsize - inputmargin,
> rq->decodedlength, rq->decodedlength);
> @@ -589,7 +584,10 @@ static int z_erofs_load_lz4_config(struct erofs_sb_info *sbi,
> sbi->lz4.max_pclusterblks = 1; /* reserved case */
> } else {
> distance = le16_to_cpu(dsb->u1.lz4_max_distance);
> + if (!distance && !erofs_sb_has_lz4_0padding(sbi))
> + return 0;
> sbi->lz4.max_pclusterblks = 1;
> + sbi->available_compr_algs = 1 << Z_EROFS_COMPRESSION_LZ4;
> }
> sbi->lz4.max_distance = distance;
> return 0;
> @@ -601,10 +599,8 @@ int z_erofs_parse_cfgs(struct erofs_sb_info *sbi, struct erofs_super_block *dsb)
> erofs_off_t offset;
> int size, ret = 0;
>
> - if (!erofs_sb_has_compr_cfgs(sbi)) {
> - sbi->available_compr_algs = 1 << Z_EROFS_COMPRESSION_LZ4;
> + if (!erofs_sb_has_compr_cfgs(sbi))
> return z_erofs_load_lz4_config(sbi, dsb, NULL, 0);
> - }
>
> sbi->available_compr_algs = le16_to_cpu(dsb->u1.available_compr_algs);
> if (sbi->available_compr_algs & ~Z_EROFS_ALL_COMPR_ALGS) {
> --
> 2.43.5
>
prev parent reply other threads:[~2026-06-12 8:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 23:54 [PATCH] erofs-utils: lib: fix null deref on incremental uncompressed builds Jonathan Calmels
2026-06-12 2:20 ` [PATCH] erofs-utils: lib: separate plain and compressed filesystems formally Gao Xiang
2026-06-12 8:06 ` Jonathan Calmels [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aiu9zFNhYaXn_xtk@nvidia.com \
--to=jcalmels@nvidia.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=oliver.yang@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox