Lines Matching refs:s
125 void init_ro_spine(struct ro_spine *s, struct dm_btree_info *info) in init_ro_spine() argument
127 s->info = info; in init_ro_spine()
128 s->count = 0; in init_ro_spine()
129 s->nodes[0] = NULL; in init_ro_spine()
130 s->nodes[1] = NULL; in init_ro_spine()
133 void exit_ro_spine(struct ro_spine *s) in exit_ro_spine() argument
137 for (i = 0; i < s->count; i++) { in exit_ro_spine()
138 unlock_block(s->info, s->nodes[i]); in exit_ro_spine()
142 int ro_step(struct ro_spine *s, dm_block_t new_child) in ro_step() argument
146 if (s->count == 2) { in ro_step()
147 unlock_block(s->info, s->nodes[0]); in ro_step()
148 s->nodes[0] = s->nodes[1]; in ro_step()
149 s->count--; in ro_step()
152 r = bn_read_lock(s->info, new_child, s->nodes + s->count); in ro_step()
154 s->count++; in ro_step()
159 void ro_pop(struct ro_spine *s) in ro_pop() argument
161 BUG_ON(!s->count); in ro_pop()
162 --s->count; in ro_pop()
163 unlock_block(s->info, s->nodes[s->count]); in ro_pop()
166 struct btree_node *ro_node(struct ro_spine *s) in ro_node() argument
170 BUG_ON(!s->count); in ro_node()
171 block = s->nodes[s->count - 1]; in ro_node()
178 void init_shadow_spine(struct shadow_spine *s, struct dm_btree_info *info) in init_shadow_spine() argument
180 s->info = info; in init_shadow_spine()
181 s->count = 0; in init_shadow_spine()
184 void exit_shadow_spine(struct shadow_spine *s) in exit_shadow_spine() argument
188 for (i = 0; i < s->count; i++) { in exit_shadow_spine()
189 unlock_block(s->info, s->nodes[i]); in exit_shadow_spine()
193 int shadow_step(struct shadow_spine *s, dm_block_t b, in shadow_step() argument
198 if (s->count == 2) { in shadow_step()
199 unlock_block(s->info, s->nodes[0]); in shadow_step()
200 s->nodes[0] = s->nodes[1]; in shadow_step()
201 s->count--; in shadow_step()
204 r = bn_shadow(s->info, b, vt, s->nodes + s->count); in shadow_step()
206 if (!s->count) in shadow_step()
207 s->root = dm_block_location(s->nodes[0]); in shadow_step()
209 s->count++; in shadow_step()
215 struct dm_block *shadow_current(struct shadow_spine *s) in shadow_current() argument
217 BUG_ON(!s->count); in shadow_current()
219 return s->nodes[s->count - 1]; in shadow_current()
222 struct dm_block *shadow_parent(struct shadow_spine *s) in shadow_parent() argument
224 BUG_ON(s->count != 2); in shadow_parent()
226 return s->count == 2 ? s->nodes[0] : NULL; in shadow_parent()
229 int shadow_has_parent(struct shadow_spine *s) in shadow_has_parent() argument
231 return s->count >= 2; in shadow_has_parent()
234 dm_block_t shadow_root(struct shadow_spine *s) in shadow_root() argument
236 return s->root; in shadow_root()