aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/frontend.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-22 16:20:39 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-22 21:09:54 +0100
commite8cc53ad5fbac2cb2f578091125dc506f136bfde (patch)
tree3b2fa7616c6780189d82de0ced2c610f11befed9 /lib/sqfs/block_processor/frontend.c
parent5aa0f30173ecf3b6538b9136cb4783fc19266288 (diff)
block processor: simplify backlog accounting
Simply count the number of blocks we hand out (malloc'ed or recycled) and decrease the counter when we put blocks back for recycling. The sync() part becomes a little more complicated, because we can get stuck with a backlog of 1 or 2 because we have a fragment or current block buffer in use. We also need to accout for this when creating the processor, because we need to be able to request at least 2 blocks without stalling. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor/frontend.c')
-rw-r--r--lib/sqfs/block_processor/frontend.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqfs/block_processor/frontend.c b/lib/sqfs/block_processor/frontend.c
index ccf54c0..a4a38e9 100644
--- a/lib/sqfs/block_processor/frontend.c
+++ b/lib/sqfs/block_processor/frontend.c
@@ -28,6 +28,8 @@ static int get_new_block(sqfs_block_processor_t *proc, sqfs_block_t **out)
memset(blk, 0, sizeof(*blk));
*out = blk;
+
+ proc->backlog += 1;
return 0;
}
@@ -56,11 +58,11 @@ int enqueue_block(sqfs_block_processor_t *proc, sqfs_block_t *blk)
if (status == 0)
status = SQFS_ERROR_ALLOC;
- free(blk);
+ blk->next = proc->free_list;
+ proc->free_list = blk;
return status;
}
- proc->backlog += 1;
return 0;
}