From dfd212a014abb1ecafeb75e8aa1e74d4c76b94b5 Mon Sep 17 00:00:00 2001 From: optimistyzy Date: Wed, 4 Jan 2017 14:15:01 +0800 Subject: [PATCH] NVMEDevice: optimize sector_size usage spdk_nvme_ns_get_sector_size returns 32 bit size, so we just use 32 bit size for sector_size. Signed-off-by: optimistyzy --- src/os/bluestore/NVMEDevice.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/os/bluestore/NVMEDevice.cc b/src/os/bluestore/NVMEDevice.cc index 9bd45808e6f..0c8b8466ca5 100644 --- a/src/os/bluestore/NVMEDevice.cc +++ b/src/os/bluestore/NVMEDevice.cc @@ -150,7 +150,7 @@ class SharedDriverData { std::function run_func; uint64_t block_size = 0; - uint64_t sector_size = 0; + uint32_t sector_size = 0; uint64_t size = 0; std::vector registered_devices; friend class AioCompletionThread; @@ -198,13 +198,12 @@ class SharedDriverData { flush_lock("NVMEDevice::flush_lock"), flush_waiters(0), completed_op_seq(0), queue_op_seq(0) { - enum spdk_nvme_qprio qprio = SPDK_NVME_QPRIO_URGENT; sector_size = spdk_nvme_ns_get_sector_size(ns); - block_size = std::max(CEPH_PAGE_SIZE, spdk_nvme_ns_get_sector_size(ns)); - size = spdk_nvme_ns_get_sector_size(ns) * spdk_nvme_ns_get_num_sectors(ns); + block_size = std::max(CEPH_PAGE_SIZE, sector_size); + size = ((uint64_t)sector_size) * spdk_nvme_ns_get_num_sectors(ns); zero_command_support = spdk_nvme_ns_get_flags(ns) & SPDK_NVME_NS_WRITE_ZEROES_SUPPORTED; - qpair = spdk_nvme_ctrlr_alloc_io_qpair(c, qprio); + qpair = spdk_nvme_ctrlr_alloc_io_qpair(c, SPDK_NVME_QPRIO_URGENT); PerfCountersBuilder b(g_ceph_context, string("NVMEDevice-AIOThread-"+stringify(this)), l_bluestore_nvmedevice_first, l_bluestore_nvmedevice_last);