From 310fd9ced4e60d83d4f93ebf45f05654eff408cb Mon Sep 17 00:00:00 2001 From: Artem Blagodarenko Date: Wed, 27 Jul 2016 18:05:58 +0300 Subject: [PATCH] LU-8443 utils: exclude "resize" parameter with meta_bg option Partitions with size > 256TB must use meta_bg option. This option is not compatible with "resize_inode" option and "resize" extended option. For optimization reason "resize" option is enabled by default. For filesystems with < 2^32 blocks this optimization is useless. This patch disables resize option if meta_bg is enabled. The test that formats Lustre FS with "^resize_inode,meta_bg" options on OST added. Signed-off-by: Artem Blagodarenko Seagate-bug-id: MRP-3647 Change-Id: Ibea2d18f79498636a165a682cf6b6435f7cebfba Reviewed-on: http://review.whamcloud.com/21545 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- lustre/tests/conf-sanity.sh | 31 +++++++++++++++++++++++++++++++ lustre/utils/mount_utils_ldiskfs.c | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index c64ebab..2162a5b 100755 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -6796,6 +6796,37 @@ test_97() { } run_test 97 "ldev returns correct ouput when querying based on role" +test_99() +{ + [[ $(facet_fstype ost1) != ldiskfs ]] && + { skip "Only applicable to ldiskfs-based OSTs" && return; } + + local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \ + --reformat $(ostdevname 1) $(ostvdevname 1)" + do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" && + skip "meta_bg already set" && return + + local opts=ost_opts + if [[ ${!opts} != *mkfsoptions* ]]; then + eval opts=\"${!opts} \ + --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\" + else + local val=${!opts//--mkfsoptions=\\\"/ \ + --mkfsoptions=\\\"-O ^resize_inode,meta_bg } + eval opts='${val}' + fi + + echo "params: $opts" + + add ost1 $opts || error "add ost1 failed with new params" + + do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" || + error "meta_bg is not set" + + return 0 +} +run_test 99 "Adding meta_bg option" + if ! combined_mgs_mds ; then stop mgs fi diff --git a/lustre/utils/mount_utils_ldiskfs.c b/lustre/utils/mount_utils_ldiskfs.c index 3e50ae7..9576e66 100644 --- a/lustre/utils/mount_utils_ldiskfs.c +++ b/lustre/utils/mount_utils_ldiskfs.c @@ -889,7 +889,8 @@ int ldiskfs_make_lustre(struct mkfs_opts *mop) * descriptor blocks, but leave one block for the superblock. * Only useful for filesystems with < 2^32 blocks due to resize * limitations. */ - if (IS_OST(&mop->mo_ldd) && mop->mo_device_kb > 100 * 1024 && + if (strstr(mop->mo_mkfsopts, "meta_bg") == NULL && + IS_OST(&mop->mo_ldd) && mop->mo_device_kb > 100 * 1024 && mop->mo_device_kb * 1024 / L_BLOCK_SIZE <= 0xffffffffULL) { unsigned group_blocks = L_BLOCK_SIZE * 8; unsigned desc_per_block = L_BLOCK_SIZE / 32; -- 1.8.3.1