]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/alloc_types.h
Update bcachefs sources to 6c5219caf0 bcachefs: Rev the on disk format version for...
[bcachefs-tools-debian] / libbcachefs / alloc_types.h
index 4f14650779947f8c854a5bf16782aaa1d277ee5b..4a1cd8b73d16b1e500a84ae9290d9bf144c502cf 100644 (file)
 
 struct ec_bucket_buf;
 
-/* There's two of these clocks, one for reads and one for writes: */
-struct bucket_clock {
-       /*
-        * "now" in (read/write) IO time - incremented whenever we do X amount
-        * of reads or writes.
-        *
-        * Goes with the bucket read/write prios: when we read or write to a
-        * bucket we reset the bucket's prio to the current hand; thus hand -
-        * prio = time since bucket was last read/written.
-        *
-        * The units are some amount (bytes/sectors) of data read/written, and
-        * the units can change on the fly if we need to rescale to fit
-        * everything in a u16 - your only guarantee is that the units are
-        * consistent.
-        */
-       u16                     hand;
-       u16                     max_last_io;
-
-       int                     rw;
-
-       struct io_timer         rescale;
-       struct mutex            lock;
+#define ALLOC_THREAD_STATES()          \
+       x(stopped)                      \
+       x(running)                      \
+       x(blocked)                      \
+       x(blocked_full)
+
+enum allocator_states {
+#define x(n)   ALLOCATOR_##n,
+       ALLOC_THREAD_STATES()
+#undef x
 };
 
-/* There is one reserve for each type of btree, one for prios and gens
- * and one for moving GC */
 enum alloc_reserve {
-       RESERVE_ALLOC           = -1,
-       RESERVE_BTREE           = 0,
-       RESERVE_MOVINGGC        = 1,
-       RESERVE_NONE            = 2,
-       RESERVE_NR              = 3,
+       RESERVE_BTREE_MOVINGGC  = -2,
+       RESERVE_BTREE           = -1,
+       RESERVE_MOVINGGC        = 0,
+       RESERVE_NONE            = 1,
+       RESERVE_NR              = 2,
 };
 
 typedef FIFO(long)     alloc_fifo;
@@ -66,6 +52,7 @@ struct open_bucket {
        u8                      type;
        unsigned                valid:1;
        unsigned                on_partial_list:1;
+       int                     alloc_reserve:3;
        unsigned                sectors_free;
        struct bch_extent_ptr   ptr;
        struct ec_stripe_new    *ec;
@@ -88,7 +75,6 @@ struct write_point {
        u64                     last_used;
        unsigned long           write_point;
        enum bch_data_type      type;
-       bool                    is_ec;
 
        /* calculated based on how many pointers we're actually going to use: */
        unsigned                sectors_free;