diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-01-21 15:32:13 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:14 -0400 |
commit | 7ef2a73a5881323d53453cc3be7261fe1a49af1d (patch) | |
tree | 85e8d67b00a6c28dd8691e79d1674c111e8a1328 /fs/bcachefs/replicas.h | |
parent | dbaee468461bfa82e6453ca0e009e9661cc570da (diff) | |
download | lwn-7ef2a73a5881323d53453cc3be7261fe1a49af1d.tar.gz lwn-7ef2a73a5881323d53453cc3be7261fe1a49af1d.zip |
bcachefs: Fix check for if extent update is allocating
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/replicas.h')
-rw-r--r-- | fs/bcachefs/replicas.h | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/fs/bcachefs/replicas.h b/fs/bcachefs/replicas.h index 03aaafdc7c17..923bddb21ec3 100644 --- a/fs/bcachefs/replicas.h +++ b/fs/bcachefs/replicas.h @@ -2,17 +2,42 @@ #ifndef _BCACHEFS_REPLICAS_H #define _BCACHEFS_REPLICAS_H +#include "eytzinger.h" #include "replicas_types.h" -bool bch2_replicas_marked(struct bch_fs *, enum bch_data_type, - struct bch_devs_list, bool); +void bch2_replicas_entry_to_text(struct printbuf *, + struct bch_replicas_entry *); +void bch2_cpu_replicas_to_text(struct printbuf *, struct bch_replicas_cpu *); + +static inline struct bch_replicas_entry * +cpu_replicas_entry(struct bch_replicas_cpu *r, unsigned i) +{ + return (void *) r->entries + r->entry_size * i; +} + +int bch2_replicas_entry_idx(struct bch_fs *, + struct bch_replicas_entry *); + +void bch2_devlist_to_replicas(struct bch_replicas_entry *, + enum bch_data_type, + struct bch_devs_list); +bool bch2_replicas_marked(struct bch_fs *, + struct bch_replicas_entry *, bool); +int bch2_mark_replicas(struct bch_fs *, + struct bch_replicas_entry *); + bool bch2_bkey_replicas_marked(struct bch_fs *, struct bkey_s_c, bool); -int bch2_mark_replicas(struct bch_fs *, enum bch_data_type, - struct bch_devs_list); int bch2_mark_bkey_replicas(struct bch_fs *, struct bkey_s_c); -void bch2_cpu_replicas_to_text(struct printbuf *, struct bch_replicas_cpu *); +static inline void bch2_replicas_entry_cached(struct bch_replicas_entry *e, + unsigned dev) +{ + e->data_type = BCH_DATA_CACHED; + e->nr_devs = 1; + e->nr_required = 1; + e->devs[0] = dev; +} struct replicas_status { struct { |