From 81f9ddf58b4024d51b24123788c860bb08a85b04 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 16 Feb 2020 01:28:43 +0100 Subject: Move all the queue-waiting logic to the thread pool implemenation Signed-off-by: David Oberhollenzer --- lib/sqfs/block_processor/fileapi.c | 45 ++++++++++++++------------------------ 1 file changed, 16 insertions(+), 29 deletions(-) (limited to 'lib/sqfs/block_processor/fileapi.c') diff --git a/lib/sqfs/block_processor/fileapi.c b/lib/sqfs/block_processor/fileapi.c index 098f724..073d92f 100644 --- a/lib/sqfs/block_processor/fileapi.c +++ b/lib/sqfs/block_processor/fileapi.c @@ -7,19 +7,6 @@ #define SQFS_BUILDING_DLL #include "internal.h" -static int enqueue_block(sqfs_block_processor_t *proc, sqfs_block_t *block) -{ - int status; - - while (proc->backlog > proc->max_backlog) { - status = wait_completed(proc); - if (status) - return status; - } - - return append_to_work_queue(proc, block); -} - static int add_sentinel_block(sqfs_block_processor_t *proc) { sqfs_block_t *blk = calloc(1, sizeof(*blk)); @@ -30,21 +17,7 @@ static int add_sentinel_block(sqfs_block_processor_t *proc) blk->inode = proc->inode; blk->flags = proc->blk_flags | SQFS_BLK_LAST_BLOCK; - return enqueue_block(proc, blk); -} - -int sqfs_block_processor_begin_file(sqfs_block_processor_t *proc, - sqfs_inode_generic_t *inode, sqfs_u32 flags) -{ - if (proc->inode != NULL) - return SQFS_ERROR_SEQUENCE; - - if (flags & ~SQFS_BLK_USER_SETTABLE_FLAGS) - return SQFS_ERROR_UNSUPPORTED; - - proc->inode = inode; - proc->blk_flags = flags | SQFS_BLK_FIRST_BLOCK; - return 0; + return append_to_work_queue(proc, blk); } static int flush_block(sqfs_block_processor_t *proc) @@ -60,7 +33,21 @@ static int flush_block(sqfs_block_processor_t *proc) proc->blk_flags &= ~SQFS_BLK_FIRST_BLOCK; } - return enqueue_block(proc, block); + return append_to_work_queue(proc, block); +} + +int sqfs_block_processor_begin_file(sqfs_block_processor_t *proc, + sqfs_inode_generic_t *inode, sqfs_u32 flags) +{ + if (proc->inode != NULL) + return SQFS_ERROR_SEQUENCE; + + if (flags & ~SQFS_BLK_USER_SETTABLE_FLAGS) + return SQFS_ERROR_UNSUPPORTED; + + proc->inode = inode; + proc->blk_flags = flags | SQFS_BLK_FIRST_BLOCK; + return 0; } int sqfs_block_processor_append(sqfs_block_processor_t *proc, const void *data, -- cgit v1.2.3