bcachefs: Inline bch2_snapshot_is_ancestor() fast path
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 16 Jul 2023 19:59:40 +0000 (15:59 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:07 +0000 (17:10 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/subvolume.c
fs/bcachefs/subvolume.h

index cf8af617ac00d2302000642dc0c934c11217ca8b..287492c29bccd8fd07945fb413d7b366155bb017 100644 (file)
@@ -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;
index 12a08a34e9bb2b72c674437c85777d62de66b36e..6905e91a947087fabdcce1525ade64d5cd4ef684 100644 (file)
@@ -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)
 {