X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Flibmount_utils_ldiskfs.c;h=32b19a1440fb253c81cd0553322bd1cf1b5ce90e;hb=bf5e5a89f9f4680c42f768b8474a3ea0bc014b54;hp=c7a6aae502c5949632df7033f91c4fa5ed54b14e;hpb=1d3c585194a907addbe8be7a884cc28d51db4b48;p=fs%2Flustre-release.git diff --git a/lustre/utils/libmount_utils_ldiskfs.c b/lustre/utils/libmount_utils_ldiskfs.c index c7a6aae..32b19a1 100644 --- a/lustre/utils/libmount_utils_ldiskfs.c +++ b/lustre/utils/libmount_utils_ldiskfs.c @@ -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,27 +509,29 @@ 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")) + if (is_e2fsprogs_feature_supp("-O meta_bg")) + append_unique(anchor, ",", "meta_bg", NULL, maxbuflen); 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 */ + if (is_e2fsprogs_feature_supp("fast_commit")) + append_unique(anchor, ",", "^fast_commit", NULL, maxbuflen); + /* Cluster inode/block bitmaps and inode table for more efficient IO. * Align the flex groups on a 1MB boundary for better performance. */ /* This -O feature needs to go last, since it adds the "-G" option. */ @@ -875,23 +867,26 @@ 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")) { append_unique(start, ext_opts ? "," : " -E ", - "lazy_journal_init=0", NULL, maxbuflen); + "lazy_journal_init", "0", maxbuflen); ext_opts = 1; } if (is_e2fsprogs_feature_supp("-E lazy_itable_init=0")) { append_unique(start, ext_opts ? "," : "-E", - "lazy_itable_init=0", NULL, maxbuflen); + "lazy_itable_init", "0", maxbuflen); ext_opts = 1; }