diff options
Diffstat (limited to 'libbcachefs/alloc.h')
-rw-r--r-- | libbcachefs/alloc.h | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/libbcachefs/alloc.h b/libbcachefs/alloc.h index cfd1c8ef..f07f1bfc 100644 --- a/libbcachefs/alloc.h +++ b/libbcachefs/alloc.h @@ -1,5 +1,5 @@ -#ifndef _BCACHE_ALLOC_H -#define _BCACHE_ALLOC_H +#ifndef _BCACHEFS_ALLOC_H +#define _BCACHEFS_ALLOC_H #include "bcachefs.h" #include "alloc_types.h" @@ -10,11 +10,18 @@ struct bch_dev; struct bch_fs; struct dev_group; -void bch2_dev_group_remove(struct dev_group *, struct bch_dev *); -void bch2_dev_group_add(struct dev_group *, struct bch_dev *); +struct dev_alloc_list { + unsigned nr; + u8 devs[BCH_SB_MEMBERS_MAX]; +}; + +struct dev_alloc_list bch2_wp_alloc_list(struct bch_fs *, + struct write_point *, + struct bch_devs_mask *); +void bch2_wp_rescale(struct bch_fs *, struct bch_dev *, + struct write_point *); int bch2_alloc_read(struct bch_fs *, struct list_head *); -int bch2_alloc_write(struct bch_fs *, struct bch_dev *, u64 *); int bch2_alloc_replay_key(struct bch_fs *, struct bpos); long bch2_bucket_alloc(struct bch_fs *, struct bch_dev *, enum alloc_reserve); @@ -46,24 +53,6 @@ static inline void bch2_wake_allocator(struct bch_dev *ca) rcu_read_unlock(); } -static inline struct bch_dev *dev_group_next(struct dev_group *devs, - unsigned *iter) -{ - struct bch_dev *ret = NULL; - - while (*iter < devs->nr && - !(ret = rcu_dereference_check(devs->d[*iter].dev, - lockdep_is_held(&devs->lock)))) - (*iter)++; - - return ret; -} - -#define group_for_each_dev(ca, devs, iter) \ - for ((iter) = 0; \ - ((ca) = dev_group_next((devs), &(iter))); \ - (iter)++) - #define open_bucket_for_each_ptr(_ob, _ptr) \ for ((_ptr) = (_ob)->ptrs; \ (_ptr) < (_ob)->ptrs + (_ob)->nr_ptrs; \ @@ -81,4 +70,4 @@ void bch2_fs_allocator_init(struct bch_fs *); extern const struct bkey_ops bch2_bkey_alloc_ops; -#endif /* _BCACHE_ALLOC_H */ +#endif /* _BCACHEFS_ALLOC_H */ |