]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: use in-class initialization 30737/head
authorKefu Chai <kchai@redhat.com>
Sun, 6 Oct 2019 10:08:24 +0000 (18:08 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 6 Oct 2019 15:59:44 +0000 (23:59 +0800)
for better readability

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/os/bluestore/BlockDevice.h
src/os/bluestore/BlueFS.h

index ee1afc63109bcb4d2eaa256d0135e313e0639809..0ef84b91b627aab3e17b9dc5d594e6002d403efc 100644 (file)
@@ -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)
  {}
index 683e99237048892e0c68423a8f24c5de3c761666..35697b667f63c323101744baf414ec2d67815665 100644 (file)
@@ -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;