diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-23 15:28:25 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-23 15:35:36 +0200 |
commit | b86cbb04c9cc72506783e175e871338b1f0e6750 (patch) | |
tree | dcb4f92b6962aa35cacb2db09219fd4dfbaf3d60 /lib/sqfs/blk_proc/pthread.c | |
parent | 8ee4a30a0f3545dac5b9a93b40c172f4fb4d44a1 (diff) |
Move the bulk of the work from the data writer to the block processor
Instead of calling a callback, the block processor now takes care of
writing the data blocks to the file in the correct order, keeping
track of fragment blocks and deduplicating blocks.
Some cleanup work remains to be done and the statistics have to be
repaired (yet again).
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/blk_proc/pthread.c')
-rw-r--r-- | lib/sqfs/blk_proc/pthread.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/sqfs/blk_proc/pthread.c b/lib/sqfs/blk_proc/pthread.c index 565bad2..a9cffd0 100644 --- a/lib/sqfs/blk_proc/pthread.c +++ b/lib/sqfs/blk_proc/pthread.c @@ -70,8 +70,8 @@ sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size, sqfs_compressor_t *cmp, unsigned int num_workers, size_t max_backlog, - void *user, - sqfs_block_cb callback) + size_t devblksz, + sqfs_file_t *file) { sqfs_block_processor_t *proc; unsigned int i; @@ -86,13 +86,19 @@ sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size, return NULL; proc->max_block_size = max_block_size; - proc->cb = callback; - proc->user = user; proc->num_workers = num_workers; proc->max_backlog = max_backlog; proc->mtx = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; proc->queue_cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER; proc->done_cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER; + proc->devblksz = devblksz; + proc->cmp = cmp; + proc->file = file; + proc->max_blocks = INIT_BLOCK_COUNT; + + proc->blocks = alloc_array(sizeof(proc->blocks[0]), proc->max_blocks); + if (proc->blocks == NULL) + goto fail_init; for (i = 0; i < num_workers; ++i) { proc->workers[i] = alloc_flex(sizeof(compress_worker_t), |