Lines Matching defs:id
33 static inline struct snapshot_t *__snapshot_t(struct snapshot_table *t, u32 id)
35 u32 idx = U32_MAX - id;
42 static inline const struct snapshot_t *snapshot_t(struct bch_fs *c, u32 id)
44 return __snapshot_t(rcu_dereference(c->snapshots), id);
47 static inline u32 bch2_snapshot_tree(struct bch_fs *c, u32 id)
50 const struct snapshot_t *s = snapshot_t(c, id);
54 static inline u32 __bch2_snapshot_parent_early(struct bch_fs *c, u32 id)
56 const struct snapshot_t *s = snapshot_t(c, id);
60 static inline u32 bch2_snapshot_parent_early(struct bch_fs *c, u32 id)
63 return __bch2_snapshot_parent_early(c, id);
66 static inline u32 __bch2_snapshot_parent(struct bch_fs *c, u32 id)
68 const struct snapshot_t *s = snapshot_t(c, id);
76 panic("id %u depth=%u parent %u depth=%u\n",
77 id, snapshot_t(c, id)->depth,
83 static inline u32 bch2_snapshot_parent(struct bch_fs *c, u32 id)
86 return __bch2_snapshot_parent(c, id);
89 static inline u32 bch2_snapshot_nth_parent(struct bch_fs *c, u32 id, u32 n)
93 id = __bch2_snapshot_parent(c, id);
94 return id;
100 static inline u32 bch2_snapshot_root(struct bch_fs *c, u32 id)
105 while ((parent = __bch2_snapshot_parent(c, id)))
106 id = parent;
107 return id;
110 static inline enum snapshot_id_state __bch2_snapshot_id_state(struct bch_fs *c, u32 id)
112 const struct snapshot_t *s = snapshot_t(c, id);
116 static inline enum snapshot_id_state bch2_snapshot_id_state(struct bch_fs *c, u32 id)
119 return __bch2_snapshot_id_state(c, id);
122 static inline bool bch2_snapshot_exists(struct bch_fs *c, u32 id)
124 return bch2_snapshot_id_state(c, id) == SNAPSHOT_ID_live;
127 static inline int bch2_snapshot_is_internal_node(struct bch_fs *c, u32 id)
130 const struct snapshot_t *s = snapshot_t(c, id);
134 static inline int bch2_snapshot_is_leaf(struct bch_fs *c, u32 id)
136 int ret = bch2_snapshot_is_internal_node(c, id);
150 static inline bool bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ancestor)
152 return id == ancestor
154 : __bch2_snapshot_is_ancestor(c, id, ancestor);
157 static inline bool bch2_snapshot_has_children(struct bch_fs *c, u32 id)
160 const struct snapshot_t *t = snapshot_t(c, id);
164 static inline bool snapshot_list_has_id(snapshot_id_list *s, u32 id)
166 return darray_find(*s, id) != NULL;
169 static inline bool snapshot_list_has_ancestor(struct bch_fs *c, snapshot_id_list *s, u32 id)
172 if (bch2_snapshot_is_ancestor(c, id, *i))
177 static inline int snapshot_list_add(struct bch_fs *c, snapshot_id_list *s, u32 id)
179 BUG_ON(snapshot_list_has_id(s, id));
180 int ret = darray_push(s, id);
186 static inline int snapshot_list_add_nodup(struct bch_fs *c, snapshot_id_list *s, u32 id)
188 int ret = snapshot_list_has_id(s, id)
190 : darray_push(s, id);
207 int bch2_snapshot_lookup(struct btree_trans *trans, u32 id,
255 enum btree_id id,
258 if (!btree_type_has_snapshots(id) ||
262 return __bch2_key_has_snapshot_overwrites(trans, id, pos);