]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - fs/btrfs/fs.h
btrfs: add and use helpers for reading and writing last_trans_committed
[thirdparty/linux.git] / fs / btrfs / fs.h
index d04b729cbdf3353970e066b5b02a8fd118b9a82c..318df6f9d9cb6922b2dc342448a69ad1583c4cc7 100644 (file)
@@ -423,6 +423,10 @@ struct btrfs_fs_info {
         * Should always be updated using btrfs_set_fs_generation().
         */
        u64 generation;
+       /*
+        * Always use btrfs_get_last_trans_committed() and
+        * btrfs_set_last_trans_committed() to read and update this field.
+        */
        u64 last_trans_committed;
        /*
         * Generation of the last transaction used for block group relocation
@@ -833,6 +837,16 @@ static inline void btrfs_set_fs_generation(struct btrfs_fs_info *fs_info, u64 ge
        WRITE_ONCE(fs_info->generation, gen);
 }
 
+static inline u64 btrfs_get_last_trans_committed(const struct btrfs_fs_info *fs_info)
+{
+       return READ_ONCE(fs_info->last_trans_committed);
+}
+
+static inline void btrfs_set_last_trans_committed(struct btrfs_fs_info *fs_info, u64 gen)
+{
+       WRITE_ONCE(fs_info->last_trans_committed, gen);
+}
+
 static inline void btrfs_set_last_root_drop_gen(struct btrfs_fs_info *fs_info,
                                                u64 gen)
 {