Lines Matching full:id
34 static inline struct snapshot_t *__snapshot_t(struct snapshot_table *t, u32 id) in __snapshot_t() argument
36 u32 idx = U32_MAX - id; in __snapshot_t()
43 static inline const struct snapshot_t *snapshot_t(struct bch_fs *c, u32 id) in snapshot_t() argument
45 return __snapshot_t(rcu_dereference(c->snapshots), id); in snapshot_t()
48 static inline u32 bch2_snapshot_tree(struct bch_fs *c, u32 id) in bch2_snapshot_tree() argument
51 const struct snapshot_t *s = snapshot_t(c, id); in bch2_snapshot_tree()
52 id = s ? s->tree : 0; in bch2_snapshot_tree()
55 return id; in bch2_snapshot_tree()
58 static inline u32 __bch2_snapshot_parent_early(struct bch_fs *c, u32 id) in __bch2_snapshot_parent_early() argument
60 const struct snapshot_t *s = snapshot_t(c, id); in __bch2_snapshot_parent_early()
64 static inline u32 bch2_snapshot_parent_early(struct bch_fs *c, u32 id) in bch2_snapshot_parent_early() argument
67 id = __bch2_snapshot_parent_early(c, id); in bch2_snapshot_parent_early()
70 return id; in bch2_snapshot_parent_early()
73 static inline u32 __bch2_snapshot_parent(struct bch_fs *c, u32 id) in __bch2_snapshot_parent() argument
75 const struct snapshot_t *s = snapshot_t(c, id); in __bch2_snapshot_parent()
83 panic("id %u depth=%u parent %u depth=%u\n", in __bch2_snapshot_parent()
84 id, snapshot_t(c, id)->depth, in __bch2_snapshot_parent()
90 static inline u32 bch2_snapshot_parent(struct bch_fs *c, u32 id) in bch2_snapshot_parent() argument
93 id = __bch2_snapshot_parent(c, id); in bch2_snapshot_parent()
96 return id; in bch2_snapshot_parent()
99 static inline u32 bch2_snapshot_nth_parent(struct bch_fs *c, u32 id, u32 n) in bch2_snapshot_nth_parent() argument
103 id = __bch2_snapshot_parent(c, id); in bch2_snapshot_nth_parent()
106 return id; in bch2_snapshot_nth_parent()
111 static inline u32 bch2_snapshot_root(struct bch_fs *c, u32 id) in bch2_snapshot_root() argument
116 while ((parent = __bch2_snapshot_parent(c, id))) in bch2_snapshot_root()
117 id = parent; in bch2_snapshot_root()
120 return id; in bch2_snapshot_root()
123 static inline u32 __bch2_snapshot_equiv(struct bch_fs *c, u32 id) in __bch2_snapshot_equiv() argument
125 const struct snapshot_t *s = snapshot_t(c, id); in __bch2_snapshot_equiv()
129 static inline u32 bch2_snapshot_equiv(struct bch_fs *c, u32 id) in bch2_snapshot_equiv() argument
132 id = __bch2_snapshot_equiv(c, id); in bch2_snapshot_equiv()
135 return id; in bch2_snapshot_equiv()
138 static inline int bch2_snapshot_is_internal_node(struct bch_fs *c, u32 id) in bch2_snapshot_is_internal_node() argument
141 const struct snapshot_t *s = snapshot_t(c, id); in bch2_snapshot_is_internal_node()
148 static inline int bch2_snapshot_is_leaf(struct bch_fs *c, u32 id) in bch2_snapshot_is_leaf() argument
150 int ret = bch2_snapshot_is_internal_node(c, id); in bch2_snapshot_is_leaf()
169 static inline bool bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ancestor) in bch2_snapshot_is_ancestor() argument
171 return id == ancestor in bch2_snapshot_is_ancestor()
173 : __bch2_snapshot_is_ancestor(c, id, ancestor); in bch2_snapshot_is_ancestor()
176 static inline bool bch2_snapshot_has_children(struct bch_fs *c, u32 id) in bch2_snapshot_has_children() argument
179 const struct snapshot_t *t = snapshot_t(c, id); in bch2_snapshot_has_children()
186 static inline bool snapshot_list_has_id(snapshot_id_list *s, u32 id) in snapshot_list_has_id() argument
189 if (*i == id) in snapshot_list_has_id()
194 static inline bool snapshot_list_has_ancestor(struct bch_fs *c, snapshot_id_list *s, u32 id) in snapshot_list_has_ancestor() argument
197 if (bch2_snapshot_is_ancestor(c, id, *i)) in snapshot_list_has_ancestor()
202 static inline int snapshot_list_add(struct bch_fs *c, snapshot_id_list *s, u32 id) in snapshot_list_add() argument
204 BUG_ON(snapshot_list_has_id(s, id)); in snapshot_list_add()
205 int ret = darray_push(s, id); in snapshot_list_add()
211 static inline int snapshot_list_add_nodup(struct bch_fs *c, snapshot_id_list *s, u32 id) in snapshot_list_add_nodup() argument
213 int ret = snapshot_list_has_id(s, id) in snapshot_list_add_nodup()
215 : darray_push(s, id); in snapshot_list_add_nodup()
232 int bch2_snapshot_lookup(struct btree_trans *trans, u32 id,
252 enum btree_id id, in bch2_key_has_snapshot_overwrites() argument
255 if (!btree_type_has_snapshots(id) || in bch2_key_has_snapshot_overwrites()
259 return __bch2_key_has_snapshot_overwrites(trans, id, pos); in bch2_key_has_snapshot_overwrites()