[PATCH] erofs-utils: add clusterofs zero check to write_uncompressed_extent()
Gao Xiang
hsiangkao at linux.alibaba.com
Tue Aug 17 23:13:14 AEST 2021
Hi Yue,
On Tue, Aug 17, 2021 at 12:06:04PM +0800, Yue Hu wrote:
> From: Yue Hu <huyue2 at yulong.com>
>
> No need to reset clusterofs to 0 if it's already 0. Acturally, we also
> observed that case frequently. Let's avoid it.
>
> Signed-off-by: Yue Hu <huyue2 at yulong.com>
> ---
> lib/compress.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/compress.c b/lib/compress.c
> index 40723a1..a8ebbc1 100644
> --- a/lib/compress.c
> +++ b/lib/compress.c
> @@ -130,7 +130,7 @@ static int write_uncompressed_extent(struct z_erofs_vle_compress_ctx *ctx,
> unsigned int count;
>
> /* reset clusterofs to 0 if permitted */
> - if (!erofs_sb_has_lz4_0padding() &&
> + if (!erofs_sb_has_lz4_0padding() && ctx->clusterofs &&
Also out of curiosity, which means erofs is used without lz4 0padding?
That way is not recommended now anyway, since it forbids erofs in-place
decompression (only inplace I/O works instead.)
Actually we could make clusterofs aligned with 0 for 0padding cases as
well, but in that cases, we need to recompress the previous pcluster
with new trimmed size rather than just like this.
Thanks,
Gao Xiang
> ctx->head >= ctx->clusterofs) {
> ctx->head -= ctx->clusterofs;
> *len += ctx->clusterofs;
> --
> 1.9.1
More information about the Linux-erofs
mailing list