From 2c661f100fbe6c13e7aaef2ea3c9bef546246bb2 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 11 Jun 2019 00:46:19 +0200 Subject: cleanup: remove the linked list of fragment relations Don't need that, we already know the index when we write add the fragment. Signed-off-by: David Oberhollenzer --- include/fstree.h | 8 -------- mkfs/block.c | 8 +------- mkfs/mkfs.h | 1 - 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/include/fstree.h b/include/fstree.h index ef2ffb1..3979503 100644 --- a/include/fstree.h +++ b/include/fstree.h @@ -55,14 +55,6 @@ struct file_info_t { /* Path to the input file. */ char *input_file; - /* Linked list pointer for aggregating fragments - - When writing out data blocks, files that don't have a multiple of - the block size have their tail ends gathered in a fragment block. - A linked list is used to keep track of which files share the same - fragment block. */ - file_info_t *frag_next; - uint64_t size; /* Absolute position of the first data block. */ diff --git a/mkfs/block.c b/mkfs/block.c index fadf9b9..eba8c24 100644 --- a/mkfs/block.c +++ b/mkfs/block.c @@ -43,7 +43,6 @@ static int write_block(file_info_t *fi, sqfs_info_t *info) static int flush_fragments(sqfs_info_t *info) { size_t newsz, size; - file_info_t *fi; uint64_t offset; void *new, *ptr; ssize_t ret; @@ -65,9 +64,6 @@ static int flush_fragments(sqfs_info_t *info) offset = info->super.bytes_used; size = info->frag_offset; - for (fi = info->frag_list; fi != NULL; fi = fi->frag_next) - fi->fragment = info->num_fragments; - ret = info->cmp->do_block(info->cmp, info->fragment, size, info->scratch, info->super.block_size); if (ret < 0) @@ -103,7 +99,6 @@ static int flush_fragments(sqfs_info_t *info) info->super.bytes_used += size; info->frag_offset = 0; - info->frag_list = NULL; info->super.flags &= ~SQFS_FLAG_NO_FRAGMENTS; info->super.flags |= SQFS_FLAG_ALWAYS_FRAGMENTS; @@ -118,8 +113,7 @@ static int add_fragment(file_info_t *fi, sqfs_info_t *info, size_t size) } fi->fragment_offset = info->frag_offset; - fi->frag_next = info->frag_list; - info->frag_list = fi; + fi->fragment = info->num_fragments; memcpy((char *)info->fragment + info->frag_offset, info->block, size); info->frag_offset += size; diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h index d79b852..c4cd8a1 100644 --- a/mkfs/mkfs.h +++ b/mkfs/mkfs.h @@ -49,7 +49,6 @@ typedef struct { size_t max_fragments; int file_block_count; - file_info_t *frag_list; size_t frag_offset; id_table_t idtbl; -- cgit v1.2.3