Skip to content

Commit c40dd3c

Browse files
Yue Huhsiangkao
authored andcommitted
erofs: clear compacted_2b if compacted_4b_initial > totalidx
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. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Yue Hu <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Reviewed-by: Chao Yu <[email protected]> [ Gao Xiang: it's enough to use "compacted_4b_initial < totalidx". ] Signed-off-by: Gao Xiang <[email protected]>
1 parent d705117 commit c40dd3c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/erofs/zmap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
369369
if (compacted_4b_initial == 32 / 4)
370370
compacted_4b_initial = 0;
371371

372-
if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B)
372+
if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) &&
373+
compacted_4b_initial < totalidx)
373374
compacted_2b = rounddown(totalidx - compacted_4b_initial, 16);
374375
else
375376
compacted_2b = 0;

0 commit comments

Comments
 (0)