Lines Matching full:id
34 static inline struct snapshot_t *__snapshot_t(struct snapshot_table *t, u32 id) in __snapshot_t() argument
36 return &t->s[U32_MAX - id]; in __snapshot_t()
39 static inline const struct snapshot_t *snapshot_t(struct bch_fs *c, u32 id) in snapshot_t() argument
41 return __snapshot_t(rcu_dereference(c->snapshots), id); in snapshot_t()
44 static inline u32 bch2_snapshot_tree(struct bch_fs *c, u32 id) in bch2_snapshot_tree() argument
47 id = snapshot_t(c, id)->tree; in bch2_snapshot_tree()
50 return id; in bch2_snapshot_tree()
53 static inline u32 __bch2_snapshot_parent_early(struct bch_fs *c, u32 id) in __bch2_snapshot_parent_early() argument
55 return snapshot_t(c, id)->parent; in __bch2_snapshot_parent_early()
58 static inline u32 bch2_snapshot_parent_early(struct bch_fs *c, u32 id) in bch2_snapshot_parent_early() argument
61 id = __bch2_snapshot_parent_early(c, id); in bch2_snapshot_parent_early()
64 return id; in bch2_snapshot_parent_early()
67 static inline u32 __bch2_snapshot_parent(struct bch_fs *c, u32 id) in __bch2_snapshot_parent() argument
70 u32 parent = snapshot_t(c, id)->parent; in __bch2_snapshot_parent()
73 snapshot_t(c, id)->depth != snapshot_t(c, parent)->depth + 1) in __bch2_snapshot_parent()
74 panic("id %u depth=%u parent %u depth=%u\n", in __bch2_snapshot_parent()
75 id, snapshot_t(c, id)->depth, in __bch2_snapshot_parent()
80 return snapshot_t(c, id)->parent; in __bch2_snapshot_parent()
84 static inline u32 bch2_snapshot_parent(struct bch_fs *c, u32 id) in bch2_snapshot_parent() argument
87 id = __bch2_snapshot_parent(c, id); in bch2_snapshot_parent()
90 return id; in bch2_snapshot_parent()
93 static inline u32 bch2_snapshot_nth_parent(struct bch_fs *c, u32 id, u32 n) in bch2_snapshot_nth_parent() argument
97 id = __bch2_snapshot_parent(c, id); in bch2_snapshot_nth_parent()
100 return id; in bch2_snapshot_nth_parent()
105 static inline u32 bch2_snapshot_root(struct bch_fs *c, u32 id) in bch2_snapshot_root() argument
110 while ((parent = __bch2_snapshot_parent(c, id))) in bch2_snapshot_root()
111 id = parent; in bch2_snapshot_root()
114 return id; in bch2_snapshot_root()
117 static inline u32 __bch2_snapshot_equiv(struct bch_fs *c, u32 id) in __bch2_snapshot_equiv() argument
119 return snapshot_t(c, id)->equiv; in __bch2_snapshot_equiv()
122 static inline u32 bch2_snapshot_equiv(struct bch_fs *c, u32 id) in bch2_snapshot_equiv() argument
125 id = __bch2_snapshot_equiv(c, id); in bch2_snapshot_equiv()
128 return id; in bch2_snapshot_equiv()
131 static inline bool bch2_snapshot_is_equiv(struct bch_fs *c, u32 id) in bch2_snapshot_is_equiv() argument
133 return id == bch2_snapshot_equiv(c, id); in bch2_snapshot_is_equiv()
136 static inline bool bch2_snapshot_is_internal_node(struct bch_fs *c, u32 id) in bch2_snapshot_is_internal_node() argument
142 s = snapshot_t(c, id); in bch2_snapshot_is_internal_node()
149 static inline u32 bch2_snapshot_is_leaf(struct bch_fs *c, u32 id) in bch2_snapshot_is_leaf() argument
151 return !bch2_snapshot_is_internal_node(c, id); in bch2_snapshot_is_leaf()
154 static inline u32 bch2_snapshot_sibling(struct bch_fs *c, u32 id) in bch2_snapshot_sibling() argument
157 u32 parent = __bch2_snapshot_parent(c, id); in bch2_snapshot_sibling()
162 s = snapshot_t(c, __bch2_snapshot_parent(c, id)); in bch2_snapshot_sibling()
163 if (id == s->children[0]) in bch2_snapshot_sibling()
165 if (id == s->children[1]) in bch2_snapshot_sibling()
183 static inline bool bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ancestor) in bch2_snapshot_is_ancestor() argument
185 return id == ancestor in bch2_snapshot_is_ancestor()
187 : __bch2_snapshot_is_ancestor(c, id, ancestor); in bch2_snapshot_is_ancestor()
190 static inline bool bch2_snapshot_has_children(struct bch_fs *c, u32 id) in bch2_snapshot_has_children() argument
196 t = snapshot_t(c, id); in bch2_snapshot_has_children()
203 static inline bool snapshot_list_has_id(snapshot_id_list *s, u32 id) in snapshot_list_has_id() argument
206 if (*i == id) in snapshot_list_has_id()
211 static inline bool snapshot_list_has_ancestor(struct bch_fs *c, snapshot_id_list *s, u32 id) in snapshot_list_has_ancestor() argument
214 if (bch2_snapshot_is_ancestor(c, id, *i)) in snapshot_list_has_ancestor()
219 static inline int snapshot_list_add(struct bch_fs *c, snapshot_id_list *s, u32 id) in snapshot_list_add() argument
223 BUG_ON(snapshot_list_has_id(s, id)); in snapshot_list_add()
224 ret = darray_push(s, id); in snapshot_list_add()
230 int bch2_snapshot_lookup(struct btree_trans *trans, u32 id,
248 enum btree_id id, in bch2_key_has_snapshot_overwrites() argument
251 if (!btree_type_has_snapshots(id) || in bch2_key_has_snapshot_overwrites()
255 return __bch2_key_has_snapshot_overwrites(trans, id, pos); in bch2_key_has_snapshot_overwrites()