]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/segment_manager: respect len parameter of BlockSegmentManager...
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 22 Jul 2021 07:28:40 +0000 (15:28 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Thu, 22 Jul 2021 07:28:40 +0000 (15:28 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/segment_manager/block.cc

index 26a2ed4742b24c2d8e5150def5c891a14d58be15..7a5a1f3b617aaa17946d1f3a601fbff125623d29 100644 (file)
@@ -84,23 +84,25 @@ static write_ertr::future<> do_writev(
 static read_ertr::future<> do_read(
   seastar::file &device,
   uint64_t offset,
+  size_t len,
   bufferptr &bptr)
 {
+  assert(len <= bptr.length());
   logger().debug(
     "block: do_read offset {} len {}",
     offset,
-    bptr.length());
+    len);
   return device.dma_read(
     offset,
     bptr.c_str(),
-    bptr.length()
+    len
   ).handle_exception([](auto e) -> read_ertr::future<size_t> {
     logger().error(
       "do_read: dma_read got error {}",
       e);
     return crimson::ct_error::input_output_error::make();
-  }).then([length=bptr.length()](auto result) -> read_ertr::future<> {
-    if (result != length) {
+  }).then([len](auto result) -> read_ertr::future<> {
+    if (result != len) {
       return crimson::ct_error::input_output_error::make();
     }
     return read_ertr::now();
@@ -123,6 +125,7 @@ SegmentStateTracker::read_in(
   return do_read(
     device,
     offset,
+    bptr.length(),
     bptr);
 }
 
@@ -285,6 +288,7 @@ read_superblock(seastar::file &device, seastar::stat_data sd)
       return do_read(
        device,
        0,
+       bp.length(),
        bp
       ).safe_then([=, &bp] {
          bufferlist bl;
@@ -500,6 +504,7 @@ SegmentManager::read_ertr::future<> BlockSegmentManager::read(
   return do_read(
     device,
     get_offset(addr),
+    len,
     out);
 }