summaryrefslogtreecommitdiff
path: root/ext4_utils
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2018-06-08 11:40:34 +0200
committerDanny Baumann <dannybaumann@web.de>2018-06-08 11:51:58 +0200
commitfa4cb054abfb8fb59b5dd06fb0785fb370748c57 (patch)
tree6fbe80a79837caeb1017aea1142f2e3dc9ccce8b /ext4_utils
parent74a0ea22636b44a2748a8baed44b8883bfbc42db (diff)
downloadextras-fa4cb054abfb8fb59b5dd06fb0785fb370748c57.tar.gz
ext4_utils: Fix FS creation for filesystems with exactly 32768 blocks.
In that case, total block count matches number of blocks per group, which yields precisely 1 group. last_group_size in that case was calculated as 0, which together with group count 1 incorrectly triggered the file size check. Special case that scenario by assigning last_group_size as 32768 in that case. Change-Id: I3b6e236a4d6951aca732324b85e46b8c4b5757b7
Diffstat (limited to 'ext4_utils')
-rw-r--r--ext4_utils/ext4_utils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext4_utils/ext4_utils.c b/ext4_utils/ext4_utils.c
index 86098519..36830ba2 100644
--- a/ext4_utils/ext4_utils.c
+++ b/ext4_utils/ext4_utils.c
@@ -217,7 +217,8 @@ void ext4_create_fs_aux_info()
aux_info.default_i_flags = EXT4_NOATIME_FL;
- u32 last_group_size = aux_info.len_blocks % info.blocks_per_group;
+ u32 last_group_size = aux_info.len_blocks == info.blocks_per_group
+ ? aux_info.len_blocks : aux_info.len_blocks % info.blocks_per_group;
u32 last_header_size = 2 + aux_info.inode_table_blocks;
if (ext4_bg_has_super_block(aux_info.groups - 1))
last_header_size += 1 + aux_info.bg_desc_blocks +