summaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/common.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-15 22:46:24 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-15 23:05:41 +0100
commit285ea3a807d6158b7d3381ad97205e8e43a5c5f4 (patch)
tree54140627da1bb515cea51f31df65efc0675607ba /lib/sqfs/block_processor/common.c
parent9ac42164bc43bcdd47c0a8e5e59c662b2a136659 (diff)
Move block block accounting to the other end of the block pipeline
This commit moves all of the fragment/block accounting in the block processor over to the writing end of the pipeline. In order to do this, the sparse blocks are allowed to bubble through the pipeline. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor/common.c')
-rw-r--r--lib/sqfs/block_processor/common.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c
index c8dbbc2..002dad4 100644
--- a/lib/sqfs/block_processor/common.c
+++ b/lib/sqfs/block_processor/common.c
@@ -13,6 +13,16 @@ int process_completed_block(sqfs_block_processor_t *proc, sqfs_block_t *blk)
sqfs_u32 size;
int err;
+ if (blk->flags & SQFS_BLK_IS_SPARSE) {
+ sqfs_inode_make_extended(blk->inode);
+ blk->inode->data.file_ext.sparse += blk->size;
+ blk->inode->extra[blk->inode->num_file_blocks] = 0;
+ blk->inode->num_file_blocks += 1;
+
+ proc->stats.sparse_block_count += 1;
+ return 0;
+ }
+
size = blk->size;
if (!(blk->flags & SQFS_BLK_IS_COMPRESSED))
size |= 1 << 24;
@@ -29,7 +39,10 @@ int process_completed_block(sqfs_block_processor_t *proc, sqfs_block_t *blk)
if (err)
return err;
} else {
- blk->inode->extra[blk->index] = size;
+ blk->inode->extra[blk->inode->num_file_blocks] = size;
+ blk->inode->num_file_blocks += 1;
+
+ proc->stats.data_block_count += 1;
}
}
@@ -44,7 +57,7 @@ int block_processor_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
{
ssize_t ret;
- if (block->size == 0) {
+ if (block->size == 0 || (block->flags & SQFS_BLK_IS_SPARSE)) {
block->checksum = 0;
return 0;
}
@@ -77,6 +90,8 @@ int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag,
size_t size;
int err;
+ proc->stats.total_frag_count += 1;
+
err = sqfs_frag_table_find_tail_end(proc->frag_tbl,
frag->checksum, frag->size,
&index, &offset);