Lines Matching refs:s
127 void init_ro_spine(struct ro_spine *s, struct dm_btree_info *info) in init_ro_spine() argument
129 s->info = info; in init_ro_spine()
130 s->count = 0; in init_ro_spine()
131 s->nodes[0] = NULL; in init_ro_spine()
132 s->nodes[1] = NULL; in init_ro_spine()
135 int exit_ro_spine(struct ro_spine *s) in exit_ro_spine() argument
139 for (i = 0; i < s->count; i++) { in exit_ro_spine()
140 unlock_block(s->info, s->nodes[i]); in exit_ro_spine()
146 int ro_step(struct ro_spine *s, dm_block_t new_child) in ro_step() argument
150 if (s->count == 2) { in ro_step()
151 unlock_block(s->info, s->nodes[0]); in ro_step()
152 s->nodes[0] = s->nodes[1]; in ro_step()
153 s->count--; in ro_step()
156 r = bn_read_lock(s->info, new_child, s->nodes + s->count); in ro_step()
158 s->count++; in ro_step()
163 void ro_pop(struct ro_spine *s) in ro_pop() argument
165 BUG_ON(!s->count); in ro_pop()
166 --s->count; in ro_pop()
167 unlock_block(s->info, s->nodes[s->count]); in ro_pop()
170 struct btree_node *ro_node(struct ro_spine *s) in ro_node() argument
174 BUG_ON(!s->count); in ro_node()
175 block = s->nodes[s->count - 1]; in ro_node()
182 void init_shadow_spine(struct shadow_spine *s, struct dm_btree_info *info) in init_shadow_spine() argument
184 s->info = info; in init_shadow_spine()
185 s->count = 0; in init_shadow_spine()
188 int exit_shadow_spine(struct shadow_spine *s) in exit_shadow_spine() argument
192 for (i = 0; i < s->count; i++) { in exit_shadow_spine()
193 unlock_block(s->info, s->nodes[i]); in exit_shadow_spine()
199 int shadow_step(struct shadow_spine *s, dm_block_t b, in shadow_step() argument
204 if (s->count == 2) { in shadow_step()
205 unlock_block(s->info, s->nodes[0]); in shadow_step()
206 s->nodes[0] = s->nodes[1]; in shadow_step()
207 s->count--; in shadow_step()
210 r = bn_shadow(s->info, b, vt, s->nodes + s->count); in shadow_step()
212 if (!s->count) in shadow_step()
213 s->root = dm_block_location(s->nodes[0]); in shadow_step()
215 s->count++; in shadow_step()
221 struct dm_block *shadow_current(struct shadow_spine *s) in shadow_current() argument
223 BUG_ON(!s->count); in shadow_current()
225 return s->nodes[s->count - 1]; in shadow_current()
228 struct dm_block *shadow_parent(struct shadow_spine *s) in shadow_parent() argument
230 BUG_ON(s->count != 2); in shadow_parent()
232 return s->count == 2 ? s->nodes[0] : NULL; in shadow_parent()
235 int shadow_has_parent(struct shadow_spine *s) in shadow_has_parent() argument
237 return s->count >= 2; in shadow_has_parent()
240 int shadow_root(struct shadow_spine *s) in shadow_root() argument
242 return s->root; in shadow_root()