From 99e40a1e87c44705ffdb557d57bd54eaff31cfe3 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Tue, 9 Feb 2021 18:37:41 +0300 Subject: [PATCH] os/bluestore: permit legacy omap naming scheme in mkfs. Primarily for debug purposes... Signed-off-by: Igor Fedotov --- src/common/options/global.yaml.in | 9 +++++++++ src/os/bluestore/BlueStore.cc | 11 ++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/common/options/global.yaml.in b/src/common/options/global.yaml.in index 38b95313bc96d..ed529f18fe0b2 100644 --- a/src/common/options/global.yaml.in +++ b/src/common/options/global.yaml.in @@ -5020,6 +5020,15 @@ options: desc: inject crc verification errors into bluestore device reads default: 0 with_legacy: true +- name: bluestore_debug_legacy_omap + type: bool + level: dev + desc: Allows mkfs to create OSD in legacy OMAP naming mode (neither per-pool nor per-pg). + This is intended primarily for developers' purposes. The resulting OSD might/would + be transformed to the currrently default 'per-pg' format when BlueStore's quick-fix or + repair are applied. + default: false + with_legacy: true - name: bluestore_fsck_error_on_no_per_pool_stats type: bool level: advanced diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 4f59ebde508a5..e5d291b638034 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6410,9 +6410,10 @@ void BlueStore::_set_per_pool_omap() auto s = bl.to_str(); if (s == stringify(OMAP_PER_POOL)) { per_pool_omap = OMAP_PER_POOL; - } else { - ceph_assert(s == stringify(OMAP_PER_PG)); + } else if (s == stringify(OMAP_PER_PG)) { per_pool_omap = OMAP_PER_PG; + } else { + ceph_assert(s == stringify(OMAP_BULK)); } dout(10) << __func__ << " per_pool_omap = " << per_pool_omap << dendl; } else { @@ -6715,7 +6716,11 @@ int BlueStore::mkfs() } { bufferlist bl; - bl.append(stringify(OMAP_PER_PG)); + if (cct->_conf.get_val("bluestore_debug_legacy_omap")) { + bl.append(stringify(OMAP_BULK)); + } else { + bl.append(stringify(OMAP_PER_PG)); + } t->set(PREFIX_SUPER, "per_pool_omap", bl); } ondisk_format = latest_ondisk_format; -- 2.39.5