Skip to contentSkip to conversation

erofs-utils: mkfs: fix inefficient fragment deduplication

PATCH New Gao Xiang 1 participant 1 message Jan 21, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: mkfs: fix inefficient fragment deduplication

Currently, long fragment comparisons could cause suboptimal results, leading to final image sizes still larger than expected:
_________________________________________________________________________

|______ Testset _____|        Vanilla          |          After           | Command Line
|  CoreOS [1]        |   802107392 (765 MiB)   |   687501312 (656 MiB)    | -zlzma,6 -Eall-fragments,fragdedupe=inode -C131072
|____________________|__ 771715072 (736 MiB) __|__ 658485248 (628 MiB)  __| -zlzma,6 -Eall-fragments,fragdedupe=inode -C1048576
|  Fedora KIWI [2]   |_ 2584076288 (2465 MiB) _|_ 2550837248 (2433 MiB) __| -zlzma,6 -Eall-fragments,fragdedupe=inode -C1048576
|____________________|_ 2843598848 (2712 MiB) _|_ 2810359808 (2681 MiB) __| (Fedora-KDE-Desktop-Live-Rawhide.0.x86_64.iso)

Almost all images that use -Eall-fragments could benefit from this.

[1] https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/41.20241215.3.0/x86_64/fedora-coreos-41.20241215.3.0-live.x86_64.iso
[2] https://pagure.io/fedora-kiwi-descriptions.git

---
 lib/compress.c  |   3 +-
 lib/fragments.c | 123 ++++++++++++++++++++++--------------------------
 2 files changed, 57 insertions(+), 69 deletions(-)
lib/compress.c +2 -1
index eb3190d..5c9c051 100644
@@ -1534,7 +1534,8 @@ void *erofs_begin_compressed_file(struct erofs_inode *inode, int fd, u64 fpos)
 
 		if (cfg.c_fragdedupe == FRAGDEDUPE_INODE &&
 		    inode->fragment_size < inode->i_size) {
-			erofs_dbg("Discard the sub-inode tail fragment @ nid %llu", inode->nid);
+			erofs_dbg("Discard the sub-inode tail fragment of %s",
+				  inode->i_srcpath);
 			inode->fragment_size = 0;
 		}
 	}
lib/fragments.c +55 -68

167 lines not on this page · raw message

Signature · 1 line
2.43.5