* [PATCH] erofs: fix compacted_2b if compacted_4b_initial > totalidx @ 2021-09-14 3:59 Yue Hu 2021-09-14 4:37 ` Gao Xiang 0 siblings, 1 reply; 7+ messages in thread From: Yue Hu @ 2021-09-14 3:59 UTC (permalink / raw) To: xiang, chao; +Cc: linux-erofs, linux-kernel, huyue2, zhangwen, zbestahu From: Yue Hu <huyue2@yulong.com> Currently, the whole indexes will only be compacted 4B if compacted_4b_initial > totalidx. So, the calculated compacted_2b is worthless for that case. It may waste CPU resources. No need to update compacted_4b_initial as mkfs since it's used to fulfill the alignment of the 1st compacted_2b pack and would handle the case above. We also need to clarify compacted_4b_end here. It's used for the last lclusters which aren't fitted in the previous compacted_2b packs. Some messages are from Xiang. Signed-off-by: Yue Hu <huyue2@yulong.com> --- fs/erofs/zmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index 9fb98d8..aeed404 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, if (compacted_4b_initial == 32 / 4) compacted_4b_initial = 0; - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) + if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && + compacted_4b_initial <= totalidx) { compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); else compacted_2b = 0; -- 1.9.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] erofs: fix compacted_2b if compacted_4b_initial > totalidx 2021-09-14 3:59 [PATCH] erofs: fix compacted_2b if compacted_4b_initial > totalidx Yue Hu @ 2021-09-14 4:37 ` Gao Xiang 2021-09-14 4:57 ` Yue Hu 0 siblings, 1 reply; 7+ messages in thread From: Gao Xiang @ 2021-09-14 4:37 UTC (permalink / raw) To: Yue Hu; +Cc: xiang, chao, linux-erofs, linux-kernel, huyue2, zhangwen, zbestahu On Tue, Sep 14, 2021 at 11:59:15AM +0800, Yue Hu wrote: > From: Yue Hu <huyue2@yulong.com> > > Currently, the whole indexes will only be compacted 4B if > compacted_4b_initial > totalidx. So, the calculated compacted_2b > is worthless for that case. It may waste CPU resources. > > No need to update compacted_4b_initial as mkfs since it's used to > fulfill the alignment of the 1st compacted_2b pack and would handle > the case above. > > We also need to clarify compacted_4b_end here. It's used for the > last lclusters which aren't fitted in the previous compacted_2b > packs. > > Some messages are from Xiang. > > Signed-off-by: Yue Hu <huyue2@yulong.com> Looks good to me, Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> (although I think the subject title would be better changed into "clear compacted_2b if compacted_4b_initial > totalidx" since 'fix'-likewise words could trigger some AI bot for stable kernel backporting..) Thanks, Gao Xiang > --- > fs/erofs/zmap.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c > index 9fb98d8..aeed404 100644 > --- a/fs/erofs/zmap.c > +++ b/fs/erofs/zmap.c > @@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, > if (compacted_4b_initial == 32 / 4) > compacted_4b_initial = 0; > > - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) > + if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && > + compacted_4b_initial <= totalidx) { > compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); > else > compacted_2b = 0; > -- > 1.9.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] erofs: fix compacted_2b if compacted_4b_initial > totalidx 2021-09-14 4:37 ` Gao Xiang @ 2021-09-14 4:57 ` Yue Hu 2021-09-14 5:11 ` Gao Xiang 2021-09-23 11:49 ` Gao Xiang 0 siblings, 2 replies; 7+ messages in thread From: Yue Hu @ 2021-09-14 4:57 UTC (permalink / raw) To: Gao Xiang Cc: xiang, chao, linux-erofs, linux-kernel, huyue2, zhangwen, zbestahu On Tue, 14 Sep 2021 12:37:14 +0800 Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > On Tue, Sep 14, 2021 at 11:59:15AM +0800, Yue Hu wrote: > > From: Yue Hu <huyue2@yulong.com> > > > > Currently, the whole indexes will only be compacted 4B if > > compacted_4b_initial > totalidx. So, the calculated compacted_2b > > is worthless for that case. It may waste CPU resources. > > > > No need to update compacted_4b_initial as mkfs since it's used to > > fulfill the alignment of the 1st compacted_2b pack and would handle > > the case above. > > > > We also need to clarify compacted_4b_end here. It's used for the > > last lclusters which aren't fitted in the previous compacted_2b > > packs. > > > > Some messages are from Xiang. > > > > Signed-off-by: Yue Hu <huyue2@yulong.com> > > Looks good to me, > Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> > > (although I think the subject title would be better changed into > "clear compacted_2b if compacted_4b_initial > totalidx" Yeah, 'clear' is much better for this change. Thanks. > since 'fix'-likewise words could trigger some AI bot for stable > kernel backporting..) > > Thanks, > Gao Xiang > > > --- > > fs/erofs/zmap.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c > > index 9fb98d8..aeed404 100644 > > --- a/fs/erofs/zmap.c > > +++ b/fs/erofs/zmap.c > > @@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, > > if (compacted_4b_initial == 32 / 4) > > compacted_4b_initial = 0; > > > > - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) > > + if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && > > + compacted_4b_initial <= totalidx) { > > compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); > > else > > compacted_2b = 0; > > -- > > 1.9.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] erofs: fix compacted_2b if compacted_4b_initial > totalidx 2021-09-14 4:57 ` Yue Hu @ 2021-09-14 5:11 ` Gao Xiang 2021-09-23 11:49 ` Gao Xiang 1 sibling, 0 replies; 7+ messages in thread From: Gao Xiang @ 2021-09-14 5:11 UTC (permalink / raw) To: Yue Hu; +Cc: xiang, chao, linux-erofs, linux-kernel, huyue2, zhangwen, zbestahu On Tue, Sep 14, 2021 at 12:57:48PM +0800, Yue Hu wrote: > On Tue, 14 Sep 2021 12:37:14 +0800 > Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > > > On Tue, Sep 14, 2021 at 11:59:15AM +0800, Yue Hu wrote: > > > From: Yue Hu <huyue2@yulong.com> > > > > > > Currently, the whole indexes will only be compacted 4B if > > > compacted_4b_initial > totalidx. So, the calculated compacted_2b > > > is worthless for that case. It may waste CPU resources. > > > > > > No need to update compacted_4b_initial as mkfs since it's used to > > > fulfill the alignment of the 1st compacted_2b pack and would handle > > > the case above. > > > > > > We also need to clarify compacted_4b_end here. It's used for the > > > last lclusters which aren't fitted in the previous compacted_2b > > > packs. > > > > > > Some messages are from Xiang. > > > > > > Signed-off-by: Yue Hu <huyue2@yulong.com> > > > > Looks good to me, > > Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> > > > > (although I think the subject title would be better changed into > > "clear compacted_2b if compacted_4b_initial > totalidx" > > Yeah, 'clear' is much better for this change. Ok, I will update this when later applying. Thanks, Gao Xiang > > Thanks. > > > since 'fix'-likewise words could trigger some AI bot for stable > > kernel backporting..) > > > > Thanks, > > Gao Xiang > > > > > --- > > > fs/erofs/zmap.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c > > > index 9fb98d8..aeed404 100644 > > > --- a/fs/erofs/zmap.c > > > +++ b/fs/erofs/zmap.c > > > @@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, > > > if (compacted_4b_initial == 32 / 4) > > > compacted_4b_initial = 0; > > > > > > - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) > > > + if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && > > > + compacted_4b_initial <= totalidx) { > > > compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); > > > else > > > compacted_2b = 0; > > > -- > > > 1.9.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] erofs: fix compacted_2b if compacted_4b_initial > totalidx 2021-09-14 4:57 ` Yue Hu 2021-09-14 5:11 ` Gao Xiang @ 2021-09-23 11:49 ` Gao Xiang 2021-09-23 12:50 ` Yue Hu 2021-09-23 15:13 ` Chao Yu 1 sibling, 2 replies; 7+ messages in thread From: Gao Xiang @ 2021-09-23 11:49 UTC (permalink / raw) To: Yue Hu; +Cc: xiang, chao, linux-erofs, linux-kernel, huyue2, zhangwen, zbestahu On Tue, Sep 14, 2021 at 12:57:48PM +0800, Yue Hu wrote: > On Tue, 14 Sep 2021 12:37:14 +0800 > Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > > > On Tue, Sep 14, 2021 at 11:59:15AM +0800, Yue Hu wrote: > > > From: Yue Hu <huyue2@yulong.com> > > > > > > Currently, the whole indexes will only be compacted 4B if > > > compacted_4b_initial > totalidx. So, the calculated compacted_2b > > > is worthless for that case. It may waste CPU resources. > > > > > > No need to update compacted_4b_initial as mkfs since it's used to > > > fulfill the alignment of the 1st compacted_2b pack and would handle > > > the case above. > > > > > > We also need to clarify compacted_4b_end here. It's used for the > > > last lclusters which aren't fitted in the previous compacted_2b > > > packs. > > > > > > Some messages are from Xiang. > > > > > > Signed-off-by: Yue Hu <huyue2@yulong.com> > > > > Looks good to me, > > Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> > > > > (although I think the subject title would be better changed into > > "clear compacted_2b if compacted_4b_initial > totalidx" > > Yeah, 'clear' is much better for this change. > > Thanks. > > > since 'fix'-likewise words could trigger some AI bot for stable > > kernel backporting..) > > > > Thanks, > > Gao Xiang > > > > > --- > > > fs/erofs/zmap.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c > > > index 9fb98d8..aeed404 100644 > > > --- a/fs/erofs/zmap.c > > > +++ b/fs/erofs/zmap.c > > > @@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, > > > if (compacted_4b_initial == 32 / 4) > > > compacted_4b_initial = 0; > > > > > > - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) > > > + if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && > > > + compacted_4b_initial <= totalidx) { btw, I've fixed up the build error due to redundant brace '{' when applying... Thanks, Gao Xiang > > > compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); > > > else > > > compacted_2b = 0; > > > -- > > > 1.9.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] erofs: fix compacted_2b if compacted_4b_initial > totalidx 2021-09-23 11:49 ` Gao Xiang @ 2021-09-23 12:50 ` Yue Hu 2021-09-23 15:13 ` Chao Yu 1 sibling, 0 replies; 7+ messages in thread From: Yue Hu @ 2021-09-23 12:50 UTC (permalink / raw) To: Gao Xiang Cc: Yue Hu, xiang, chao, linux-erofs, linux-kernel, huyue2, zhangwen On Thu, 23 Sep 2021 19:49:42 +0800 Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > On Tue, Sep 14, 2021 at 12:57:48PM +0800, Yue Hu wrote: > > On Tue, 14 Sep 2021 12:37:14 +0800 > > Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > > > > > On Tue, Sep 14, 2021 at 11:59:15AM +0800, Yue Hu wrote: > > > > From: Yue Hu <huyue2@yulong.com> > > > > > > > > Currently, the whole indexes will only be compacted 4B if > > > > compacted_4b_initial > totalidx. So, the calculated compacted_2b > > > > is worthless for that case. It may waste CPU resources. > > > > > > > > No need to update compacted_4b_initial as mkfs since it's used to > > > > fulfill the alignment of the 1st compacted_2b pack and would handle > > > > the case above. > > > > > > > > We also need to clarify compacted_4b_end here. It's used for the > > > > last lclusters which aren't fitted in the previous compacted_2b > > > > packs. > > > > > > > > Some messages are from Xiang. > > > > > > > > Signed-off-by: Yue Hu <huyue2@yulong.com> > > > > > > Looks good to me, > > > Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> > > > > > > (although I think the subject title would be better changed into > > > "clear compacted_2b if compacted_4b_initial > totalidx" > > > > Yeah, 'clear' is much better for this change. > > > > Thanks. > > > > > since 'fix'-likewise words could trigger some AI bot for stable > > > kernel backporting..) > > > > > > Thanks, > > > Gao Xiang > > > > > > > --- > > > > fs/erofs/zmap.c | 3 ++- > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c > > > > index 9fb98d8..aeed404 100644 > > > > --- a/fs/erofs/zmap.c > > > > +++ b/fs/erofs/zmap.c > > > > @@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, > > > > if (compacted_4b_initial == 32 / 4) > > > > compacted_4b_initial = 0; > > > > > > > > - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) > > > > + if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && > > > > + compacted_4b_initial <= totalidx) { > > btw, I've fixed up the build error due to redundant brace '{' when Thanks. > applying... > > Thanks, > Gao Xiang > > > > > compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); > > > > else > > > > compacted_2b = 0; > > > > -- > > > > 1.9.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] erofs: fix compacted_2b if compacted_4b_initial > totalidx 2021-09-23 11:49 ` Gao Xiang 2021-09-23 12:50 ` Yue Hu @ 2021-09-23 15:13 ` Chao Yu 1 sibling, 0 replies; 7+ messages in thread From: Chao Yu @ 2021-09-23 15:13 UTC (permalink / raw) To: Gao Xiang, Yue Hu Cc: xiang, linux-erofs, linux-kernel, huyue2, zhangwen, zbestahu On 2021/9/23 19:49, Gao Xiang wrote: > On Tue, Sep 14, 2021 at 12:57:48PM +0800, Yue Hu wrote: >> On Tue, 14 Sep 2021 12:37:14 +0800 >> Gao Xiang <hsiangkao@linux.alibaba.com> wrote: >> >>> On Tue, Sep 14, 2021 at 11:59:15AM +0800, Yue Hu wrote: >>>> From: Yue Hu <huyue2@yulong.com> >>>> >>>> Currently, the whole indexes will only be compacted 4B if >>>> compacted_4b_initial > totalidx. So, the calculated compacted_2b >>>> is worthless for that case. It may waste CPU resources. >>>> >>>> No need to update compacted_4b_initial as mkfs since it's used to >>>> fulfill the alignment of the 1st compacted_2b pack and would handle >>>> the case above. >>>> >>>> We also need to clarify compacted_4b_end here. It's used for the >>>> last lclusters which aren't fitted in the previous compacted_2b >>>> packs. >>>> >>>> Some messages are from Xiang. >>>> >>>> Signed-off-by: Yue Hu <huyue2@yulong.com> >>> >>> Looks good to me, >>> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> >>> >>> (although I think the subject title would be better changed into >>> "clear compacted_2b if compacted_4b_initial > totalidx" >> >> Yeah, 'clear' is much better for this change. >> >> Thanks. >> >>> since 'fix'-likewise words could trigger some AI bot for stable >>> kernel backporting..) >>> >>> Thanks, >>> Gao Xiang >>> >>>> --- >>>> fs/erofs/zmap.c | 3 ++- >>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c >>>> index 9fb98d8..aeed404 100644 >>>> --- a/fs/erofs/zmap.c >>>> +++ b/fs/erofs/zmap.c >>>> @@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, >>>> if (compacted_4b_initial == 32 / 4) >>>> compacted_4b_initial = 0; >>>> >>>> - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) >>>> + if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && >>>> + compacted_4b_initial <= totalidx) { > > btw, I've fixed up the build error due to redundant brace '{' when > applying... It looks good to me after above fix. Reviewed-by: Chao Yu <chao@kernel.org> Thanks, ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-23 15:13 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-09-14 3:59 [PATCH] erofs: fix compacted_2b if compacted_4b_initial > totalidx Yue Hu 2021-09-14 4:37 ` Gao Xiang 2021-09-14 4:57 ` Yue Hu 2021-09-14 5:11 ` Gao Xiang 2021-09-23 11:49 ` Gao Xiang 2021-09-23 12:50 ` Yue Hu 2021-09-23 15:13 ` Chao Yu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox