diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-05-28 20:54:21 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-05-29 03:39:57 +0200 |
commit | 23e06428674750c59c17ae2a22d17ecd42056b02 (patch) | |
tree | 62fd92a66a10f169b2f9e7e8bcdb72b11bb68027 /lib/sqfs | |
parent | 179e4848f2e107c288829b699b7f0a2e7af69c41 (diff) |
cleanup: libsqfs: eliminate block writer statistics
- the "bytes submitted" can be moved over to the block processor
- the number of blocks submitted are already there (implcitily, by
adding the data block count to the fragment block count)
- actual data bytes written can be computed from the super block
- the remaining block count can be changed to simple counter that
can be obtained through a function.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs')
-rw-r--r-- | lib/sqfs/block_processor/common.c | 2 | ||||
-rw-r--r-- | lib/sqfs/block_writer.c | 17 |
2 files changed, 7 insertions, 12 deletions
diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c index bd37068..757544a 100644 --- a/lib/sqfs/block_processor/common.c +++ b/lib/sqfs/block_processor/common.c @@ -73,6 +73,8 @@ int process_completed_block(sqfs_block_processor_t *proc, sqfs_block_t *blk) if (err) goto out; + proc->stats.output_bytes_generated += blk->size; + if (blk->flags & SQFS_BLK_IS_SPARSE) { sqfs_inode_make_extended(*(blk->inode)); (*(blk->inode))->data.file_ext.sparse += blk->size; diff --git a/lib/sqfs/block_writer.c b/lib/sqfs/block_writer.c index b819b58..06cbd37 100644 --- a/lib/sqfs/block_writer.c +++ b/lib/sqfs/block_writer.c @@ -34,8 +34,7 @@ struct sqfs_block_writer_t { blk_info_t *blocks; size_t devblksz; - sqfs_block_writer_stats_t stats; - + sqfs_u64 blocks_written; sqfs_u64 data_area_start; sqfs_u64 start; @@ -132,7 +131,6 @@ sqfs_block_writer_t *sqfs_block_writer_create(sqfs_file_t *file, wr->file = file; wr->devblksz = devblksz; wr->max_blocks = INIT_BLOCK_COUNT; - wr->stats.size = sizeof(wr->stats); wr->data_area_start = wr->file->get_size(wr->file); wr->blocks = alloc_array(sizeof(wr->blocks[0]), wr->max_blocks); @@ -180,10 +178,7 @@ int sqfs_block_writer_write(sqfs_block_writer_t *wr, sqfs_u32 size, if (err) return err; - wr->stats.bytes_submitted += size; - wr->stats.blocks_submitted += 1; - wr->stats.blocks_written = wr->num_blocks; - wr->stats.bytes_written = offset + size - wr->data_area_start; + wr->blocks_written = wr->num_blocks; } if (flags & SQFS_BLK_LAST_BLOCK) { @@ -218,15 +213,13 @@ int sqfs_block_writer_write(sqfs_block_writer_t *wr, sqfs_u32 size, return err; } - wr->stats.blocks_written = wr->num_blocks; - wr->stats.bytes_written = wr->start - wr->data_area_start; + wr->blocks_written = wr->num_blocks; } return 0; } -const sqfs_block_writer_stats_t -*sqfs_block_writer_get_stats(const sqfs_block_writer_t *wr) +sqfs_u64 sqfs_block_writer_get_block_count(const sqfs_block_writer_t *wr) { - return &wr->stats; + return wr->blocks_written; } |