unsigned i;
int ret = 0;
- req->ptrs2.nr = 0;
+ req->scratch_ptrs.nr = 0;
open_bucket_for_each(c, &req->wp->ptrs, ob, i) {
if (!ret && want_bucket(c, req, ob))
ret = add_new_bucket(c, req, ob);
else
- ob_push(c, &req->ptrs2, ob);
+ ob_push(c, &req->scratch_ptrs, ob);
}
- req->wp->ptrs = req->ptrs2;
+ req->wp->ptrs = req->scratch_ptrs;
return ret;
}
unsigned extra_replicas = req->nr_effective - req->nr_replicas;
unsigned i;
- req->ptrs2.nr = 0;
+ req->scratch_ptrs.nr = 0;
open_bucket_for_each(c, &req->ptrs, ob, i) {
unsigned d = ob_dev(c, ob)->mi.durability;
extra_replicas -= d;
ob_push(c, &req->wp->ptrs, ob);
} else {
- ob_push(c, &req->ptrs2, ob);
+ ob_push(c, &req->scratch_ptrs, ob);
}
}
- req->ptrs = req->ptrs2;
+ req->ptrs = req->scratch_ptrs;
}
/*
/* These fields are used primarily by open_bucket_add_buckets */
struct open_buckets ptrs;
- struct open_buckets ptrs2;
unsigned nr_effective; /* sum of @ptrs durability */
bool have_cache; /* have we allocated from a 0 durability dev */
struct bch_devs_mask devs_may_alloc;
u64 skipped_nouse;
u64 skipped_mi_btree_bitmap;
} counters;
+
+ unsigned scratch_nr_replicas;
+ unsigned scratch_nr_effective;
+ bool scratch_have_cache;
+ enum bch_data_type scratch_data_type;
+ struct open_buckets scratch_ptrs;
+ struct bch_devs_mask scratch_devs_may_alloc;
};
struct dev_alloc_list bch2_dev_alloc_list(struct bch_fs *,
unsigned i, j, nr_have_parity = 0, nr_have_data = 0;
int ret = 0;
- enum bch_data_type saved_data_type = req->data_type;
- struct open_buckets saved_ptrs = req->ptrs;
- unsigned saved_nr_replicas = req->nr_replicas;
- unsigned saved_nr_effective = req->nr_effective;
- bool saved_have_cache = req->have_cache;
- struct bch_devs_mask saved_devs_may_alloc = req->devs_may_alloc;
+ req->scratch_data_type = req->data_type;
+ req->scratch_ptrs = req->ptrs;
+ req->scratch_nr_replicas = req->nr_replicas;
+ req->scratch_nr_effective = req->nr_effective;
+ req->scratch_have_cache = req->have_cache;
+ req->scratch_devs_may_alloc = req->devs_may_alloc;
req->devs_may_alloc = h->devs;
req->have_cache = true;
goto err;
}
err:
- req->data_type = saved_data_type;
- req->ptrs = saved_ptrs;
- req->nr_replicas = saved_nr_replicas;
- req->nr_effective = saved_nr_effective;
- req->have_cache = saved_have_cache;
- req->devs_may_alloc = saved_devs_may_alloc;
+ req->data_type = req->scratch_data_type;
+ req->ptrs = req->scratch_ptrs;
+ req->nr_replicas = req->scratch_nr_replicas;
+ req->nr_effective = req->scratch_nr_effective;
+ req->have_cache = req->scratch_have_cache;
+ req->devs_may_alloc = req->scratch_devs_may_alloc;
return ret;
}