summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-03-31 17:57:06 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-05-21 20:13:40 -0400
commit95f2315af7536c220301421eff6291c80ec321e5 (patch)
treef3683cb886da46eba18beb41e99642aa140ea53b
parente038213658f09bc775a67cf8e18f0aec4b0f7679 (diff)
downloadlinux-95f2315af7536c220301421eff6291c80ec321e5.tar.gz
linux-95f2315af7536c220301421eff6291c80ec321e5.zip
bcachefs: alloc_request.ptrs2
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/alloc_foreground.c14
-rw-r--r--fs/bcachefs/alloc_foreground.h1
2 files changed, 9 insertions, 6 deletions
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c
index 642d22643558..f546b4fcd58f 100644
--- a/fs/bcachefs/alloc_foreground.c
+++ b/fs/bcachefs/alloc_foreground.c
@@ -825,18 +825,19 @@ static bool want_bucket(struct bch_fs *c,
static int bucket_alloc_set_writepoint(struct bch_fs *c,
struct alloc_request *req)
{
- struct open_buckets ptrs_skip = { .nr = 0 };
struct open_bucket *ob;
unsigned i;
int ret = 0;
+ req->ptrs2.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, &ptrs_skip, ob);
+ ob_push(c, &req->ptrs2, ob);
}
- req->wp->ptrs = ptrs_skip;
+ req->wp->ptrs = req->ptrs2;
return ret;
}
@@ -1209,11 +1210,12 @@ static noinline void
deallocate_extra_replicas(struct bch_fs *c,
struct alloc_request *req)
{
- struct open_buckets ptrs2 = { 0 };
struct open_bucket *ob;
unsigned extra_replicas = req->nr_effective - req->nr_replicas;
unsigned i;
+ req->ptrs2.nr = 0;
+
open_bucket_for_each(c, &req->ptrs, ob, i) {
unsigned d = ob_dev(c, ob)->mi.durability;
@@ -1221,11 +1223,11 @@ deallocate_extra_replicas(struct bch_fs *c,
extra_replicas -= d;
ob_push(c, &req->wp->ptrs, ob);
} else {
- ob_push(c, &ptrs2, ob);
+ ob_push(c, &req->ptrs2, ob);
}
}
- req->ptrs = ptrs2;
+ req->ptrs = req->ptrs2;
}
/*
diff --git a/fs/bcachefs/alloc_foreground.h b/fs/bcachefs/alloc_foreground.h
index 7117e1e5c6d9..ae8ca3b7786b 100644
--- a/fs/bcachefs/alloc_foreground.h
+++ b/fs/bcachefs/alloc_foreground.h
@@ -36,6 +36,7 @@ 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;