erofs: fix compacted_2b if compacted_4b_initial > totalidx
Yue Hu
reviewerPATCH 1/1 erofs: fix compacted_2b if compacted_4b_initial > totalidx
From: Yue Hu <[email protected]>
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.
--- fs/erofs/zmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/erofs/zmap.c +2 -1
@@ -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 ;
Signature · 1 line
1.9.1
Quoted 10 lines · Yue Hu
From: Yue Hu <[email protected]>
Currently, the whole indexes will only be compacted 4B if
compacted_4b_initial> totalidx. So, the calculatedcompacted_2bis worthless for that case. It may waste CPU resources.No need to update
compacted_4b_initialas mkfs since it's used to fulfill the alignment of the 1stcompacted_2bpack and would handle the case above.
Quoted 7 lines
We also need to clarify
compacted_4b_endhere. It's used for the last lclusters which aren't fitted in the previouscompacted_2bpacks.Some messages are from Xiang.
Signed-off-by Yue Hu <[email protected]>
Looks good to me,
(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
Quoted 20 lines
--- fs/erofs/zmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/erofs/zmap.c +2
-1@@ -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 ;Signature · 1 line
1.9.1
Yue Hu
reviewerQuoted 17 lines · On Tue, 14 Sep 2021 12:37:14 +0800 Gao Xiang <[email protected]>…
Quoted 16 lines · Yue Hu
From: Yue Hu <[email protected]>
Currently, the whole indexes will only be compacted 4B if
compacted_4b_initial> totalidx. So, the calculatedcompacted_2bis worthless for that case. It may waste CPU resources.No need to update
compacted_4b_initialas mkfs since it's used to fulfill the alignment of the 1stcompacted_2bpack and would handle the case above.We also need to clarify
compacted_4b_endhere. It's used for the last lclusters which aren't fitted in the previouscompacted_2bpacks.Some messages are from Xiang.
Quoted 7 lines
Quoted 1 line
Signed-off-by Yue Hu <[email protected]>Looks good to me,
Reviewed-by Gao Xiang <[email protected]>(although I think the subject title would be better changed into
"clearcompacted_2bifcompacted_4b_initial> totalidx"
Yeah, 'clear' is much better for this change.
Thanks.
Quoted 26 lines
since 'fix'-likewise words could trigger some AI bot for stable kernel backporting..)
Thanks,
Gao XiangQuoted 20 lines
--- fs/erofs/zmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/erofs/zmap.c +2
-1@@ -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 ;Signature · 1 line
1.9.1
Quoted 22 lines · Yue Hu
Quoted 19 lines · On Tue, 14 Sep 2021 12:37:14 +0800 Gao Xiang <[email protected]>…
Quoted 17 lines · Yue Hu
From: Yue Hu <[email protected]>
Currently, the whole indexes will only be compacted 4B if
compacted_4b_initial> totalidx. So, the calculatedcompacted_2bis worthless for that case. It may waste CPU resources.No need to update
compacted_4b_initialas mkfs since it's used to fulfill the alignment of the 1stcompacted_2bpack and would handle the case above.We also need to clarify
compacted_4b_endhere. It's used for the last lclusters which aren't fitted in the previouscompacted_2bpacks.Some messages are from Xiang.
Signed-off-by Yue Hu <[email protected]>
Quoted 7 lines
Quoted 5 lines
Looks good to me,
Reviewed-by Gao Xiang <[email protected]>(although I think the subject title would be better changed into
"clearcompacted_2bifcompacted_4b_initial> totalidx"Yeah, 'clear' is much better for this change.
Ok, I will update this when later applying.
Thanks,
Gao Xiang
Quoted 29 lines
Thanks.
Quoted 26 lines
since 'fix'-likewise words could trigger some AI bot for stable kernel backporting..)
Thanks,
Gao XiangQuoted 20 lines
--- fs/erofs/zmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/erofs/zmap.c +2
-1@@ -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 ;Signature · 1 line
1.9.1
Quoted 50 lines · Yue Hu
Quoted 17 lines · On Tue, 14 Sep 2021 12:37:14 +0800 Gao Xiang <[email protected]>…
Quoted 16 lines · Yue Hu
From: Yue Hu <[email protected]>
Currently, the whole indexes will only be compacted 4B if
compacted_4b_initial> totalidx. So, the calculatedcompacted_2bis worthless for that case. It may waste CPU resources.No need to update
compacted_4b_initialas mkfs since it's used to fulfill the alignment of the 1stcompacted_2bpack and would handle the case above.We also need to clarify
compacted_4b_endhere. It's used for the last lclusters which aren't fitted in the previouscompacted_2bpacks.Some messages are from Xiang.
Quoted 7 lines
Quoted 1 line
Signed-off-by Yue Hu <[email protected]>Looks good to me,
Reviewed-by Gao Xiang <[email protected]>(although I think the subject title would be better changed into
"clearcompacted_2bifcompacted_4b_initial> totalidx"Yeah, 'clear' is much better for this change.
Thanks.
Quoted 18 lines
since 'fix'-likewise words could trigger some AI bot for stable kernel backporting..)
Thanks,
Gao XiangQuoted 12 lines
--- fs/erofs/zmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/erofs/zmap.c +0
-0@@ -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 ;
Quoted 3 lines
Quoted 3 lines
fs/erofs/zmap.c static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, · line 373
Quoted 3 lines
fs/erofs/zmap.c +2
-1-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
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
fs/erofs/zmap.c +0
-0compacted_2b =rounddown (totalidx - compacted_4b_initial,16 ); else compacted_2b =0 ;Signature · 1 line
1.9.1
Quoted 51 lines · On Thu, 23 Sep 2021 19:49:42 +0800 Gao Xiang <[email protected]>…
Quoted 50 lines · Yue Hu
Quoted 17 lines · On Tue, 14 Sep 2021 12:37:14 +0800 Gao Xiang <[email protected]>…
Quoted 16 lines · Yue Hu
From: Yue Hu <[email protected]>
Currently, the whole indexes will only be compacted 4B if
compacted_4b_initial> totalidx. So, the calculatedcompacted_2bis worthless for that case. It may waste CPU resources.No need to update
compacted_4b_initialas mkfs since it's used to fulfill the alignment of the 1stcompacted_2bpack and would handle the case above.We also need to clarify
compacted_4b_endhere. It's used for the last lclusters which aren't fitted in the previouscompacted_2bpacks.Some messages are from Xiang.
Quoted 7 lines
Quoted 1 line
Signed-off-by Yue Hu <[email protected]>Looks good to me,
Reviewed-by Gao Xiang <[email protected]>(although I think the subject title would be better changed into
"clearcompacted_2bifcompacted_4b_initial> totalidx"Yeah, 'clear' is much better for this change.
Thanks.
Quoted 18 lines
since 'fix'-likewise words could trigger some AI bot for stable kernel backporting..)
Thanks,
Gao XiangQuoted 12 lines
--- fs/erofs/zmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/erofs/zmap.c +0
-0@@ -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 ;
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
fs/erofs/zmap.c static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, · line 373
Quoted 3 lines
fs/erofs/zmap.c +2
-1-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.
Quoted 10 lines
applying...
Thanks,
Gao XiangQuoted 5 lines
Quoted 5 lines
Quoted 5 lines
fs/erofs/zmap.c +0
-0compacted_2b =rounddown (totalidx - compacted_4b_initial,16 ); else compacted_2b =0 ;Signature · 1 line
1.9.1
Quoted 51 lines · Gao Xiang
Quoted 50 lines · Yue Hu
Quoted 17 lines · On Tue, 14 Sep 2021 12:37:14 +0800 Gao Xiang <[email protected]>…
Quoted 16 lines · Yue Hu
From: Yue Hu <[email protected]>
Currently, the whole indexes will only be compacted 4B if
compacted_4b_initial> totalidx. So, the calculatedcompacted_2bis worthless for that case. It may waste CPU resources.No need to update
compacted_4b_initialas mkfs since it's used to fulfill the alignment of the 1stcompacted_2bpack and would handle the case above.We also need to clarify
compacted_4b_endhere. It's used for the last lclusters which aren't fitted in the previouscompacted_2bpacks.Some messages are from Xiang.
Quoted 7 lines
Quoted 1 line
Signed-off-by Yue Hu <[email protected]>Looks good to me,
Reviewed-by Gao Xiang <[email protected]>(although I think the subject title would be better changed into
"clearcompacted_2bifcompacted_4b_initial> totalidx"Yeah, 'clear' is much better for this change.
Thanks.
Quoted 18 lines
since 'fix'-likewise words could trigger some AI bot for stable kernel backporting..)
Thanks,
Gao XiangQuoted 12 lines
--- fs/erofs/zmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/erofs/zmap.c +0
-0@@ -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 ;
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
fs/erofs/zmap.c static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, · line 373
Quoted 3 lines
fs/erofs/zmap.c +2
-1-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.
Thanks,