From 7d0772e2a11ee3d62bad7c6a225dc2882670df16 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 27 Jul 2019 21:28:35 +0200 Subject: Fix used bytes accounting when deduplicating file blocks If an entire file is eliminated, we need to reset the "used_bytes" counter, otherwise, ALL the table positions are way off. Signed-off-by: David Oberhollenzer --- lib/sqfs/data_writer.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/sqfs') diff --git a/lib/sqfs/data_writer.c b/lib/sqfs/data_writer.c index e9a6193..fddb9d3 100644 --- a/lib/sqfs/data_writer.c +++ b/lib/sqfs/data_writer.c @@ -337,6 +337,8 @@ static int end_file(data_writer_t *data, file_info_t *fi, ref = find_equal_blocks(fi, list, data->super->block_size); if (ref > 0) { + data->super->bytes_used = fi->startblock; + fi->startblock = ref; fi->flags |= FILE_FLAG_BLOCKS_ARE_DUPLICATE; -- cgit v1.2.3