]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/bcachefs.h
Update bcachefs sources to aa439f3b94 bcachefs: btree_gc no longer uses main in-memor...
[bcachefs-tools-debian] / libbcachefs / bcachefs.h
index 540492b04457c68abd6307b1098e154b3f9e8189..ddd700c3baa3122349d739af18cc1af174f7cff2 100644 (file)
@@ -445,6 +445,7 @@ struct bch_dev {
         * Or rcu_read_lock(), but only for ptr_stale():
         */
        struct bucket_array __rcu *buckets[2];
+       struct bucket_gens      *bucket_gens;
        unsigned long           *buckets_nouse;
        struct rw_semaphore     bucket_lock;
 
@@ -453,6 +454,7 @@ struct bch_dev {
        struct bch_dev_usage __percpu   *usage_gc;
 
        /* Allocator: */
+       u64                     new_fs_bucket_idx;
        struct task_struct __rcu *alloc_thread;
 
        /*
@@ -508,7 +510,6 @@ enum {
        BCH_FS_INITIAL_GC_DONE,
        BCH_FS_INITIAL_GC_UNFIXED,
        BCH_FS_TOPOLOGY_REPAIR_DONE,
-       BCH_FS_BTREE_INTERIOR_REPLAY_DONE,
        BCH_FS_FSCK_DONE,
        BCH_FS_STARTED,
        BCH_FS_RW,
@@ -528,7 +529,6 @@ enum {
        /* misc: */
        BCH_FS_NEED_ANOTHER_GC,
        BCH_FS_DELETED_NODES,
-       BCH_FS_NEED_ALLOC_WRITE,
        BCH_FS_REBUILD_REPLICAS,
        BCH_FS_HOLD_BTREE_WRITES,
 };
@@ -558,6 +558,7 @@ struct journal_keys {
                enum btree_id   btree_id:8;
                unsigned        level:8;
                bool            allocated;
+               bool            overwritten;
                struct bkey_i   *k;
                u32             journal_seq;
                u32             journal_offset;
@@ -634,7 +635,6 @@ struct bch_fs {
 
                u16             version;
                u16             version_min;
-               u16             encoded_extent_max;
 
                u8              nr_devices;
                u8              clean;
@@ -749,17 +749,18 @@ struct bch_fs {
        /* JOURNAL SEQ BLACKLIST */
        struct journal_seq_blacklist_table *
                                journal_seq_blacklist_table;
-       struct work_struct      journal_seq_blacklist_gc_work;
 
        /* ALLOCATOR */
        spinlock_t              freelist_lock;
        struct closure_waitlist freelist_wait;
        u64                     blocked_allocate;
        u64                     blocked_allocate_open_bucket;
+
        open_bucket_idx_t       open_buckets_freelist;
        open_bucket_idx_t       open_buckets_nr_free;
        struct closure_waitlist open_buckets_wait;
        struct open_bucket      open_buckets[OPEN_BUCKETS_COUNT];
+       open_bucket_idx_t       open_buckets_hash[OPEN_BUCKETS_COUNT];
 
        struct write_point      btree_write_point;
        struct write_point      rebalance_write_point;
@@ -856,7 +857,6 @@ struct bch_fs {
        u64                     reflink_hint;
        reflink_gc_table        reflink_gc_table;
        size_t                  reflink_gc_nr;
-       size_t                  reflink_gc_idx;
 
        /* VFS IO PATH - fs-io.c */
        struct bio_set          writepage_bioset;
@@ -928,10 +928,20 @@ static inline unsigned bucket_bytes(const struct bch_dev *ca)
 
 static inline unsigned block_bytes(const struct bch_fs *c)
 {
-       return c->opts.block_size << 9;
+       return c->opts.block_size;
+}
+
+static inline unsigned block_sectors(const struct bch_fs *c)
+{
+       return c->opts.block_size >> 9;
+}
+
+static inline size_t btree_sectors(const struct bch_fs *c)
+{
+       return c->opts.btree_node_size >> 9;
 }
 
-static inline struct timespec64 bch2_time_to_timespec(struct bch_fs *c, s64 time)
+static inline struct timespec64 bch2_time_to_timespec(const struct bch_fs *c, s64 time)
 {
        struct timespec64 t;
        s32 rem;
@@ -943,13 +953,13 @@ static inline struct timespec64 bch2_time_to_timespec(struct bch_fs *c, s64 time
        return t;
 }
 
-static inline s64 timespec_to_bch2_time(struct bch_fs *c, struct timespec64 ts)
+static inline s64 timespec_to_bch2_time(const struct bch_fs *c, struct timespec64 ts)
 {
        return (ts.tv_sec * c->sb.time_units_per_sec +
                (int) ts.tv_nsec / c->sb.nsec_per_time_unit) - c->sb.time_base_lo;
 }
 
-static inline s64 bch2_current_time(struct bch_fs *c)
+static inline s64 bch2_current_time(const struct bch_fs *c)
 {
        struct timespec64 now;