summaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/block_processor.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-22 11:55:18 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-23 11:00:49 +0100
commitcb8b925130c0ff5cdb445ad36fde47ca4f58e645 (patch)
tree6c5b0b705bbe0611953d17592a9716fe44b1b7cd /lib/sqfs/block_processor/block_processor.c
parent13c804062e9acc7f74850477679265e19704e65a (diff)
block processor: keep duplicate copies of in-flight fragment blocks
If we want full, byte-for byte, verification of fragments during de-duplication we need to check back with the blocks already written to disk, or with the ones that are in flight. The previous, extremely hacky approach simply locked up the thread pool and investigated the queues. For the new approach, we treat the thread pool as completely opaque and don't try to touch it. This commit modifies the block processor to keep duplicate copies of each submitted fragment block around, that are cleaned up once the block is dequeued and written to disk. So instead of touching the thread pool, we can simply investigate the in-fligth-block list and the current block, before resorting to reading back fragment blocks from the file. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor/block_processor.c')
-rw-r--r--lib/sqfs/block_processor/block_processor.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/sqfs/block_processor/block_processor.c b/lib/sqfs/block_processor/block_processor.c
index 29496f9..19a538a 100644
--- a/lib/sqfs/block_processor/block_processor.c
+++ b/lib/sqfs/block_processor/block_processor.c
@@ -56,25 +56,25 @@ static void ht_delete_function(struct hash_entry *entry)
free(entry->data);
}
+static void free_block_list(sqfs_block_t *list)
+{
+ while (list != NULL) {
+ sqfs_block_t *it = list;
+ list = it->next;
+ free(it);
+ }
+}
+
static void block_processor_destroy(sqfs_object_t *base)
{
sqfs_block_processor_t *proc = (sqfs_block_processor_t *)base;
- sqfs_block_t *it;
free(proc->frag_block);
free(proc->blk_current);
- while (proc->free_list != NULL) {
- it = proc->free_list;
- proc->free_list = it->next;
- free(it);
- }
-
- while (proc->io_queue != NULL) {
- it = proc->io_queue;
- proc->io_queue = it->next;
- free(it);
- }
+ free_block_list(proc->free_list);
+ free_block_list(proc->io_queue);
+ free_block_list(proc->fblk_in_flight);
if (proc->frag_ht != NULL)
hash_table_destroy(proc->frag_ht, ht_delete_function);