summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAravind Ramesh <Aravind.Ramesh@wdc.com>2022-08-18 11:06:48 +0200
committerAravind <aravind.ramesh@wdc.com>2022-09-02 07:07:05 +0200
commit9675c48d90627971c4ce94da3302fdcf9c63f8e5 (patch)
tree2267ec30ecd581b9aae926926010522e434aa325 /src
parentcrimson/zns: segment_close() should finish the zone. (diff)
downloadceph-9675c48d90627971c4ce94da3302fdcf9c63f8e5.tar.xz
ceph-9675c48d90627971c4ce94da3302fdcf9c63f8e5.zip
crimson/zns: ZNSSegmentManager::release() should reset the zone.
For a ZNS device, a open/full zone has to be reset before it can be reused to write from start. Seastore releases a segment/zone and marks it empty and expects to be able to write to it from start. So as a part of release reset the zone, so it moves to empty state on the device. Signed-off-by: Aravind Ramesh <aravind.ramesh@wdc.com>
Diffstat (limited to 'src')
-rw-r--r--src/crimson/os/seastore/segment_manager/zns.cc32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/crimson/os/seastore/segment_manager/zns.cc b/src/crimson/os/seastore/segment_manager/zns.cc
index a27d3784ff1..27dc1aed314 100644
--- a/src/crimson/os/seastore/segment_manager/zns.cc
+++ b/src/crimson/os/seastore/segment_manager/zns.cc
@@ -475,7 +475,7 @@ blk_close_zone_ret blk_close_zone(
return device.ioctl(
BLKCLOSEZONE,
&range
- ).then_wrapped([=](auto f) -> blk_open_zone_ret{
+ ).then_wrapped([=](auto f) -> blk_open_zone_ret {
if (f.failed()) {
return crimson::ct_error::input_output_error::make();
}
@@ -490,10 +490,38 @@ blk_close_zone_ret blk_close_zone(
});
}
+using blk_reset_zone_ertr = crimson::errorator<
+ crimson::ct_error::input_output_error>;
+using blk_reset_zone_ret = blk_reset_zone_ertr::future<>;
+blk_reset_zone_ret blk_reset_zone(
+ seastar::file &device,
+ blk_zone_range &range)
+{
+ LOG_PREFIX(ZNSSegmentManager::blk_reset_zone);
+ return device.ioctl(
+ BLKRESETZONE,
+ &range
+ ).then_wrapped([=](auto f) -> blk_reset_zone_ret {
+ if (f.failed()) {
+ DEBUG("BLKRESETZONE ioctl failed");
+ return crimson::ct_error::input_output_error::make();
+ } else {
+ int ret = f.get();
+ if (ret == 0) {
+ return seastar::now();
+ } else {
+ DEBUG("BLKRESETZONE ioctl failed with return code {}", ret);
+ return crimson::ct_error::input_output_error::make();
+ }
+ }
+ });
+}
+
ZNSSegmentManager::release_ertr::future<> ZNSSegmentManager::release(
segment_id_t id)
{
LOG_PREFIX(ZNSSegmentManager::release);
+ DEBUG("Resetting zone/segment {}", id);
return seastar::do_with(
blk_zone_range{},
[=](auto &range) {
@@ -501,7 +529,7 @@ ZNSSegmentManager::release_ertr::future<> ZNSSegmentManager::release(
id,
metadata.segment_size,
metadata.first_segment_offset);
- return blk_close_zone(
+ return blk_reset_zone(
device,
range
);