Skip to contentSkip to conversation

erofs-utils: clear compacted_2b if compacted_4b_initial > totalidx

PATCH New Gao Xiang 1 participant 1 message Dec 14, 2021 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: clear compacted_2b if compacted_4b_initial > totalidx

Keep in sync with the latest kernel
commit c40dd3ca2a45 ("erofs: clear compacted_2b if compacted_4b_initial > totalidx")

---
 lib/zmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/zmap.c +2 -1
index 09d5d35e65ee..abc8babd6763 100644
@@ -315,7 +315,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
2.20.1