struct btree_path *path;
unsigned i;
- BUG_ON(trans->nr_sorted != bitmap_weight(trans->paths_allocated, BTREE_ITER_MAX));
+ BUG_ON(trans->nr_sorted != bitmap_weight(trans->paths_allocated, BTREE_ITER_MAX) - 1);
trans_for_each_path(trans, path) {
BUG_ON(path->sorted_idx >= trans->nr_sorted);
atomic_inc_not_zero(&c->journal_keys.ref);
closure_init_stack(&trans->ref);
+ trans->paths_allocated[0] = 1;
+
s = btree_trans_stats(trans);
if (s && s->max_mem) {
unsigned expected_mem_bytes = roundup_pow_of_two(s->max_mem);
_path = __trans_next_path((_trans), (_path)->idx + 1))
#define trans_for_each_path(_trans, _path) \
- trans_for_each_path_from(_trans, _path, 0)
+ trans_for_each_path_from(_trans, _path, 1)
static inline struct btree_path *
__trans_next_path_safe(struct btree_trans *trans, unsigned *idx)
_idx++)
#define trans_for_each_path_safe(_trans, _path, _idx) \
- trans_for_each_path_safe_from(_trans, _path, _idx, 0)
+ trans_for_each_path_safe_from(_trans, _path, _idx, 1)
static inline struct btree_path *next_btree_path(struct btree_trans *trans, struct btree_path *path)
{
}
#define trans_for_each_path_with_node(_trans, _b, _path) \
- for (_path = __trans_next_path_with_node((_trans), (_b), 0); \
+ for (_path = __trans_next_path_with_node((_trans), (_b), 1); \
(_path); \
_path = __trans_next_path_with_node((_trans), (_b), \
(_path)->idx + 1))