From: Jianxin Li Date: Mon, 31 Oct 2022 08:03:01 +0000 (+0000) Subject: crimson/os/seastore/segment_manager/block: get block device size X-Git-Tag: v18.1.0~918^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=841a58b7f52a8cb14222092c3da330410400b1ab;p=ceph-ci.git crimson/os/seastore/segment_manager/block: get block device size Previously the file_stat(::stat) can not get correct size for block devices. Now call the file.size(using ::lseek) to replace it. Signed-off-by: Jianxin Li --- diff --git a/src/crimson/os/seastore/segment_manager/block.cc b/src/crimson/os/seastore/segment_manager/block.cc index e6888ba813c..d0c34f36d82 100644 --- a/src/crimson/os/seastore/segment_manager/block.cc +++ b/src/crimson/os/seastore/segment_manager/block.cc @@ -310,9 +310,13 @@ open_device_ret open_device( return seastar::open_file_dma( path, seastar::open_flags::rw | seastar::open_flags::dsync - ).then([=, &path](auto file) { - INFO("path={} successful, size={}", path, stat.size); - return std::make_pair(file, stat); + ).then([stat, &path, FNAME](auto file) mutable { + return file.size().then([stat, file, &path, FNAME](auto size) mutable { + stat.size = size; + INFO("path={} successful, size={}, block_size={}", + path, stat.size, stat.block_size); + return std::make_pair(file, stat); + }); }); }).handle_exception([FNAME, &path](auto e) -> open_device_ret { ERROR("path={} got error -- {}", path, e);