]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
seastore: move value initialization to the default constructor
authormyoungwon oh <ohmyoungwon@gmail.com>
Sat, 9 Apr 2022 12:24:49 +0000 (21:24 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 19 May 2022 00:31:22 +0000 (09:31 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/journal/circular_bounded_journal.cc
src/crimson/os/seastore/journal/circular_bounded_journal.h

index 9d9386f3a4374732f1b203f817f313a693292ffb..cc45e933c4bb8966b58e003a3972f45900cd9515 100644 (file)
@@ -50,23 +50,14 @@ CircularBoundedJournal::mkfs(const mkfs_config_t& config)
       device->get_block_size());
     ceph::bufferlist bl;
     CircularBoundedJournal::cbj_header_t head;
-    head.magic = CBJOURNAL_MAGIC;
-    head.uuid = uuid_d(); // TODO
     head.block_size = config.block_size;
     rbm_abs_addr end_addr = convert_paddr_to_abs_addr(
       config.end);
     head.size = end_addr - start_addr
       - device->get_block_size();
-    head.used_size = 0;
-    head.error = 0;
     head.start_offset = device->get_block_size();
-    head.last_committed_record_base = 0;
     head.written_to = head.start_offset;
     head.applied_to = head.start_offset;
-    head.flag = 0;
-    head.csum_type = 0;
-    head.csum = 0;
-    head.cur_segment_seq = 0;
     head.start = start_addr;
     head.end = end_addr;
     head.device_id = config.device_id;
index be0abce6399df80145fc2c65329044835e83419c..94b923bc9cd1e0f7072092f689ea01c1f612b5df 100644 (file)
@@ -185,25 +185,25 @@ public:
    */
 
   struct cbj_header_t {
-    uint64_t magic;
+    uint64_t magic = CBJOURNAL_MAGIC;
     uuid_d uuid;
-    uint64_t block_size; // aligned with block_size
-    uint64_t size;   // max length of journal
-    uint64_t used_size;  // current used_size of journal
-    uint32_t error;      // reserved
-
-    rbm_abs_addr start_offset;      // start offset of CircularBoundedJournal
-    rbm_abs_addr last_committed_record_base;
-    rbm_abs_addr written_to;
-    rbm_abs_addr applied_to;
-
-    uint64_t flag;       // represent features (reserved)
-    uint8_t csum_type;   // type of checksum algoritghm used in cbj_header_t
-    uint64_t csum;       // checksum of entire cbj_header_t
-    uint32_t cur_segment_seq;
-
-    rbm_abs_addr start; // start address of the device
-    rbm_abs_addr end;   // start address of the device
+    uint64_t block_size = 0; // aligned with block_size
+    uint64_t size = 0;   // max length of journal
+    uint64_t used_size = 0;  // current used_size of journal
+    uint32_t error = 0;      // reserved
+
+    rbm_abs_addr start_offset = 0;      // start offset of CircularBoundedJournal
+    rbm_abs_addr last_committed_record_base = 0;
+    rbm_abs_addr written_to = 0;
+    rbm_abs_addr applied_to = 0;
+
+    uint64_t flag = 0;       // represent features (reserved)
+    uint8_t csum_type = 0;   // type of checksum algoritghm used in cbj_header_t
+    uint64_t csum = 0;       // checksum of entire cbj_header_t
+    uint32_t cur_segment_seq = 0;
+
+    rbm_abs_addr start = 0; // start address of the device
+    rbm_abs_addr end = 0;   // start address of the device
     device_id_t device_id;
 
     DENC(cbj_header_t, v, p) {