summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-27 21:28:35 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-28 16:33:57 +0200
commit7d0772e2a11ee3d62bad7c6a225dc2882670df16 (patch)
tree233bb33b458188108e8fb17418e2a96541884d74 /lib
parentd07354def451e13c1757c871cd6213fba058dcc0 (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/sqfs/data_writer.c2
1 files changed, 2 insertions, 0 deletions
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;