summaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-05-24 15:52:01 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-05-24 15:52:01 +0200
commitc067eee9c2e5fd97de7e9d74bfd4521984d23e3e (patch)
treed740ccaa12a1900da24570bf7544aaa8509812c8 /lib/sqfs
parent6c122ab19fab0670a525a3df03db64a4960d84a2 (diff)
Minor fixes/cleanups in the block processor
- Move the inode modifications out of do_block. The inode may be reallocated in parallel by the process_completed_block function, so it is not safe to store the fragment location in the do_block function which is used from the worker threads. - Move the accounting of fragment blocks to the process_completed_block function. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/block_processor/common.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c
index 01f4cce..bd37068 100644
--- a/lib/sqfs/block_processor/common.c
+++ b/lib/sqfs/block_processor/common.c
@@ -92,6 +92,7 @@ int process_completed_block(sqfs_block_processor_t *proc, sqfs_block_t *blk)
location, size);
if (err)
goto out;
+ proc->stats.frag_block_count += 1;
} else {
err = set_block_size(blk->inode, blk->index, size);
if (err)
@@ -132,13 +133,7 @@ int block_processor_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
memcpy(block->data + offset, it->data, it->size);
block->flags |= (it->flags & SQFS_BLK_DONT_COMPRESS);
-
- sqfs_inode_set_frag_location(*(it->inode),
- block->index, offset);
}
-
- /* XXX: the block itself got promoted from a fragment */
- sqfs_inode_set_frag_location(*(block->inode), block->index, 0);
}
if (is_zero_block(block->data, block->size)) {
@@ -215,7 +210,6 @@ int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag,
proc->frag_block->flags &= SQFS_BLK_DONT_COMPRESS;
proc->frag_block->flags |= SQFS_BLK_FRAGMENT_BLOCK;
proc->frag_block->frag_list = NULL;
- proc->stats.frag_block_count += 1;
} else {
index = proc->frag_block->index;
offset = proc->frag_block->size;
@@ -231,6 +225,7 @@ int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag,
if (err)
goto fail_outblk;
+ sqfs_inode_set_frag_location(*(frag->inode), index, offset);
proc->stats.actual_frag_count += 1;
return 0;
fail: