diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-09-10 19:11:47 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:12 -0400 |
commit | f3e374efbf1e32fc0235d44abc68abae06a8f7ab (patch) | |
tree | 5c31a7e0533597c868cf8e5c9d0e19dc7ad0a38e /fs/bcachefs/bcachefs_format.h | |
parent | b030e262b517b6bddc4bfa88ed8d335ef9de7671 (diff) | |
download | lwn-f3e374efbf1e32fc0235d44abc68abae06a8f7ab.tar.gz lwn-f3e374efbf1e32fc0235d44abc68abae06a8f7ab.zip |
bcachefs: Log finsert/fcollapse operations
Now that we have the logged operations btree, we can make
finsert/fcollapse atomic w.r.t. unclean shutdown as well.
This adds bch_logged_op_finsert to represent the state of an finsert or
fcollapse, which is a bit more complicated than truncate since we need
to track our position in the "shift extents" operation.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bcachefs_format.h')
-rw-r--r-- | fs/bcachefs/bcachefs_format.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index 3c9e788f1c9d..c434202f351a 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -371,7 +371,8 @@ static inline void bkey_init(struct bkey *k) x(inode_v3, 29) \ x(bucket_gens, 30) \ x(snapshot_tree, 31) \ - x(logged_op_truncate, 32) + x(logged_op_truncate, 32) \ + x(logged_op_finsert, 33) enum bch_bkey_type { #define x(name, nr) KEY_TYPE_##name = nr, @@ -1194,6 +1195,23 @@ struct bch_logged_op_truncate { __le64 new_i_size; }; +enum logged_op_finsert_state { + LOGGED_OP_FINSERT_start, + LOGGED_OP_FINSERT_shift_extents, + LOGGED_OP_FINSERT_finish, +}; + +struct bch_logged_op_finsert { + struct bch_val v; + __u8 state; + __u8 pad[3]; + __le32 subvol; + __le64 inum; + __le64 dst_offset; + __le64 src_offset; + __le64 pos; +}; + /* Optional/variable size superblock sections: */ struct bch_sb_field { @@ -2262,7 +2280,8 @@ enum btree_id_flags { x(deleted_inodes, 16, BTREE_ID_SNAPSHOTS, \ BIT_ULL(KEY_TYPE_set)) \ x(logged_ops, 17, 0, \ - BIT_ULL(KEY_TYPE_logged_op_truncate)) + BIT_ULL(KEY_TYPE_logged_op_truncate)| \ + BIT_ULL(KEY_TYPE_logged_op_finsert)) enum btree_id { #define x(name, nr, ...) BTREE_ID_##name = nr, |