From: Casey Bodley Date: Wed, 20 Jan 2016 22:18:08 +0000 (-0500) Subject: os: add custom move ctor/assignment for TransactionData X-Git-Tag: v10.0.4~177^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fd33668aba0a8a8ef206ef519d3bafd71c088ed5;p=ceph.git os: add custom move ctor/assignment for TransactionData Signed-off-by: Casey Bodley --- diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index e108d1743e79..d85c87d2a099 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -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)); }