From: Jinyong Ha Date: Thu, 14 Oct 2021 02:27:33 +0000 (+0900) Subject: seastore : add atomic write unit interface X-Git-Tag: v17.1.0~359^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=52e2d05320684a01aa5a60584353223992893adb;p=ceph.git seastore : add atomic write unit interface Atomic Write Unit from SSD is maximum write IO size whose atomicity is guaranteed by SSD. Write IO smaller than this value does not require syncronization such as fsync(). Even after power state is changed, the atomicity is guaranteed. Signed-off-by: Jinyong Ha --- diff --git a/src/crimson/os/seastore/random_block_manager/nvmedevice.cc b/src/crimson/os/seastore/random_block_manager/nvmedevice.cc index 1949aca7248..84b1353d4b9 100644 --- a/src/crimson/os/seastore/random_block_manager/nvmedevice.cc +++ b/src/crimson/os/seastore/random_block_manager/nvmedevice.cc @@ -36,11 +36,13 @@ open_ertr::future<> PosixNVMeDevice::open( if (support_multistream) { stream_id_count = WRITE_LIFE_MAX; } + awupf = id_controller_data.awupf + 1; return identify_namespace().safe_then([this, in_path, mode] ( auto id_namespace_data) { // LBA format provides LBA size which is power of 2. LBA is the // minimum size of read and write. block_size = (1 << id_namespace_data.lbaf0.lbads); + atomic_write_unit = awupf * block_size; data_protection_type = id_namespace_data.dps.protection_type; data_protection_enabled = (data_protection_type > 0); if (id_namespace_data.nsfeat.opterf == 1){ diff --git a/src/crimson/os/seastore/random_block_manager/nvmedevice.h b/src/crimson/os/seastore/random_block_manager/nvmedevice.h index 2b3e99f53da..f54eb10db7e 100644 --- a/src/crimson/os/seastore/random_block_manager/nvmedevice.h +++ b/src/crimson/os/seastore/random_block_manager/nvmedevice.h @@ -95,8 +95,10 @@ struct oacs_t { struct nvme_identify_controller_data_t { union { struct { - uint8_t unused[256]; - oacs_t oacs; + uint8_t unused[256]; // [255:0] + oacs_t oacs; // [257:256] + uint8_t unused2[270]; // [527:258] + uint16_t awupf; // [529:528] }; uint8_t raw[4096]; }; @@ -236,6 +238,7 @@ protected: uint64_t write_granularity = 4096; uint64_t write_alignment = 4096; + uint32_t atomic_write_unit = 4096; bool data_protection_enabled = false; @@ -260,6 +263,9 @@ public: * size for write in byte. Caller should request every write IO sized multiple * times of PWG and aligned starting address by PWA. Available only if NVMe * Device supports NVMe protocol 1.4 or later versions. + * atomic_write_unit : The maximum size of write whose atomicity is guranteed + * by SSD even on power failure. The write equal to or smaller than + * atomic_write_unit does not require fsync(). */ uint64_t get_size() const { return size; } uint64_t get_block_size() const { return block_size; } @@ -267,6 +273,8 @@ public: uint64_t get_preffered_write_granularity() const { return write_granularity; } uint64_t get_preffered_write_alignment() const { return write_alignment; } + uint64_t get_atomic_write_unit() const { return atomic_write_unit; } + virtual read_ertr::future<> read( uint64_t offset, bufferptr &bptr) = 0; @@ -395,6 +403,7 @@ private: std::vector io_device; uint32_t stream_index_to_open = WRITE_LIFE_NOT_SET; uint32_t stream_id_count = 1; // stream is disabled, defaultly. + uint32_t awupf = 0; };