#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/utsname.h>
+#include <sys/sysmacros.h>
#include <string.h>
#include <getopt.h>
int ldiskfs_write_ldd(struct mkfs_opts *mop)
{
char mntpt[] = "/tmp/mntXXXXXX";
- char filepnm[128];
+ char filepnm[192];
char *dev;
FILE *filep;
int ret = 0;
static int enable_default_ext4_features(struct mkfs_opts *mop, char *anchor,
size_t maxbuflen, int user_spec)
{
+ int enable_64bit = 0;
+
+ /* Enable large block addresses if the LUN is over 2^32 blocks. */
+ if ((mop->mo_device_kb / (L_BLOCK_SIZE >> 10) > UINT32_MAX) &&
+ is_e2fsprogs_feature_supp("-O 64bit") == 0)
+ enable_64bit = 1;
+
if (IS_OST(&mop->mo_ldd)) {
append_unique(anchor, user_spec ? "," : " -O ",
"extents", NULL, maxbuflen);
append_unique(anchor, user_spec ? "," : " -O ",
"dirdata", NULL, maxbuflen);
append_unique(anchor, ",", "uninit_bg", NULL, maxbuflen);
- append_unique(anchor, ",", "^extents", NULL, maxbuflen);
+ if (enable_64bit)
+ append_unique(anchor, ",", "extents", NULL, maxbuflen);
+ else
+ append_unique(anchor, ",", "^extents", NULL, maxbuflen);
} else {
append_unique(anchor, user_spec ? "," : " -O ",
"uninit_bg", NULL, maxbuflen);
if (is_e2fsprogs_feature_supp("-O huge_file") == 0)
append_unique(anchor, ",", "huge_file", NULL, maxbuflen);
- /* Enable large block addresses if the LUN is over 2^32 blocks. */
- if (mop->mo_device_kb / (L_BLOCK_SIZE >> 10) >= 0x100002000ULL &&
- is_e2fsprogs_feature_supp("-O 64bit") == 0)
+ if (enable_64bit)
append_unique(anchor, ",", "64bit", NULL, maxbuflen);
/* Cluster inode/block bitmaps and inode table for more efficient IO.
sprintf(buf, " -i %ld", bytes_per_inode);
strscat(mop->mo_mkfsopts, buf,
sizeof(mop->mo_mkfsopts));
+ mop->mo_inode_size = bytes_per_inode;
}
}