aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mkfs_ext2.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/mkfs_ext2.c')
-rw-r--r--util-linux/mkfs_ext2.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index 5d5429f07..380312bca 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -256,8 +256,9 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
256 if (nblocks != kilobytes) 256 if (nblocks != kilobytes)
257 bb_error_msg_and_die("block count doesn't fit in 32 bits"); 257 bb_error_msg_and_die("block count doesn't fit in 32 bits");
258#define kilobytes kilobytes_unused_after_this 258#define kilobytes kilobytes_unused_after_this
259 if (blocksize < PAGE_SIZE) 259//compat problem
260 nblocks &= ~((PAGE_SIZE >> blocksize_log2)-1); 260// if (blocksize < PAGE_SIZE)
261// nblocks &= ~((PAGE_SIZE >> blocksize_log2)-1);
261 // Experimentally, standard mke2fs won't work on images smaller than 60k 262 // Experimentally, standard mke2fs won't work on images smaller than 60k
262 if (nblocks < 60) 263 if (nblocks < 60)
263 bb_error_msg_and_die("need >= 60 blocks"); 264 bb_error_msg_and_die("need >= 60 blocks");
@@ -307,7 +308,7 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
307 { 308 {
308 // N.B. e2fsprogs does as follows! 309 // N.B. e2fsprogs does as follows!
309 // ninodes is the total number of inodes (files) in the file system 310 // ninodes is the total number of inodes (files) in the file system
310 uint32_t ninodes = nblocks_full / (blocksize >= 4096 ? 1 : 4096 / blocksize); 311 uint32_t ninodes = ((uint64_t) nblocks_full * blocksize) / bytes_per_inode;
311 uint32_t overhead, remainder; 312 uint32_t overhead, remainder;
312 if (ninodes < EXT2_GOOD_OLD_FIRST_INO+1) 313 if (ninodes < EXT2_GOOD_OLD_FIRST_INO+1)
313 ninodes = EXT2_GOOD_OLD_FIRST_INO+1; 314 ninodes = EXT2_GOOD_OLD_FIRST_INO+1;