From 940c3e3333ba0063f536dfbecbb77d070dbcc87a Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 31 Jan 2020 17:15:04 +0100 Subject: Split the block writing/deduplication away from the block processor This commit moves the entire block writing and deduplication of data blocks over to a different data type named "block writer". For simplicity, the interfaces of the block processor are left as is and are turned into warppers. Likewise, most of the code in the block writer is just verbatim from the block processor, to be cleaned up in subsequent commits. Signed-off-by: David Oberhollenzer --- lib/sqfs/block_processor/internal.h | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'lib/sqfs/block_processor/internal.h') diff --git a/lib/sqfs/block_processor/internal.h b/lib/sqfs/block_processor/internal.h index 40871b9..16f0edb 100644 --- a/lib/sqfs/block_processor/internal.h +++ b/lib/sqfs/block_processor/internal.h @@ -10,6 +10,7 @@ #include "config.h" #include "sqfs/block_processor.h" +#include "sqfs/block_writer.h" #include "sqfs/frag_table.h" #include "sqfs/compressor.h" #include "sqfs/inode.h" @@ -31,19 +32,6 @@ #include #endif - -#define MK_BLK_HASH(chksum, size) \ - (((sqfs_u64)(size) << 32) | (sqfs_u64)(chksum)) - -#define INIT_BLOCK_COUNT (128) - - -typedef struct { - sqfs_u64 offset; - sqfs_u64 hash; -} blk_info_t; - - typedef struct compress_worker_t compress_worker_t; struct sqfs_block_processor_t { @@ -73,24 +61,18 @@ struct sqfs_block_processor_t { unsigned int num_workers; size_t max_backlog; - size_t devblksz; sqfs_file_t *file; sqfs_frag_table_t *frag_tbl; - sqfs_u64 start; - - size_t file_start; - size_t num_blocks; - size_t max_blocks; - blk_info_t *blocks; sqfs_compressor_t *cmp; sqfs_block_t *frag_block; + bool notify_threads; + sqfs_block_writer_t *wr; const sqfs_block_hooks_t *hooks; void *user_ptr; - bool notify_threads; /* file API */ sqfs_inode_generic_t *inode; -- cgit v1.2.3