summaryrefslogtreecommitdiff
path: root/fs/bcachefs/snapshot.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-08-18 21:13:44 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:11 -0400
commitfa5bed376a184f2dcb48dba5c076583ed6c61340 (patch)
tree7c778be9c3346af83354448185354438034872bc /fs/bcachefs/snapshot.h
parent7573041ab958a14407621ef9756be49548f937e6 (diff)
downloadlwn-fa5bed376a184f2dcb48dba5c076583ed6c61340.tar.gz
lwn-fa5bed376a184f2dcb48dba5c076583ed6c61340.zip
bcachefs: move check_pos_snapshot_overwritten() to snapshot.c
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/snapshot.h')
-rw-r--r--fs/bcachefs/snapshot.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/bcachefs/snapshot.h b/fs/bcachefs/snapshot.h
index 826bff2ff7be..624a42d1c8b7 100644
--- a/fs/bcachefs/snapshot.h
+++ b/fs/bcachefs/snapshot.h
@@ -250,6 +250,19 @@ int bch2_delete_dead_snapshots_hook(struct btree_trans *,
struct btree_trans_commit_hook *);
void bch2_delete_dead_snapshots_work(struct work_struct *);
+int __bch2_key_has_snapshot_overwrites(struct btree_trans *, enum btree_id, struct bpos);
+
+static inline int bch2_key_has_snapshot_overwrites(struct btree_trans *trans,
+ enum btree_id id,
+ struct bpos pos)
+{
+ if (!btree_type_has_snapshots(id) ||
+ bch2_snapshot_is_leaf(trans->c, pos.snapshot))
+ return 0;
+
+ return __bch2_key_has_snapshot_overwrites(trans, id, pos);
+}
+
int bch2_snapshots_read(struct bch_fs *);
void bch2_fs_snapshots_exit(struct bch_fs *);