summaryrefslogtreecommitdiff
path: root/fs/bcachefs/backpointers.h
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2023-07-19 08:53:02 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:08 -0400
commit2110f21ec0a294360f2a510ff33d38605af45d88 (patch)
tree595e557351d229e4fdfd09d83405fb0eba93776b /fs/bcachefs/backpointers.h
parentf7b3e651de8e269887ac25f1a26a96396c8fb91d (diff)
bcachefs: remove duplicate code between backpointer update paths
Signed-off-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/backpointers.h')
-rw-r--r--fs/bcachefs/backpointers.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/bcachefs/backpointers.h b/fs/bcachefs/backpointers.h
index 87e31aa1975c..547e0617602a 100644
--- a/fs/bcachefs/backpointers.h
+++ b/fs/bcachefs/backpointers.h
@@ -54,7 +54,7 @@ static inline struct bpos bucket_pos_to_bp(const struct bch_fs *c,
return ret;
}
-int bch2_bucket_backpointer_mod_nowritebuffer(struct btree_trans *, struct bpos,
+int bch2_bucket_backpointer_mod_nowritebuffer(struct btree_trans *, struct bkey_i_backpointer *,
struct bch_backpointer, struct bkey_s_c, bool);
static inline int bch2_bucket_backpointer_mod(struct btree_trans *trans,
@@ -67,9 +67,6 @@ static inline int bch2_bucket_backpointer_mod(struct btree_trans *trans,
struct bkey_i_backpointer *bp_k;
int ret;
- if (unlikely(bch2_backpointers_no_use_write_buffer))
- return bch2_bucket_backpointer_mod_nowritebuffer(trans, bucket, bp, orig_k, insert);
-
bp_k = bch2_trans_kmalloc_nomemzero(trans, sizeof(struct bkey_i_backpointer));
ret = PTR_ERR_OR_ZERO(bp_k);
if (ret)
@@ -84,6 +81,9 @@ static inline int bch2_bucket_backpointer_mod(struct btree_trans *trans,
set_bkey_val_u64s(&bp_k->k, 0);
}
+ if (unlikely(bch2_backpointers_no_use_write_buffer))
+ return bch2_bucket_backpointer_mod_nowritebuffer(trans, bp_k, bp, orig_k, insert);
+
return bch2_trans_update_buffered(trans, BTREE_ID_backpointers, &bp_k->k_i);
}