From: Kefu Chai Date: Sun, 6 Oct 2019 10:08:24 +0000 (+0800) Subject: os/bluestore: use in-class initialization X-Git-Tag: v15.1.0~1264^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=be1f8549b4b42c3b996357eef2800e9734b32771;p=ceph.git os/bluestore: use in-class initialization for better readability Signed-off-by: Kefu Chai --- diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index ee1afc63109..0ef84b91b62 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -138,8 +138,8 @@ private: std::atomic_int ioc_reap_count = {0}; protected: - uint64_t size; - uint64_t block_size; + uint64_t size = 0; + uint64_t block_size = 0; bool support_discard = false; bool rotational = true; bool lock_exclusive = true; @@ -149,8 +149,6 @@ public: void *aio_callback_priv; BlockDevice(CephContext* cct, aio_callback_t cb, void *cbpriv) : cct(cct), - size(0), - block_size(0), aio_callback(cb), aio_callback_priv(cbpriv) {} diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 683e9923704..35697b667f6 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -194,20 +194,18 @@ public: struct FileReaderBuffer { MEMPOOL_CLASS_HELPERS(); - uint64_t bl_off; ///< prefetch buffer logical offset + uint64_t bl_off = 0; ///< prefetch buffer logical offset bufferlist bl; ///< prefetch buffer - uint64_t pos; ///< current logical offset + uint64_t pos = 0; ///< current logical offset uint64_t max_prefetch; ///< max allowed prefetch explicit FileReaderBuffer(uint64_t mpf) - : bl_off(0), - pos(0), - max_prefetch(mpf) {} + : max_prefetch(mpf) {} - uint64_t get_buf_end() { + uint64_t get_buf_end() const { return bl_off + bl.length(); } - uint64_t get_buf_remaining(uint64_t p) { + uint64_t get_buf_remaining(uint64_t p) const { if (p >= bl_off && p < bl_off + bl.length()) return bl_off + bl.length() - p; return 0;