diff options
-rw-r--r-- | fs/bcachefs/alloc_foreground.c | 12 | ||||
-rw-r--r-- | fs/bcachefs/alloc_foreground.h | 8 | ||||
-rw-r--r-- | fs/bcachefs/ec.c | 24 |
3 files changed, 25 insertions, 19 deletions
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c index 858a60245b92..ae7eb523fae7 100644 --- a/fs/bcachefs/alloc_foreground.c +++ b/fs/bcachefs/alloc_foreground.c @@ -829,15 +829,15 @@ static int bucket_alloc_set_writepoint(struct bch_fs *c, 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; } @@ -1214,7 +1214,7 @@ deallocate_extra_replicas(struct bch_fs *c, 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; @@ -1223,11 +1223,11 @@ deallocate_extra_replicas(struct bch_fs *c, 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; } /* diff --git a/fs/bcachefs/alloc_foreground.h b/fs/bcachefs/alloc_foreground.h index 34035dac6e43..64e1f1efe62b 100644 --- a/fs/bcachefs/alloc_foreground.h +++ b/fs/bcachefs/alloc_foreground.h @@ -36,7 +36,6 @@ struct alloc_request { /* 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; @@ -62,6 +61,13 @@ struct alloc_request { 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 *, diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c index 88ff294e977d..42600370ffb0 100644 --- a/fs/bcachefs/ec.c +++ b/fs/bcachefs/ec.c @@ -1726,12 +1726,12 @@ static int new_stripe_alloc_buckets(struct btree_trans *trans, 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; @@ -1807,12 +1807,12 @@ static int new_stripe_alloc_buckets(struct btree_trans *trans, 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; } |