}
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;
});
}
- static seastar::future<DeviceRef> make_device(const std::string &device);
+ static seastar::future<DeviceRef> make_device(
+ const std::string &device,
+ device_type_t dtype);
};
}
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 {
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(
const ConfigValues &config)
{
return Device::make_device(
- device
+ device, device_type_t::SSD
).then([&device](DeviceRef device_obj) {
#ifndef NDEBUG
bool is_test = true;
{
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;
{
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();