From 3a340b12eb9b7ed86a47391345cb836fa662b2d9 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 4 Aug 2019 16:56:08 +0200 Subject: Improve file unpacking order This commit moves the file unpacking order & job scheduling to a libfstree function. The ordering is improved by making sure fragment blocks are not extracted more than once and files with data blocks are extracted in order. This way, serial unpacking of a 2GiB Debian live image could be reduced from ~5' on my test machine to ~3.5', whereas parallel unpacking stays roughly the same (~3' for -j 4). Signed-off-by: David Oberhollenzer --- include/fstree.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/fstree.h b/include/fstree.h index 608ff97..dbc76db 100644 --- a/include/fstree.h +++ b/include/fstree.h @@ -323,4 +323,13 @@ file_info_t *fragment_by_chksum(file_info_t *fi, uint32_t chksum, uint64_t find_equal_blocks(file_info_t *file, file_info_t *list, size_t block_size); +/* + Optimize the order of the fstree file list for unpacking as to avoid + unpacking fragment blocks more than once and to improve locality when + fetching data from disk. The resulting list is returned in 'out'. + If num_jobs is > 1, the list is split up for parallel processing. + */ +void optimize_unpack_order(fstree_t *fs, size_t num_jobs, + file_info_t *out[num_jobs]); + #endif /* FSTREE_H */ -- cgit v1.2.3