]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: introduce bluefs_fnode_t::swap method
authorIgor Fedotov <igor.fedotov@croit.io>
Wed, 9 Nov 2022 02:24:00 +0000 (05:24 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Tue, 27 Jun 2023 11:36:34 +0000 (14:36 +0300)
+ minor refactoring.

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
(cherry picked from commit 0af28582453122ccd87389261a45127d399caf7d)

src/os/bluestore/bluefs_types.cc
src/os/bluestore/bluefs_types.h

index 3a812cf5f018d0acec69246bf4a0a243bb11712b..c8d2ede7bed92abfb7f561283e03e9e7f84d08da 100644 (file)
@@ -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;
 }
index 2134b559a20df224f5181044c381c3d13271ac74..cbf0ed1def9399a2d88dd74c7718954b8760ef5b 100644 (file)
@@ -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;