Commit 6333bd2f authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Improve handling of extents in bch2_trans_update()

The transaction update/commit path cares about whether it's inserting
extents or regular keys; extents require extra passes (handling of
overlapping extents) but sometimes we want to skip all that. This
clarifies things by adding a new member to btree_insert_entry specifying
whether the key being inserted is an extent, instead of overloading
BTREE_ITER_IS_EXTENTS.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 2436cb9f
...@@ -335,7 +335,11 @@ struct bkey_cached { ...@@ -335,7 +335,11 @@ struct bkey_cached {
struct btree_insert_entry { struct btree_insert_entry {
unsigned trigger_flags; unsigned trigger_flags;
u8 bkey_type;
u8 btree_id;
u8 level;
unsigned trans_triggers_run:1; unsigned trans_triggers_run:1;
unsigned is_extent:1;
struct bkey_i *k; struct bkey_i *k;
struct btree_iter *iter; struct btree_iter *iter;
}; };
...@@ -589,19 +593,20 @@ static inline bool btree_iter_is_extents(struct btree_iter *iter) ...@@ -589,19 +593,20 @@ static inline bool btree_iter_is_extents(struct btree_iter *iter)
return btree_node_type_is_extents(btree_iter_key_type(iter)); return btree_node_type_is_extents(btree_iter_key_type(iter));
} }
#define BTREE_NODE_TYPE_HAS_TRIGGERS \ #define BTREE_NODE_TYPE_HAS_TRANS_TRIGGERS \
((1U << BKEY_TYPE_extents)| \ ((1U << BKEY_TYPE_extents)| \
(1U << BKEY_TYPE_alloc)| \
(1U << BKEY_TYPE_inodes)| \ (1U << BKEY_TYPE_inodes)| \
(1U << BKEY_TYPE_reflink)| \
(1U << BKEY_TYPE_stripes)| \ (1U << BKEY_TYPE_stripes)| \
(1U << BKEY_TYPE_reflink)| \
(1U << BKEY_TYPE_btree)) (1U << BKEY_TYPE_btree))
#define BTREE_NODE_TYPE_HAS_TRANS_TRIGGERS \ #define BTREE_NODE_TYPE_HAS_MEM_TRIGGERS \
((1U << BKEY_TYPE_extents)| \ ((1U << BKEY_TYPE_alloc)| \
(1U << BKEY_TYPE_inodes)| \ (1U << BKEY_TYPE_stripes))
(1U << BKEY_TYPE_stripes)| \
(1U << BKEY_TYPE_reflink)) #define BTREE_NODE_TYPE_HAS_TRIGGERS \
(BTREE_NODE_TYPE_HAS_TRANS_TRIGGERS| \
BTREE_NODE_TYPE_HAS_MEM_TRIGGERS)
enum btree_trigger_flags { enum btree_trigger_flags {
__BTREE_TRIGGER_NORUN, /* Don't run triggers at all */ __BTREE_TRIGGER_NORUN, /* Don't run triggers at all */
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment