[PATCH] erofs-utils: avoid unnecessary insert behavior when not deduplicating

Gao Xiang hsiangkao at linux.alibaba.com
Thu Oct 13 19:59:26 AEDT 2022


Hi Yue,

On Thu, Oct 13, 2022 at 12:00:11PM +0800, Yue Hu wrote:
> From: Yue Hu <huyue2 at coolpad.com>
> 
> We should do nothing in dedupe inserting when it's not configured.
> 
> Signed-off-by: Yue Hu <huyue2 at coolpad.com>
> ---

Thanks for the patch, do you observe some strange happening? 

IMO, If dedupe is not enabled, window_size will be 0 I think.
However, I think we might need to disable it explicitly like below.

So,
Reviewed-by: Gao Xiang <hsiangkao at linux.alibaba.com>

Thanks,
Gao Xiang


>  lib/dedupe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/dedupe.c b/lib/dedupe.c
> index 7962014..9cad905 100644
> --- a/lib/dedupe.c
> +++ b/lib/dedupe.c
> @@ -99,7 +99,7 @@ int z_erofs_dedupe_insert(struct z_erofs_inmem_extent *e,
>  {
>  	struct z_erofs_dedupe_item *di;
>  
> -	if (e->length < window_size)
> +	if (!dedupe_subtree || e->length < window_size)
>  		return 0;
>  
>  	di = malloc(sizeof(*di) + e->length - window_size);
> -- 
> 2.17.1


More information about the Linux-erofs mailing list