diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-20 17:04:55 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-20 17:04:55 +0200 |
commit | 82d6433abe251d8d7a43417af392b638f868afe5 (patch) | |
tree | a83c1ad9ff094ea924febac292d7dafbf31cf830 /util-linux/mkfs_ext2.c | |
parent | cbeb4528247cca8eb1aa6c5d7e43778ea6de1762 (diff) |
mkfs_ext2: fixes for small image generation. images up to ~8M are ok now
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mkfs_ext2.c')
-rw-r--r-- | util-linux/mkfs_ext2.c | 7 |
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) if (nblocks != kilobytes) bb_error_msg_and_die("block count doesn't fit in 32 bits"); #define kilobytes kilobytes_unused_after_this - if (blocksize < PAGE_SIZE) - nblocks &= ~((PAGE_SIZE >> blocksize_log2)-1); +//compat problem +// if (blocksize < PAGE_SIZE) +// nblocks &= ~((PAGE_SIZE >> blocksize_log2)-1); // Experimentally, standard mke2fs won't work on images smaller than 60k if (nblocks < 60) bb_error_msg_and_die("need >= 60 blocks"); @@ -307,7 +308,7 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv) { // N.B. e2fsprogs does as follows! // ninodes is the total number of inodes (files) in the file system - uint32_t ninodes = nblocks_full / (blocksize >= 4096 ? 1 : 4096 / blocksize); + uint32_t ninodes = ((uint64_t) nblocks_full * blocksize) / bytes_per_inode; uint32_t overhead, remainder; if (ninodes < EXT2_GOOD_OLD_FIRST_INO+1) ninodes = EXT2_GOOD_OLD_FIRST_INO+1; |