Lines Matching refs:iter
57 struct btree_iter iter; in __bch_count_data() local
61 for_each_key(b, k, &iter) in __bch_count_data()
70 struct btree_iter iter; in __bch_check_keys() local
73 for_each_key(b, k, &iter) { in __bch_check_keys()
111 static void bch_btree_iter_next_check(struct btree_iter *iter) in bch_btree_iter_next_check() argument
113 struct bkey *k = iter->data->k, *next = bkey_next(k); in bch_btree_iter_next_check()
115 if (next < iter->data->end && in bch_btree_iter_next_check()
116 bkey_cmp(k, iter->b->ops->is_extents ? in bch_btree_iter_next_check()
118 bch_dump_bucket(iter->b); in bch_btree_iter_next_check()
125 static inline void bch_btree_iter_next_check(struct btree_iter *iter) {} in bch_btree_iter_next_check() argument
882 struct btree_iter iter; in bch_btree_insert_key() local
898 m = bch_btree_iter_init(b, &iter, preceding_key_p); in bch_btree_insert_key()
900 if (b->ops->insert_fixup(b, k, &iter, replace_key)) in bch_btree_insert_key()
1089 static inline bool btree_iter_end(struct btree_iter *iter) in btree_iter_end() argument
1091 return !iter->used; in btree_iter_end()
1094 void bch_btree_iter_push(struct btree_iter *iter, struct bkey *k, in bch_btree_iter_push() argument
1098 BUG_ON(!heap_add(iter, in bch_btree_iter_push()
1104 struct btree_iter *iter, in __bch_btree_iter_init() argument
1110 iter->size = ARRAY_SIZE(iter->data); in __bch_btree_iter_init()
1111 iter->used = 0; in __bch_btree_iter_init()
1114 iter->b = b; in __bch_btree_iter_init()
1119 bch_btree_iter_push(iter, ret, bset_bkey_last(start->data)); in __bch_btree_iter_init()
1126 struct btree_iter *iter, in bch_btree_iter_init() argument
1129 return __bch_btree_iter_init(b, iter, search, b->set); in bch_btree_iter_init()
1132 static inline struct bkey *__bch_btree_iter_next(struct btree_iter *iter, in __bch_btree_iter_next() argument
1138 if (!btree_iter_end(iter)) { in __bch_btree_iter_next()
1139 bch_btree_iter_next_check(iter); in __bch_btree_iter_next()
1141 ret = iter->data->k; in __bch_btree_iter_next()
1142 iter->data->k = bkey_next(iter->data->k); in __bch_btree_iter_next()
1144 if (iter->data->k > iter->data->end) { in __bch_btree_iter_next()
1146 iter->data->k = iter->data->end; in __bch_btree_iter_next()
1149 if (iter->data->k == iter->data->end) in __bch_btree_iter_next()
1150 heap_pop(iter, b, cmp); in __bch_btree_iter_next()
1152 heap_sift(iter, 0, cmp); in __bch_btree_iter_next()
1158 struct bkey *bch_btree_iter_next(struct btree_iter *iter) in bch_btree_iter_next() argument
1160 return __bch_btree_iter_next(iter, btree_iter_cmp); in bch_btree_iter_next()
1164 struct bkey *bch_btree_iter_next_filter(struct btree_iter *iter, in bch_btree_iter_next_filter() argument
1170 ret = bch_btree_iter_next(iter); in bch_btree_iter_next_filter()
1195 struct btree_iter *iter, in btree_mergesort() argument
1206 for (i = iter->used / 2 - 1; i >= 0; --i) in btree_mergesort()
1207 heap_sift(iter, i, b->ops->sort_cmp); in btree_mergesort()
1209 while (!btree_iter_end(iter)) { in btree_mergesort()
1211 k = b->ops->sort_fixup(iter, &tmp.k); in btree_mergesort()
1216 k = __bch_btree_iter_next(iter, b->ops->sort_cmp); in btree_mergesort()
1235 static void __btree_sort(struct btree_keys *b, struct btree_iter *iter, in __btree_sort() argument
1256 btree_mergesort(b, out, iter, fixup, false); in __btree_sort()
1296 struct btree_iter iter; in bch_btree_sort_partial() local
1299 __bch_btree_iter_init(b, &iter, NULL, &b->set[start]); in bch_btree_sort_partial()
1310 __btree_sort(b, &iter, start, order, false, state); in bch_btree_sort_partial()
1316 struct btree_iter *iter, in bch_btree_sort_and_fix_extents() argument
1319 __btree_sort(b, iter, 0, b->page_order, true, state); in bch_btree_sort_and_fix_extents()
1326 struct btree_iter iter; in bch_btree_sort_into() local
1328 bch_btree_iter_init(b, &iter, NULL); in bch_btree_sort_into()
1330 btree_mergesort(b, new->set->data, &iter, false, true); in bch_btree_sort_into()