X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Flibmount_utils_ldiskfs.c;h=5907213061e83915c9cd144ced5c5622dbfdd553;hb=HEAD;hp=d548a2c4e18395fd3d70bdf9c7d23a6526dbdb06;hpb=ed80c3f64317a87ed10919cedbf2d65b36abcdcb;p=fs%2Flustre-release.git diff --git a/lustre/utils/libmount_utils_ldiskfs.c b/lustre/utils/libmount_utils_ldiskfs.c index d548a2c..1721bf9 100644 --- a/lustre/utils/libmount_utils_ldiskfs.c +++ b/lustre/utils/libmount_utils_ldiskfs.c @@ -416,7 +416,7 @@ static bool is_e2fsprogs_feature_supp(const char *feature) close(fd); - snprintf(cmd, sizeof(cmd), "%s -F %s %s 100 >/dev/null 2>&1", + snprintf(cmd, sizeof(cmd), "%s -F %s %s 200 >/dev/null 2>&1", MKE2FS, feature, imgname); /* run_command() displays the output of mke2fs when it fails for * some feature, so use system() directly */ @@ -472,21 +472,16 @@ static int enable_default_ext4_features(struct mkfs_opts *mop, char *anchor, if (blocks > 0xffffffffULL && is_e2fsprogs_feature_supp("-O 64bit")) enable_64bit = true; + append_unique(anchor, user_spec ? "," : " -O ", + "uninit_bg", NULL, maxbuflen); if (IS_OST(&mop->mo_ldd)) { - append_unique(anchor, user_spec ? "," : " -O ", - "extents", NULL, maxbuflen); - append_unique(anchor, ",", "uninit_bg", NULL, maxbuflen); + append_unique(anchor, ",", "extents", NULL, maxbuflen); } else if (IS_MDT(&mop->mo_ldd)) { - append_unique(anchor, user_spec ? "," : " -O ", - "dirdata", NULL, maxbuflen); - append_unique(anchor, ",", "uninit_bg", 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); + append_unique(anchor, ",", "dirdata", NULL, maxbuflen); } /* Multiple mount protection enabled only if failover node specified */ @@ -501,11 +496,6 @@ static int enable_default_ext4_features(struct mkfs_opts *mop, char *anchor, if (is_e2fsprogs_feature_supp("-O dir_nlink")) append_unique(anchor, ",", "dir_nlink", NULL, maxbuflen); - /* The following options are only valid for ext4-based ldiskfs. - * If --backfstype=ext3 is specified, do not enable them. */ - if (mop->mo_ldd.ldd_mount_type == LDD_MT_EXT3) - return 0; - /* Enable quota by default */ if (is_e2fsprogs_feature_supp("-O quota")) { append_unique(anchor, ",", "quota", NULL, maxbuflen); @@ -519,25 +509,21 @@ static int enable_default_ext4_features(struct mkfs_opts *mop, char *anchor, return EINVAL; } - /* Allow files larger than 2TB. Also needs LU-16, but not harmful. */ + /* Allow files larger than 2TB */ if (is_e2fsprogs_feature_supp("-O huge_file")) append_unique(anchor, ",", "huge_file", NULL, maxbuflen); - if (enable_64bit) + if (enable_64bit) { append_unique(anchor, ",", "64bit", NULL, maxbuflen); - - if (blocks >= 0x1000000000 && is_e2fsprogs_feature_supp("-O meta_bg")) - append_unique(anchor, ",", "meta_bg", NULL, maxbuflen); - - if (enable_64bit || strstr(mop->mo_mkfsopts, "meta_bg")) append_unique(anchor, ",", "^resize_inode", NULL, maxbuflen); + } /* Allow xattrs larger than one block, stored in a separate inode */ if (IS_MDT(&mop->mo_ldd) && is_e2fsprogs_feature_supp("-O ea_inode")) append_unique(anchor, ",", "ea_inode", NULL, maxbuflen); - /* Allow more than 10M directory entries */ - if (IS_MDT(&mop->mo_ldd) && is_e2fsprogs_feature_supp("-O large_dir")) + /* Allow more than 10M entries in a single directory */ + if (is_e2fsprogs_feature_supp("-O large_dir")) append_unique(anchor, ",", "large_dir", NULL, maxbuflen); /* Disable fast_commit since it breaks ldiskfs transactions ordering */ @@ -879,25 +865,33 @@ int ldiskfs_make_lustre(struct mkfs_opts *mop) unsigned int group_blocks = mop->mo_blocksize_kb * 8192; unsigned int desc_per_block = mop->mo_blocksize_kb * 1024 / 32; unsigned int resize_blks; + __u64 block_count = mop->mo_device_kb / mop->mo_blocksize_kb; resize_blks = (1ULL<<32) - desc_per_block*group_blocks; - snprintf(buf, sizeof(buf), "%u", resize_blks); - append_unique(start, ext_opts ? "," : " -E ", - "resize", buf, maxbuflen); - ext_opts = 1; + if (resize_blks > block_count) { + snprintf(buf, sizeof(buf), "%u", resize_blks); + append_unique(start, ext_opts ? "," : " -E ", + "resize", buf, maxbuflen); + ext_opts = 1; + } } /* Avoid zeroing out the full journal - speeds up mkfs */ - if (is_e2fsprogs_feature_supp("-E lazy_journal_init=0")) { + if (is_e2fsprogs_feature_supp("-E lazy_journal_init")) { append_unique(start, ext_opts ? "," : " -E ", - "lazy_journal_init", "0", maxbuflen); + "lazy_journal_init", NULL, maxbuflen); ext_opts = 1; } if (is_e2fsprogs_feature_supp("-E lazy_itable_init=0")) { - append_unique(start, ext_opts ? "," : "-E", + append_unique(start, ext_opts ? "," : " -E ", "lazy_itable_init", "0", maxbuflen); ext_opts = 1; } + if (is_e2fsprogs_feature_supp("-E packed_meta_blocks")) { + append_unique(start, ext_opts ? "," : " -E ", + "packed_meta_blocks", NULL, maxbuflen); + ext_opts = 1; + } /* end handle -E mkfs options */