summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZhang Song <zhangsong325@gmail.com>2022-09-20 08:09:57 +0200
committerZhang Song <zhangsong325@gmail.com>2022-09-22 07:47:50 +0200
commitadff54fa7285b1a1daf416b3a3b89e4bec8a7df9 (patch)
treef1d5338bad51edb4fa52ebb117e9ac8d150087fe /src
parentcrimson/os/seastore: introduce get_backend_type to Device (diff)
downloadceph-adff54fa7285b1a1daf416b3a3b89e4bec8a7df9.tar.xz
ceph-adff54fa7285b1a1daf416b3a3b89e4bec8a7df9.zip
crimson/os/seastore: make device according to device type
Signed-off-by: Zhang Song <zhangsong325@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/crimson/os/seastore/device.cc5
-rw-r--r--src/crimson/os/seastore/device.h4
-rw-r--r--src/crimson/os/seastore/seastore.cc6
-rw-r--r--src/crimson/tools/store_nbd/tm_driver.cc4
4 files changed, 11 insertions, 8 deletions
diff --git a/src/crimson/os/seastore/device.cc b/src/crimson/os/seastore/device.cc
index 6eab7a27e2e..e28673dd06c 100644
--- a/src/crimson/os/seastore/device.cc
+++ b/src/crimson/os/seastore/device.cc
@@ -31,9 +31,10 @@ std::ostream& operator<<(std::ostream& out, const device_config_t& conf)
}
seastar::future<DeviceRef>
-Device::make_device(const std::string& device)
+Device::make_device(const std::string& device, device_type_t dtype)
{
- // TODO: configure device type
+ // TODO: support other backend types
+ assert(get_default_backend_of_device(dtype) == backend_type_t::SEGMENTED);
return SegmentManager::get_segment_manager(device
).then([](DeviceRef ret) {
return ret;
diff --git a/src/crimson/os/seastore/device.h b/src/crimson/os/seastore/device.h
index 814413aec3e..c9395cba408 100644
--- a/src/crimson/os/seastore/device.h
+++ b/src/crimson/os/seastore/device.h
@@ -116,7 +116,9 @@ public:
});
}
- static seastar::future<DeviceRef> make_device(const std::string &device);
+ static seastar::future<DeviceRef> make_device(
+ const std::string &device,
+ device_type_t dtype);
};
}
diff --git a/src/crimson/os/seastore/seastore.cc b/src/crimson/os/seastore/seastore.cc
index 0c9514e665a..4879ed3e437 100644
--- a/src/crimson/os/seastore/seastore.cc
+++ b/src/crimson/os/seastore/seastore.cc
@@ -179,7 +179,7 @@ SeaStore::mount_ertr::future<> SeaStore::mount()
device_type_t dtype = device_entry.second.dtype;
std::ostringstream oss;
oss << root << "/block." << dtype << "." << std::to_string(id);
- return Device::make_device(oss.str()
+ return Device::make_device(oss.str(), dtype
).then([this, magic](DeviceRef sec_dev) {
return sec_dev->mount(
).safe_then([this, sec_dev=std::move(sec_dev), magic]() mutable {
@@ -283,7 +283,7 @@ SeaStore::mkfs_ertr::future<> SeaStore::mkfs(uuid_d new_osd_fsid)
auto id = std::stoi(entry_name.substr(dtype_end + 1));
std::ostringstream oss;
oss << root << "/" << entry_name;
- return Device::make_device(oss.str()
+ return Device::make_device(oss.str(), dtype
).then([this, &sds, id, dtype, new_osd_fsid](DeviceRef sec_dev) {
magic_t magic = (magic_t)std::rand();
sds.emplace(
@@ -1882,7 +1882,7 @@ seastar::future<std::unique_ptr<SeaStore>> make_seastore(
const ConfigValues &config)
{
return Device::make_device(
- device
+ device, device_type_t::SSD
).then([&device](DeviceRef device_obj) {
#ifndef NDEBUG
bool is_test = true;
diff --git a/src/crimson/tools/store_nbd/tm_driver.cc b/src/crimson/tools/store_nbd/tm_driver.cc
index 060016822f2..7df85d1b2d1 100644
--- a/src/crimson/tools/store_nbd/tm_driver.cc
+++ b/src/crimson/tools/store_nbd/tm_driver.cc
@@ -153,7 +153,7 @@ seastar::future<> TMDriver::mkfs()
{
assert(config.path);
logger().debug("mkfs");
- return Device::make_device(*config.path
+ return Device::make_device(*config.path, device_type_t::SSD
).then([this](DeviceRef dev) {
device = std::move(dev);
seastore_meta_t meta;
@@ -195,7 +195,7 @@ seastar::future<> TMDriver::mount()
{
return (config.mkfs ? mkfs() : seastar::now()
).then([this] {
- return Device::make_device(*config.path);
+ return Device::make_device(*config.path, device_type_t::SSD);
}).then([this](DeviceRef dev) {
device = std::move(dev);
return device->mount();