From: Radoslaw Zarzynski Date: Wed, 4 Sep 2019 06:24:04 +0000 (+0200) Subject: os/bluestore: bluefs_layout_t tracks WAL presence. X-Git-Tag: v15.1.0~1641^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=12390f4af8ac026bd32d7e3f4182f00070f58992;p=ceph.git os/bluestore: bluefs_layout_t tracks WAL presence. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 20e51d5bb728..6e5a135bf0ef 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5200,7 +5200,7 @@ int BlueStore::_minimal_open_bluefs(bool create) bluefs->get_block_device_size(BlueFS::BDEV_DB) - SUPER_RESERVED); } bluefs_layout.shared_bdev = BlueFS::BDEV_SLOW; - bluefs_layout.single_shared_device = false; + bluefs_layout.dedicated_db = true; } else { r = -errno; if (::lstat(bfn.c_str(), &st) == -1) { @@ -5278,7 +5278,7 @@ int BlueStore::_minimal_open_bluefs(bool create) bluefs->get_block_device_size(BlueFS::BDEV_WAL) - BDEV_LABEL_BLOCK_SIZE); } - bluefs_layout.single_shared_device = false; + bluefs_layout.dedicated_wal = true; } else { r = 0; if (::lstat(bfn.c_str(), &st) != -1) { @@ -8321,8 +8321,13 @@ void BlueStore::collect_metadata(map *pm) bdev->collect_metadata("bluestore_bdev_", pm); if (bluefs) { (*pm)["bluefs"] = "1"; + // this value is for backward compatibility only (*pm)["bluefs_single_shared_device"] = \ - stringify((int)bluefs_layout.single_shared_device); + stringify((int)bluefs_layout.single_shared_device()); + (*pm)["bluefs_dedicated_db"] = \ + stringify((int)bluefs_layout.dedicated_db); + (*pm)["bluefs_dedicated_wal"] = \ + stringify((int)bluefs_layout.dedicated_wal); bluefs->collect_metadata(pm, bluefs_layout.shared_bdev); } else { (*pm)["bluefs"] = "0"; @@ -10879,7 +10884,7 @@ void BlueStore::_kv_sync_thread() // can rely on the bluefs commit to flush the device and make // deferred aios stable. that means that if we do have done deferred // txcs AND we are not on a single device, we need to force a flush. - if (bluefs_layout.single_shared_device && bluefs) { + if (bluefs && bluefs_layout.single_shared_device()) { if (aios) { force_flush = true; } else if (kv_committing.empty() && deferred_stable.empty()) { diff --git a/src/os/bluestore/bluefs_types.h b/src/os/bluestore/bluefs_types.h index 985119822b57..9046e511d9d0 100644 --- a/src/os/bluestore/bluefs_types.h +++ b/src/os/bluestore/bluefs_types.h @@ -131,8 +131,13 @@ WRITE_CLASS_DENC(bluefs_fnode_t) ostream& operator<<(ostream& out, const bluefs_fnode_t& file); struct bluefs_layout_t { - unsigned shared_bdev = 0; ///< which bluefs bdev we are sharing - bool single_shared_device = true; + unsigned shared_bdev = 0; ///< which bluefs bdev we are sharing + bool dedicated_db = false; ///< whether block.db is present + bool dedicated_wal = false; ///< whether block.wal is present + + bool single_shared_device() const { + return !dedicated_db && !dedicated_wal; + } }; struct bluefs_super_t {