X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libbcachefs%2Falloc_foreground.h;h=7aaeec44c7466cfd8aebf4d7daa9c099ff751fd2;hb=3bd4653767bb5eadd253e382fe8503ceb6bef5d1;hp=62fbf1c78ea9592708d9ec96e97205ad3ce6f6cd;hpb=934a84dfaf719af82dadbbe0e2480baff03c905b;p=bcachefs-tools-debian diff --git a/libbcachefs/alloc_foreground.h b/libbcachefs/alloc_foreground.h index 62fbf1c..7aaeec4 100644 --- a/libbcachefs/alloc_foreground.h +++ b/libbcachefs/alloc_foreground.h @@ -5,7 +5,7 @@ #include "bcachefs.h" #include "alloc_types.h" #include "extents.h" -#include "super.h" +#include "sb-members.h" #include @@ -14,7 +14,9 @@ struct bch_dev; struct bch_fs; struct bch_devs_List; -extern const char * const bch2_alloc_reserves[]; +extern const char * const bch2_watermarks[]; + +void bch2_reset_alloc_cursors(struct bch_fs *); struct dev_alloc_list { unsigned nr; @@ -29,8 +31,7 @@ void bch2_dev_stripe_increment(struct bch_dev *, struct dev_stripe_state *); long bch2_bucket_alloc_new_fs(struct bch_dev *); struct open_bucket *bch2_bucket_alloc(struct bch_fs *, struct bch_dev *, - enum alloc_reserve, bool, - struct closure *); + enum bch_watermark, struct closure *); static inline void ob_push(struct bch_fs *c, struct open_buckets *obs, struct open_bucket *ob) @@ -148,17 +149,18 @@ static inline bool bch2_bucket_is_open_safe(struct bch_fs *c, unsigned dev, u64 return ret; } -int bch2_bucket_alloc_set(struct bch_fs *, struct open_buckets *, +int bch2_bucket_alloc_set_trans(struct btree_trans *, struct open_buckets *, struct dev_stripe_state *, struct bch_devs_mask *, - unsigned, unsigned *, bool *, enum alloc_reserve, - unsigned, struct closure *); + unsigned, unsigned *, bool *, unsigned, + enum bch_data_type, enum bch_watermark, + struct closure *); int bch2_alloc_sectors_start_trans(struct btree_trans *, unsigned, unsigned, struct write_point_specifier, struct bch_devs_list *, unsigned, unsigned, - enum alloc_reserve, + enum bch_watermark, unsigned, struct closure *, struct write_point **); @@ -178,7 +180,8 @@ bch2_alloc_sectors_append_ptrs_inlined(struct bch_fs *c, struct write_point *wp, unsigned i; BUG_ON(sectors > wp->sectors_free); - wp->sectors_free -= sectors; + wp->sectors_free -= sectors; + wp->sectors_allocated += sectors; open_bucket_for_each(c, &wp->ptrs, ob, i) { struct bch_dev *ca = bch_dev_bkey_exists(c, ob->dev); @@ -199,11 +202,7 @@ void bch2_alloc_sectors_append_ptrs(struct bch_fs *, struct write_point *, struct bkey_i *, unsigned, bool); void bch2_alloc_sectors_done(struct bch_fs *, struct write_point *); -void bch2_open_buckets_stop_dev(struct bch_fs *, struct bch_dev *, - struct open_buckets *); - -void bch2_writepoint_stop(struct bch_fs *, struct bch_dev *, - struct write_point *); +void bch2_open_buckets_stop(struct bch_fs *c, struct bch_dev *, bool); static inline struct write_point_specifier writepoint_hashed(unsigned long v) { @@ -218,5 +217,8 @@ static inline struct write_point_specifier writepoint_ptr(struct write_point *wp void bch2_fs_allocator_foreground_init(struct bch_fs *); void bch2_open_buckets_to_text(struct printbuf *, struct bch_fs *); +void bch2_open_buckets_partial_to_text(struct printbuf *, struct bch_fs *); + +void bch2_write_points_to_text(struct printbuf *, struct bch_fs *); #endif /* _BCACHEFS_ALLOC_FOREGROUND_H */