From 88833a6277f305b6a03ff29d8e9ffe717ddb4045 Mon Sep 17 00:00:00 2001 From: Ken Sumrall Date: Wed, 13 Jul 2011 17:27:07 -0700 Subject: [PATCH] Round down the filesystem size to a multiple of the block size If it's not a multiple of the block size, then errors are generated when making sparse images. This doesn't change the size of the generated filesystem, because partial blocks are not included in the filesystem. Change-Id: Ifc00ef7961f651ce22c6400759eadce2775d7811 --- ext4_utils/make_ext4fs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c index 298a02af..dbffc8d1 100644 --- a/ext4_utils/make_ext4fs.c +++ b/ext4_utils/make_ext4fs.c @@ -278,6 +278,9 @@ int make_ext4fs_internal(const char *filename, const char *directory, if (info.block_size <= 0) info.block_size = compute_block_size(); + /* Round down the filesystem length to be a multiple of the block size */ + info.len &= ~((u64)info.block_size - 1); + if (info.journal_blocks == 0) info.journal_blocks = compute_journal_blocks(); -- 2.11.0