Lines Matching refs:ancestor
94 static bool __bch2_snapshot_is_ancestor_early(struct snapshot_table *t, u32 id, u32 ancestor) in __bch2_snapshot_is_ancestor_early() argument
96 while (id && id < ancestor) { in __bch2_snapshot_is_ancestor_early()
100 return id == ancestor; in __bch2_snapshot_is_ancestor_early()
103 static bool bch2_snapshot_is_ancestor_early(struct bch_fs *c, u32 id, u32 ancestor) in bch2_snapshot_is_ancestor_early() argument
106 bool ret = __bch2_snapshot_is_ancestor_early(rcu_dereference(c->snapshots), id, ancestor); in bch2_snapshot_is_ancestor_early()
112 static inline u32 get_ancestor_below(struct snapshot_table *t, u32 id, u32 ancestor) in get_ancestor_below() argument
118 if (s->skip[2] <= ancestor) in get_ancestor_below()
120 if (s->skip[1] <= ancestor) in get_ancestor_below()
122 if (s->skip[0] <= ancestor) in get_ancestor_below()
127 static bool test_ancestor_bitmap(struct snapshot_table *t, u32 id, u32 ancestor) in test_ancestor_bitmap() argument
133 return test_bit(ancestor - id - 1, s->is_ancestor); in test_ancestor_bitmap()
136 bool __bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ancestor) in __bch2_snapshot_is_ancestor() argument
144 ret = __bch2_snapshot_is_ancestor_early(t, id, ancestor); in __bch2_snapshot_is_ancestor()
148 while (id && id < ancestor - IS_ANCESTOR_BITMAP) in __bch2_snapshot_is_ancestor()
149 id = get_ancestor_below(t, id, ancestor); in __bch2_snapshot_is_ancestor()
151 ret = id && id < ancestor in __bch2_snapshot_is_ancestor()
152 ? test_ancestor_bitmap(t, id, ancestor) in __bch2_snapshot_is_ancestor()
153 : id == ancestor; in __bch2_snapshot_is_ancestor()
155 EBUG_ON(ret != __bch2_snapshot_is_ancestor_early(t, id, ancestor)); in __bch2_snapshot_is_ancestor()