]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os: add custom move ctor/assignment for TransactionData
authorCasey Bodley <cbodley@redhat.com>
Wed, 20 Jan 2016 22:18:08 +0000 (17:18 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 22 Jan 2016 16:02:34 +0000 (11:02 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/os/ObjectStore.h

index e108d1743e79a0ba7fb298646164091a9ab9f16d..d85c87d2a099175c4225fadd456cb46f1a52511a 100644 (file)
@@ -431,6 +431,36 @@ public:
         largest_data_off_in_tbl(0),
        fadvise_flags(0) { }
 
+      // override default move operations to reset default values
+      TransactionData(TransactionData&& other) :
+        ops(other.ops),
+        largest_data_len(other.largest_data_len),
+        largest_data_off(other.largest_data_off),
+        largest_data_off_in_tbl(other.largest_data_off_in_tbl),
+        fadvise_flags(other.fadvise_flags) {
+        other.ops = 0;
+        other.largest_data_len = 0;
+        other.largest_data_off = 0;
+        other.largest_data_off_in_tbl = 0;
+        other.fadvise_flags = 0;
+      }
+      TransactionData& operator=(TransactionData&& other) {
+        ops = other.ops;
+        largest_data_len = other.largest_data_len;
+        largest_data_off = other.largest_data_off;
+        largest_data_off_in_tbl = other.largest_data_off_in_tbl;
+        fadvise_flags = other.fadvise_flags;
+        other.ops = 0;
+        other.largest_data_len = 0;
+        other.largest_data_off = 0;
+        other.largest_data_off_in_tbl = 0;
+        other.fadvise_flags = 0;
+        return *this;
+      }
+
+      TransactionData(const TransactionData& other) = default;
+      TransactionData& operator=(const TransactionData& other) = default;
+
       void encode(bufferlist& bl) const {
         bl.append((char*)this, sizeof(TransactionData));
       }