From 99f3eaecb4ad3c85d791361c8857e6ba2be8f9ea Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 29 Sep 2019 00:38:04 +0200 Subject: Bring back the don't fragment flag Signed-off-by: David Oberhollenzer --- lib/sqfs/data_writer/fileapi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sqfs/data_writer/fileapi.c b/lib/sqfs/data_writer/fileapi.c index 2a5d02a..98bdf5c 100644 --- a/lib/sqfs/data_writer/fileapi.c +++ b/lib/sqfs/data_writer/fileapi.c @@ -56,7 +56,8 @@ static int flush_block(sqfs_data_writer_t *proc, sqfs_block_t *block) return 0; } - if (block->size < proc->max_block_size) { + if (block->size < proc->max_block_size && + !(block->flags & SQFS_BLK_DONT_FRAGMENT)) { block->flags |= SQFS_BLK_IS_FRAGMENT; } else { proc->inode->num_file_blocks += 1; @@ -124,9 +125,14 @@ int sqfs_data_writer_end_file(sqfs_data_writer_t *proc) return test_and_set_status(proc, SQFS_ERROR_INTERNAL); if (!(proc->blk_flags & SQFS_BLK_FIRST_BLOCK)) { - err = add_sentinel_block(proc); - if (err) - return err; + if (proc->blk_current != NULL && + (proc->blk_flags & SQFS_BLK_DONT_FRAGMENT)) { + proc->blk_flags |= SQFS_BLK_LAST_BLOCK; + } else { + err = add_sentinel_block(proc); + if (err) + return err; + } } if (proc->blk_current != NULL) { -- cgit v1.2.3