diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-16 00:00:40 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-16 00:23:15 +0100 |
commit | 8e52ed282e16cc0cc984d077377cd79d0f10308d (patch) | |
tree | 60fd399091e03eb489b425718da8445a9a7074a1 /lib/sqfs/block_processor/serial.c | |
parent | 285ea3a807d6158b7d3381ad97205e8e43a5c5f4 (diff) |
block processor: move sparse block detection into worker thread
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor/serial.c')
-rw-r--r-- | lib/sqfs/block_processor/serial.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/sqfs/block_processor/serial.c b/lib/sqfs/block_processor/serial.c index c9ee164..1d2c2db 100644 --- a/lib/sqfs/block_processor/serial.c +++ b/lib/sqfs/block_processor/serial.c @@ -43,35 +43,33 @@ int append_to_work_queue(sqfs_block_processor_t *proc, sqfs_block_t *block) { sqfs_block_t *fragblk = NULL; - if (proc->status != 0 || block == NULL) { - free(block); - return proc->status; - } + if (proc->status != 0) + goto done; - if (block->flags & SQFS_BLK_IS_FRAGMENT) { - block->checksum = crc32(0, block->data, block->size); + proc->status = block_processor_do_block(block, proc->cmp, + proc->scratch, + proc->max_block_size); + if (proc->status != 0) + goto done; + if (block->flags & SQFS_BLK_IS_FRAGMENT) { proc->status = process_completed_fragment(proc, block, &fragblk); - free(block); - - if (proc->status != 0) { - free(fragblk); - return proc->status; - } - if (fragblk == NULL) - return 0; + goto done; + free(block); block = fragblk; - } - - proc->status = block_processor_do_block(block, proc->cmp, proc->scratch, - proc->max_block_size); - if (proc->status == 0) - proc->status = process_completed_block(proc, block); + proc->status = block_processor_do_block(block, proc->cmp, + proc->scratch, + proc->max_block_size); + if (proc->status != 0) + goto done; + } + proc->status = process_completed_block(proc, block); +done: free(block); return proc->status; } |