]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/alloc_types.h
Update bcachefs sources to eabde7cb37 fixup! bcachefs: Optimize bch2_alloc_to_v4()
[bcachefs-tools-debian] / libbcachefs / alloc_types.h
index 21b56451bc1811a35edc7e810f13b8cb1f3d1b4a..330267346c639fda85f8fa8ea1f0c2e07f35217f 100644 (file)
@@ -8,6 +8,15 @@
 #include "clock_types.h"
 #include "fifo.h"
 
+struct bucket_alloc_state {
+       u64     cur_bucket;
+       u64     buckets_seen;
+       u64     skipped_open;
+       u64     skipped_need_journal_commit;
+       u64     skipped_nocow;
+       u64     skipped_nouse;
+};
+
 struct ec_bucket_buf;
 
 #define BCH_ALLOC_RESERVES()           \
@@ -43,14 +52,14 @@ struct open_bucket {
         * the block in the stripe this open_bucket corresponds to:
         */
        u8                      ec_idx;
-       enum bch_data_type      data_type:3;
+       enum bch_data_type      data_type:8;
        unsigned                valid:1;
        unsigned                on_partial_list:1;
-       int                     alloc_reserve:3;
+       unsigned                alloc_reserve:3;
 
-       unsigned                sectors_free;
        u8                      dev;
        u8                      gen;
+       u32                     sectors_free;
        u64                     bucket;
        struct ec_stripe_new    *ec;
 };
@@ -67,17 +76,26 @@ struct dev_stripe_state {
 };
 
 struct write_point {
-       struct hlist_node       node;
-       struct mutex            lock;
-       u64                     last_used;
-       unsigned long           write_point;
-       enum bch_data_type      data_type;
-
-       /* calculated based on how many pointers we're actually going to use: */
-       unsigned                sectors_free;
-
-       struct open_buckets     ptrs;
-       struct dev_stripe_state stripe;
+       struct {
+               struct hlist_node       node;
+               struct mutex            lock;
+               u64                     last_used;
+               unsigned long           write_point;
+               enum bch_data_type      data_type;
+
+               /* calculated based on how many pointers we're actually going to use: */
+               unsigned                sectors_free;
+
+               struct open_buckets     ptrs;
+               struct dev_stripe_state stripe;
+       } __attribute__((__aligned__(SMP_CACHE_BYTES)));
+
+       struct {
+               struct work_struct      index_update_work;
+
+               struct list_head        writes;
+               spinlock_t              writes_lock;
+       } __attribute__((__aligned__(SMP_CACHE_BYTES)));
 };
 
 struct write_point_specifier {