[PATCH] erofs-utils: lib: tidy up erofs_compress_destsize()

Gao Xiang hsiangkao at linux.alibaba.com
Mon Oct 30 14:48:48 AEDT 2023



On 2023/10/27 15:06, Gao Xiang wrote:
> Drop the old workaround logic to prepare for the following development.
> 
> (I've checked the Linux 6.1.53 source code and an AOSP rootfs without
>   any image size change and strange behavior.)
> 
> Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>

I found that It could cause a regression on non-0padding (mainly
Linux < 5.3 kernels), the fix is attached as blow:

diff --git a/lib/compress.c b/lib/compress.c
index c2f6e90..4eac363 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -537,8 +537,10 @@ frag_packing:
  				padding = blksz - tailused;

  			/* zero out garbage trailing data for non-0padding */
-			if (!erofs_sb_has_lz4_0padding(sbi))
+			if (!erofs_sb_has_lz4_0padding(sbi)) {
  				memset(dst + compressedsize, 0, padding);
+				padding = 0;
+			}

  			/* write compressed data */
  			erofs_dbg("Writing %u compressed data to %u of %u blocks",

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list