summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/alloc_foreground.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-03-21 20:42:42 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-05-21 20:13:27 -0400
commitad63f9f1e9a10792847bc46f0226323f238a171d (patch)
treebf7b22e867c81890552c0411c232558a4fe855f2 /fs/bcachefs/alloc_foreground.h
parentbcachefs: trace bch2_trans_kmalloc() (diff)
downloadlinux-ad63f9f1e9a10792847bc46f0226323f238a171d.tar.gz
linux-ad63f9f1e9a10792847bc46f0226323f238a171d.zip
bcachefs: struct alloc_request
Add a struct for common state for satisfying an on disk allocation, instead of passing the same long list of items to every function. This will help with stack usage, performance, and perhaps enable some code cleanups. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_foreground.h')
-rw-r--r--fs/bcachefs/alloc_foreground.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/fs/bcachefs/alloc_foreground.h b/fs/bcachefs/alloc_foreground.h
index 4c1e33cf57c0..874aadf34ebf 100644
--- a/fs/bcachefs/alloc_foreground.h
+++ b/fs/bcachefs/alloc_foreground.h
@@ -5,6 +5,7 @@
#include "bcachefs.h"
#include "alloc_types.h"
#include "extents.h"
+#include "io_write_types.h"
#include "sb-members.h"
#include <linux/hash.h>
@@ -23,6 +24,22 @@ struct dev_alloc_list {
u8 data[BCH_SB_MEMBERS_MAX];
};
+struct alloc_request {
+ unsigned nr_replicas;
+ unsigned target;
+ bool ec;
+ enum bch_watermark watermark;
+ enum bch_write_flags flags;
+ struct bch_devs_list *devs_have;
+
+ struct write_point *wp;
+ struct open_buckets ptrs;
+ unsigned nr_effective;
+ bool have_cache;
+
+ struct bch_devs_mask devs_may_alloc;
+};
+
struct dev_alloc_list bch2_dev_alloc_list(struct bch_fs *,
struct dev_stripe_state *,
struct bch_devs_mask *);
@@ -173,11 +190,9 @@ static inline bool bch2_bucket_is_open_safe(struct bch_fs *c, unsigned dev, u64
}
enum bch_write_flags;
-int bch2_bucket_alloc_set_trans(struct btree_trans *, struct open_buckets *,
- struct dev_stripe_state *, struct bch_devs_mask *,
- unsigned, unsigned *, bool *, enum bch_write_flags,
- enum bch_data_type, enum bch_watermark,
- struct closure *);
+int bch2_bucket_alloc_set_trans(struct btree_trans *, struct alloc_request *,
+ struct dev_stripe_state *, enum bch_data_type,
+ struct closure *);
int bch2_alloc_sectors_start_trans(struct btree_trans *,
unsigned, unsigned,