Skip to content

Commit

Permalink
os/bluestore: introduce bluefs_fnode_t::swap method
Browse files Browse the repository at this point in the history
+ minor refactoring.

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
  • Loading branch information
ifed01 committed Nov 10, 2022
1 parent 0bfc42a commit 0af2858
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/os/bluestore/bluefs_types.cc
Expand Up @@ -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;
}
Expand Down
9 changes: 8 additions & 1 deletion src/os/bluestore/bluefs_types.h
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0af2858

Please sign in to comment.