summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-07-16 21:59:40 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:10:07 +0200
commit93de9e92c32c73d25bccbd82b1dabff3e3c2b7d2 (patch)
tree2d8652935a426f1a171293f1dd3a5f3c279fb7cb /fs
parentbcachefs: Upgrade path fixes (diff)
downloadlinux-93de9e92c32c73d25bccbd82b1dabff3e3c2b7d2.tar.xz
linux-93de9e92c32c73d25bccbd82b1dabff3e3c2b7d2.zip
bcachefs: Inline bch2_snapshot_is_ancestor() fast path
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/subvolume.c2
-rw-r--r--fs/bcachefs/subvolume.h9
2 files changed, 9 insertions, 2 deletions
diff --git a/fs/bcachefs/subvolume.c b/fs/bcachefs/subvolume.c
index cf8af617ac00..287492c29bcc 100644
--- a/fs/bcachefs/subvolume.c
+++ b/fs/bcachefs/subvolume.c
@@ -25,7 +25,7 @@ static inline u32 get_ancestor_below(struct snapshot_table *t, u32 id, u32 ances
return s->parent;
}
-bool bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ancestor)
+bool __bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ancestor)
{
struct snapshot_table *t;
bool ret;
diff --git a/fs/bcachefs/subvolume.h b/fs/bcachefs/subvolume.h
index 12a08a34e9bb..6905e91a9470 100644
--- a/fs/bcachefs/subvolume.h
+++ b/fs/bcachefs/subvolume.h
@@ -166,7 +166,14 @@ static inline u32 bch2_snapshot_sibling(struct bch_fs *c, u32 id)
return 0;
}
-bool bch2_snapshot_is_ancestor(struct bch_fs *, u32, u32);
+bool __bch2_snapshot_is_ancestor(struct bch_fs *, u32, u32);
+
+static inline bool bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ancestor)
+{
+ return id == ancestor
+ ? true
+ : __bch2_snapshot_is_ancestor(c, id, ancestor);
+}
static inline bool bch2_snapshot_has_children(struct bch_fs *c, u32 id)
{