From: Igor Fedotov Date: Wed, 9 Nov 2022 02:24:00 +0000 (+0300) Subject: os/bluestore: introduce bluefs_fnode_t::swap method X-Git-Tag: v16.2.14~23^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7f8204e7261276bbbd3e3e8a8f4ce81c7445022d;p=ceph.git os/bluestore: introduce bluefs_fnode_t::swap method + minor refactoring. Signed-off-by: Igor Fedotov (cherry picked from commit 0af28582453122ccd87389261a45127d399caf7d) --- diff --git a/src/os/bluestore/bluefs_types.cc b/src/os/bluestore/bluefs_types.cc index 3a812cf5f01..c8d2ede7bed 100644 --- a/src/os/bluestore/bluefs_types.cc +++ b/src/os/bluestore/bluefs_types.cc @@ -167,7 +167,6 @@ bluefs_fnode_delta_t* bluefs_fnode_t::make_delta(bluefs_fnode_delta_t* delta) { delta->extents.push_back(*p); ++p; } - reset_delta(); } return delta; } diff --git a/src/os/bluestore/bluefs_types.h b/src/os/bluestore/bluefs_types.h index 2134b559a20..cbf0ed1def9 100644 --- a/src/os/bluestore/bluefs_types.h +++ b/src/os/bluestore/bluefs_types.h @@ -149,6 +149,12 @@ struct bluefs_fnode_t { extents.erase(it); } + void swap(bluefs_fnode_t& other) { + std::swap(ino, other.ino); + std::swap(size, other.size); + std::swap(mtime, other.mtime); + swap_extents(other); + } void swap_extents(bluefs_fnode_t& other) { other.extents.swap(extents); other.extents_index.swap(extents_index); @@ -290,9 +296,10 @@ struct bluefs_transaction_t { void op_file_update_inc(bluefs_fnode_t& file) { using ceph::encode; bluefs_fnode_delta_t delta; - file.make_delta(&delta); //also resets delta to zero + file.make_delta(&delta); encode((__u8)OP_FILE_UPDATE_INC, op_bl); encode(delta, op_bl); + file.reset_delta(); } void op_file_remove(uint64_t ino) { using ceph::encode;