]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - fs/btrfs/fs.h
btrfs: add and use helpers for reading and writing fs_info->generation
[thirdparty/linux.git] / fs / btrfs / fs.h
index a523d64d54912a46e6ca175ccd9d39f1997a8303..d04b729cbdf3353970e066b5b02a8fd118b9a82c 100644 (file)
@@ -139,6 +139,12 @@ enum {
         */
        BTRFS_FS_FEATURE_CHANGED,
 
+       /*
+        * Indicate that we have found a tree block which is only aligned to
+        * sectorsize, but not to nodesize.  This should be rare nowadays.
+        */
+       BTRFS_FS_UNALIGNED_TREE_BLOCK,
+
 #if BITS_PER_LONG == 32
        /* Indicate if we have error/warn message printed on 32bit systems */
        BTRFS_FS_32BIT_ERROR,
@@ -171,19 +177,17 @@ enum {
        BTRFS_MOUNT_AUTO_DEFRAG                 = (1UL << 16),
        BTRFS_MOUNT_USEBACKUPROOT               = (1UL << 17),
        BTRFS_MOUNT_SKIP_BALANCE                = (1UL << 18),
-       BTRFS_MOUNT_CHECK_INTEGRITY             = (1UL << 19),
-       BTRFS_MOUNT_CHECK_INTEGRITY_DATA        = (1UL << 20),
-       BTRFS_MOUNT_PANIC_ON_FATAL_ERROR        = (1UL << 21),
-       BTRFS_MOUNT_RESCAN_UUID_TREE            = (1UL << 22),
-       BTRFS_MOUNT_FRAGMENT_DATA               = (1UL << 23),
-       BTRFS_MOUNT_FRAGMENT_METADATA           = (1UL << 24),
-       BTRFS_MOUNT_FREE_SPACE_TREE             = (1UL << 25),
-       BTRFS_MOUNT_NOLOGREPLAY                 = (1UL << 26),
-       BTRFS_MOUNT_REF_VERIFY                  = (1UL << 27),
-       BTRFS_MOUNT_DISCARD_ASYNC               = (1UL << 28),
-       BTRFS_MOUNT_IGNOREBADROOTS              = (1UL << 29),
-       BTRFS_MOUNT_IGNOREDATACSUMS             = (1UL << 30),
-       BTRFS_MOUNT_NODISCARD                   = (1UL << 31),
+       BTRFS_MOUNT_PANIC_ON_FATAL_ERROR        = (1UL << 19),
+       BTRFS_MOUNT_RESCAN_UUID_TREE            = (1UL << 20),
+       BTRFS_MOUNT_FRAGMENT_DATA               = (1UL << 21),
+       BTRFS_MOUNT_FRAGMENT_METADATA           = (1UL << 22),
+       BTRFS_MOUNT_FREE_SPACE_TREE             = (1UL << 23),
+       BTRFS_MOUNT_NOLOGREPLAY                 = (1UL << 24),
+       BTRFS_MOUNT_REF_VERIFY                  = (1UL << 25),
+       BTRFS_MOUNT_DISCARD_ASYNC               = (1UL << 26),
+       BTRFS_MOUNT_IGNOREBADROOTS              = (1UL << 27),
+       BTRFS_MOUNT_IGNOREDATACSUMS             = (1UL << 28),
+       BTRFS_MOUNT_NODISCARD                   = (1UL << 29),
 };
 
 /*
@@ -216,7 +220,8 @@ enum {
         BTRFS_FEATURE_INCOMPAT_NO_HOLES        |       \
         BTRFS_FEATURE_INCOMPAT_METADATA_UUID   |       \
         BTRFS_FEATURE_INCOMPAT_RAID1C34        |       \
-        BTRFS_FEATURE_INCOMPAT_ZONED)
+        BTRFS_FEATURE_INCOMPAT_ZONED           |       \
+        BTRFS_FEATURE_INCOMPAT_SIMPLE_QUOTA)
 
 #ifdef CONFIG_BTRFS_DEBUG
        /*
@@ -225,6 +230,7 @@ enum {
         */
 #define BTRFS_FEATURE_INCOMPAT_SUPP            \
        (BTRFS_FEATURE_INCOMPAT_SUPP_STABLE |   \
+        BTRFS_FEATURE_INCOMPAT_RAID_STRIPE_TREE | \
         BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2)
 
 #else
@@ -369,6 +375,7 @@ struct btrfs_fs_info {
        struct btrfs_root *uuid_root;
        struct btrfs_root *data_reloc_root;
        struct btrfs_root *block_group_root;
+       struct btrfs_root *stripe_root;
 
        /* The log root tree is a directory of all the other log roots */
        struct btrfs_root *log_root_tree;
@@ -409,6 +416,12 @@ struct btrfs_fs_info {
 
        struct btrfs_block_rsv empty_block_rsv;
 
+       /*
+        * Updated while holding the lock 'trans_lock'. Due to the life cycle of
+        * a transaction, it can be directly read while holding a transaction
+        * handle, everywhere else must be read with btrfs_get_fs_generation().
+        * Should always be updated using btrfs_set_fs_generation().
+        */
        u64 generation;
        u64 last_trans_committed;
        /*
@@ -645,9 +658,6 @@ struct btrfs_fs_info {
 
        struct btrfs_discard_ctl discard_ctl;
 
-#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
-       u32 check_integrity_print_mask;
-#endif
        /* Is qgroup tracking in a consistent state? */
        u64 qgroup_flags;
 
@@ -683,6 +693,7 @@ struct btrfs_fs_info {
        /* Protected by qgroup_rescan_lock */
        bool qgroup_rescan_running;
        u8 qgroup_drop_subtree_thres;
+       u64 qgroup_enable_gen;
 
        /*
         * If this is not 0, then it indicates a serious filesystem error has
@@ -812,6 +823,16 @@ struct btrfs_fs_info {
 #endif
 };
 
+static inline u64 btrfs_get_fs_generation(const struct btrfs_fs_info *fs_info)
+{
+       return READ_ONCE(fs_info->generation);
+}
+
+static inline void btrfs_set_fs_generation(struct btrfs_fs_info *fs_info, u64 gen)
+{
+       WRITE_ONCE(fs_info->generation, gen);
+}
+
 static inline void btrfs_set_last_root_drop_gen(struct btrfs_fs_info *fs_info,
                                                u64 gen)
 {