* [PATCH] erofs-utils: avoid unnecessary insert behavior when not deduplicating @ 2022-10-13 4:00 Yue Hu 2022-10-13 8:59 ` Gao Xiang 0 siblings, 1 reply; 6+ messages in thread From: Yue Hu @ 2022-10-13 4:00 UTC (permalink / raw) To: linux-erofs; +Cc: Yue Hu, zhangwen From: Yue Hu <huyue2@coolpad.com> We should do nothing in dedupe inserting when it's not configured. Signed-off-by: Yue Hu <huyue2@coolpad.com> --- 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] erofs-utils: avoid unnecessary insert behavior when not deduplicating 2022-10-13 4:00 [PATCH] erofs-utils: avoid unnecessary insert behavior when not deduplicating Yue Hu @ 2022-10-13 8:59 ` Gao Xiang 2022-10-14 1:48 ` Yue Hu 0 siblings, 1 reply; 6+ messages in thread From: Gao Xiang @ 2022-10-13 8:59 UTC (permalink / raw) To: Yue Hu; +Cc: Yue Hu, linux-erofs, zhangwen Hi Yue, On Thu, Oct 13, 2022 at 12:00:11PM +0800, Yue Hu wrote: > From: Yue Hu <huyue2@coolpad.com> > > We should do nothing in dedupe inserting when it's not configured. > > Signed-off-by: Yue Hu <huyue2@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@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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] erofs-utils: avoid unnecessary insert behavior when not deduplicating 2022-10-13 8:59 ` Gao Xiang @ 2022-10-14 1:48 ` Yue Hu 2022-10-14 2:15 ` Gao Xiang 0 siblings, 1 reply; 6+ messages in thread From: Yue Hu @ 2022-10-14 1:48 UTC (permalink / raw) To: Gao Xiang; +Cc: Yue Hu, linux-erofs, zhangwen On Thu, 13 Oct 2022 16:59:26 +0800 Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > Hi Yue, > > On Thu, Oct 13, 2022 at 12:00:11PM +0800, Yue Hu wrote: > > From: Yue Hu <huyue2@coolpad.com> > > > > We should do nothing in dedupe inserting when it's not configured. > > > > Signed-off-by: Yue Hu <huyue2@coolpad.com> > > --- > > Thanks for the patch, do you observe some strange happening? I can see malloc/memcpy at runtime when dedupe is disabled. So, just skip. > > 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@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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] erofs-utils: avoid unnecessary insert behavior when not deduplicating 2022-10-14 1:48 ` Yue Hu @ 2022-10-14 2:15 ` Gao Xiang 2022-10-14 8:44 ` Yue Hu 0 siblings, 1 reply; 6+ messages in thread From: Gao Xiang @ 2022-10-14 2:15 UTC (permalink / raw) To: Yue Hu; +Cc: Yue Hu, linux-erofs, zhangwen On Fri, Oct 14, 2022 at 09:48:46AM +0800, Yue Hu wrote: > On Thu, 13 Oct 2022 16:59:26 +0800 > Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > > > Hi Yue, > > > > On Thu, Oct 13, 2022 at 12:00:11PM +0800, Yue Hu wrote: > > > From: Yue Hu <huyue2@coolpad.com> > > > > > > We should do nothing in dedupe inserting when it's not configured. > > > > > > Signed-off-by: Yue Hu <huyue2@coolpad.com> > > > --- > > > > Thanks for the patch, do you observe some strange happening? > > I can see malloc/memcpy at runtime when dedupe is disabled. So, just skip. Would you mind confirming the numbers of e->length and window_size at that time? Thanks, Gao Xiang > > > > > 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@linux.alibaba.com> > > > > Thanks, > > Gao Xiang ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] erofs-utils: avoid unnecessary insert behavior when not deduplicating 2022-10-14 2:15 ` Gao Xiang @ 2022-10-14 8:44 ` Yue Hu 2022-10-14 9:46 ` Gao Xiang 0 siblings, 1 reply; 6+ messages in thread From: Yue Hu @ 2022-10-14 8:44 UTC (permalink / raw) To: Gao Xiang; +Cc: Yue Hu, linux-erofs, zhangwen Hi Xiang, On Fri, 14 Oct 2022 10:15:27 +0800 Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > On Fri, Oct 14, 2022 at 09:48:46AM +0800, Yue Hu wrote: > > On Thu, 13 Oct 2022 16:59:26 +0800 > > Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > > > > > Hi Yue, > > > > > > On Thu, Oct 13, 2022 at 12:00:11PM +0800, Yue Hu wrote: > > > > From: Yue Hu <huyue2@coolpad.com> > > > > > > > > We should do nothing in dedupe inserting when it's not configured. > > > > > > > > Signed-off-by: Yue Hu <huyue2@coolpad.com> > > > > --- > > > > > > Thanks for the patch, do you observe some strange happening? > > > > I can see malloc/memcpy at runtime when dedupe is disabled. So, just skip. > > Would you mind confirming the numbers of e->length and window_size > at that time? The caller to insert function is just checking "!may_inline && !may_packing". Check below (-zlz4hc foo.img foo/): Processing .gitignore ... <E> erofs: z_erofs_dedupe_insert() Line[105] e->length 84, window_size 0 Processing Kconfig.freezer ... <E> erofs: z_erofs_dedupe_insert() Line[105] e->length 92, window_size 0 Processing Kconfig.hz ... <E> erofs: z_erofs_dedupe_insert() Line[105] e->length 1709, window_size 0 --- a/lib/dedupe.c +++ b/lib/dedupe.c @@ -102,6 +102,8 @@ int z_erofs_dedupe_insert(struct z_erofs_inmem_extent *e, if (e->length < window_size) return 0; + erofs_err("e->length %u, window_size %u", e->length, window_size); + di = malloc(sizeof(*di) + e->length - window_size); Thanks. > > Thanks, > Gao Xiang > > > > > > > > > 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@linux.alibaba.com> > > > > > > Thanks, > > > Gao Xiang ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] erofs-utils: avoid unnecessary insert behavior when not deduplicating 2022-10-14 8:44 ` Yue Hu @ 2022-10-14 9:46 ` Gao Xiang 0 siblings, 0 replies; 6+ messages in thread From: Gao Xiang @ 2022-10-14 9:46 UTC (permalink / raw) To: Yue Hu; +Cc: Yue Hu, linux-erofs, zhangwen On Fri, Oct 14, 2022 at 04:44:22PM +0800, Yue Hu wrote: > Hi Xiang, > > On Fri, 14 Oct 2022 10:15:27 +0800 > Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > > > On Fri, Oct 14, 2022 at 09:48:46AM +0800, Yue Hu wrote: > > > On Thu, 13 Oct 2022 16:59:26 +0800 > > > Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > > > > > > > Hi Yue, > > > > > > > > On Thu, Oct 13, 2022 at 12:00:11PM +0800, Yue Hu wrote: > > > > > From: Yue Hu <huyue2@coolpad.com> > > > > > > > > > > We should do nothing in dedupe inserting when it's not configured. > > > > > > > > > > Signed-off-by: Yue Hu <huyue2@coolpad.com> > > > > > --- > > > > > > > > Thanks for the patch, do you observe some strange happening? > > > > > > I can see malloc/memcpy at runtime when dedupe is disabled. So, just skip. > > > > Would you mind confirming the numbers of e->length and window_size > > at that time? > > The caller to insert function is just checking "!may_inline && !may_packing". > > Check below (-zlz4hc foo.img foo/): > > Processing .gitignore ... > <E> erofs: z_erofs_dedupe_insert() Line[105] e->length 84, window_size 0 > Processing Kconfig.freezer ... > <E> erofs: z_erofs_dedupe_insert() Line[105] e->length 92, window_size 0 > Processing Kconfig.hz ... > <E> erofs: z_erofs_dedupe_insert() Line[105] e->length 1709, window_size 0 > Thanks for confirming! Thanks, Gao Xiang ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-14 9:47 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-10-13 4:00 [PATCH] erofs-utils: avoid unnecessary insert behavior when not deduplicating Yue Hu 2022-10-13 8:59 ` Gao Xiang 2022-10-14 1:48 ` Yue Hu 2022-10-14 2:15 ` Gao Xiang 2022-10-14 8:44 ` Yue Hu 2022-10-14 9:46 ` Gao Xiang
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.