summaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/serial.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-16 00:00:40 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-16 00:23:15 +0100
commit8e52ed282e16cc0cc984d077377cd79d0f10308d (patch)
tree60fd399091e03eb489b425718da8445a9a7074a1 /lib/sqfs/block_processor/serial.c
parent285ea3a807d6158b7d3381ad97205e8e43a5c5f4 (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.c38
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;
}