]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
btrfs: move BTRFS_FS_STATE* definitions and helpers to fs.h
authorJosef Bacik <josef@toxicpanda.com>
Wed, 19 Oct 2022 14:50:51 +0000 (10:50 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 5 Dec 2022 17:00:42 +0000 (18:00 +0100)
We're going to use fs.h to hold fs wide related helpers and definitions,
move the FS_STATE enum and related helpers to fs.h, and then update all
files that need these definitions to include fs.h.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
15 files changed:
fs/btrfs/compression.c
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/delalloc-space.c
fs/btrfs/delayed-inode.c
fs/btrfs/dev-replace.c
fs/btrfs/extent_io.c
fs/btrfs/free-space-cache.c
fs/btrfs/fs.h
fs/btrfs/inode-item.c
fs/btrfs/reflink.c
fs/btrfs/root-tree.c
fs/btrfs/sysfs.c
fs/btrfs/tests/btrfs-tests.c
fs/btrfs/xattr.c

index 65a4e5087215a8edd2958bc1b86e425311870547..c0615af0434f4deeff6b05ac2b67a3aedea80988 100644 (file)
@@ -23,6 +23,7 @@
 #include <crypto/hash.h>
 #include "misc.h"
 #include "ctree.h"
+#include "fs.h"
 #include "disk-io.h"
 #include "transaction.h"
 #include "btrfs_inode.h"
index f423b86f5262afe1dfb31c0ba01089fa092c4c27..7ecb658500cea5024aaaff9b6ccda3815ba8c6a7 100644 (file)
@@ -18,6 +18,7 @@
 #include "qgroup.h"
 #include "tree-mod-log.h"
 #include "tree-checker.h"
+#include "fs.h"
 
 static struct kmem_cache *btrfs_path_cachep;
 
index d27d059e4d5928bbf03e7e13a34fb11d30cf19ff..6f1eefbe3691630087122d26e352f106c7d17505 100644 (file)
@@ -67,37 +67,6 @@ static inline unsigned long btrfs_chunk_item_size(int num_stripes)
                sizeof(struct btrfs_stripe) * (num_stripes - 1);
 }
 
-/*
- * Runtime (in-memory) states of filesystem
- */
-enum {
-       /* Global indicator of serious filesystem errors */
-       BTRFS_FS_STATE_ERROR,
-       /*
-        * Filesystem is being remounted, allow to skip some operations, like
-        * defrag
-        */
-       BTRFS_FS_STATE_REMOUNTING,
-       /* Filesystem in RO mode */
-       BTRFS_FS_STATE_RO,
-       /* Track if a transaction abort has been reported on this filesystem */
-       BTRFS_FS_STATE_TRANS_ABORTED,
-       /*
-        * Bio operations should be blocked on this filesystem because a source
-        * or target device is being destroyed as part of a device replace
-        */
-       BTRFS_FS_STATE_DEV_REPLACING,
-       /* The btrfs_fs_info created for self-tests */
-       BTRFS_FS_STATE_DUMMY_FS_INFO,
-
-       BTRFS_FS_STATE_NO_CSUMS,
-
-       /* Indicates there was an error cleaning up a log tree. */
-       BTRFS_FS_STATE_LOG_CLEANUP_ERROR,
-
-       BTRFS_FS_STATE_COUNT
-};
-
 #define BTRFS_SUPER_INFO_OFFSET                        SZ_64K
 #define BTRFS_SUPER_INFO_SIZE                  4096
 static_assert(sizeof(struct btrfs_super_block) == BTRFS_SUPER_INFO_SIZE);
@@ -3224,12 +3193,6 @@ static inline unsigned long get_eb_page_index(unsigned long offset)
 #define EXPORT_FOR_TESTS
 #endif
 
-#define BTRFS_FS_ERROR(fs_info)        (unlikely(test_bit(BTRFS_FS_STATE_ERROR, \
-                                                  &(fs_info)->fs_state)))
-#define BTRFS_FS_LOG_CLEANUP_ERROR(fs_info)                            \
-       (unlikely(test_bit(BTRFS_FS_STATE_LOG_CLEANUP_ERROR,            \
-                          &(fs_info)->fs_state)))
-
 /* acl.c */
 #ifdef CONFIG_BTRFS_FS_POSIX_ACL
 struct posix_acl *btrfs_get_acl(struct inode *inode, int type, bool rcu);
@@ -3327,15 +3290,6 @@ static inline int btrfs_get_verity_descriptor(struct inode *inode, void *buf,
 /* Sanity test specific functions */
 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
 void btrfs_test_destroy_inode(struct inode *inode);
-static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)
-{
-       return test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state);
-}
-#else
-static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)
-{
-       return 0;
-}
 #endif
 
 static inline bool btrfs_is_data_reloc_root(const struct btrfs_root *root)
index 045545145a2b8513d05ecba97ac54cc8d5fe52b3..605d8874a446262678340da6e5f3453441fcc588 100644 (file)
@@ -9,6 +9,7 @@
 #include "transaction.h"
 #include "qgroup.h"
 #include "block-group.h"
+#include "fs.h"
 
 /*
  * HOW DOES THIS WORK
index 8cf5ee64614759fe980444db7ada607eed1872a6..2f68570fbb53821bfe01a11a446fdabdf4197f55 100644 (file)
@@ -6,12 +6,13 @@
 
 #include <linux/slab.h>
 #include <linux/iversion.h>
+#include "ctree.h"
+#include "fs.h"
 #include "messages.h"
 #include "misc.h"
 #include "delayed-inode.h"
 #include "disk-io.h"
 #include "transaction.h"
-#include "ctree.h"
 #include "qgroup.h"
 #include "locking.h"
 #include "inode-item.h"
index 61e58066b5fd2bbd6216e84b58896216d042135f..348aef453e699e06c9c9852f09030a2cd2e8ceaa 100644 (file)
@@ -23,6 +23,7 @@
 #include "sysfs.h"
 #include "zoned.h"
 #include "block-group.h"
+#include "fs.h"
 
 /*
  * Device replace overview
index 78d7ea10621d2d583023f8ba4581d643f691d485..aa2d60f683bb213d3663388c0b2eb852fb6bd183 100644 (file)
@@ -30,6 +30,7 @@
 #include "zoned.h"
 #include "block-group.h"
 #include "compression.h"
+#include "fs.h"
 
 static struct kmem_cache *extent_buffer_cache;
 
index 83d866f5ab6cdbf42a535ffe483aa8f5ee1e1c0c..703902156f97195924f20e3354d2879d80c91dbb 100644 (file)
 #include <linux/ratelimit.h>
 #include <linux/error-injection.h>
 #include <linux/sched/mm.h>
+#include "ctree.h"
+#include "fs.h"
 #include "messages.h"
 #include "misc.h"
-#include "ctree.h"
 #include "free-space-cache.h"
 #include "transaction.h"
 #include "disk-io.h"
index 8eda9ce0a904a2d2c306e0856581b9799bdfe03f..25487af14717965f33cb1c0600156980035f5528 100644 (file)
@@ -3,6 +3,37 @@
 #ifndef BTRFS_FS_H
 #define BTRFS_FS_H
 
+/*
+ * Runtime (in-memory) states of filesystem
+ */
+enum {
+       /* Global indicator of serious filesystem errors */
+       BTRFS_FS_STATE_ERROR,
+       /*
+        * Filesystem is being remounted, allow to skip some operations, like
+        * defrag
+        */
+       BTRFS_FS_STATE_REMOUNTING,
+       /* Filesystem in RO mode */
+       BTRFS_FS_STATE_RO,
+       /* Track if a transaction abort has been reported on this filesystem */
+       BTRFS_FS_STATE_TRANS_ABORTED,
+       /*
+        * Bio operations should be blocked on this filesystem because a source
+        * or target device is being destroyed as part of a device replace
+        */
+       BTRFS_FS_STATE_DEV_REPLACING,
+       /* The btrfs_fs_info created for self-tests */
+       BTRFS_FS_STATE_DUMMY_FS_INFO,
+
+       BTRFS_FS_STATE_NO_CSUMS,
+
+       /* Indicates there was an error cleaning up a log tree. */
+       BTRFS_FS_STATE_LOG_CLEANUP_ERROR,
+
+       BTRFS_FS_STATE_COUNT
+};
+
 /* Compatibility and incompatibility defines */
 void __btrfs_set_fs_incompat(struct btrfs_fs_info *fs_info, u64 flag,
                             const char *name);
@@ -82,4 +113,22 @@ static inline void btrfs_clear_sb_rdonly(struct super_block *sb)
        clear_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
 }
 
+#define BTRFS_FS_ERROR(fs_info)        (unlikely(test_bit(BTRFS_FS_STATE_ERROR, \
+                                                  &(fs_info)->fs_state)))
+#define BTRFS_FS_LOG_CLEANUP_ERROR(fs_info)                            \
+       (unlikely(test_bit(BTRFS_FS_STATE_LOG_CLEANUP_ERROR,            \
+                          &(fs_info)->fs_state)))
+
+#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
+static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)
+{
+       return test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state);
+}
+#else
+static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)
+{
+       return 0;
+}
+#endif
+
 #endif
index b301d8e3df8771d4ecf17e2719814a64f0e55f86..25e9f1d650676e004285db06f37d3a8dfc6881fe 100644 (file)
@@ -3,8 +3,9 @@
  * Copyright (C) 2007 Oracle.  All rights reserved.
  */
 
-#include "messages.h"
 #include "ctree.h"
+#include "fs.h"
+#include "messages.h"
 #include "inode-item.h"
 #include "disk-io.h"
 #include "transaction.h"
index 6179864de6e7aed5636b905ed565028a554c6dbf..daf65bfad30e19c3711f48fa2aaa191097f72cfb 100644 (file)
@@ -2,9 +2,10 @@
 
 #include <linux/blkdev.h>
 #include <linux/iversion.h>
+#include "ctree.h"
+#include "fs.h"
 #include "messages.h"
 #include "compression.h"
-#include "ctree.h"
 #include "delalloc-space.h"
 #include "disk-io.h"
 #include "reflink.h"
index 44c8c8ad0a16c3d9f7e97a0d8ff0701143f85376..112b4bf3c3b80d13c9035b4a5c37940ec6d60db5 100644 (file)
@@ -5,8 +5,9 @@
 
 #include <linux/err.h>
 #include <linux/uuid.h>
-#include "messages.h"
 #include "ctree.h"
+#include "fs.h"
+#include "messages.h"
 #include "transaction.h"
 #include "disk-io.h"
 #include "print-tree.h"
index 0b6bea00742c2ef405dd300c915b1a433710d137..31fb6cb389b1f1dc943d44b8f1d9346dab4758f7 100644 (file)
@@ -22,6 +22,7 @@
 #include "block-group.h"
 #include "qgroup.h"
 #include "misc.h"
+#include "fs.h"
 
 /*
  * Structure name                       Path
index d43cb5242fec920b6a1792279a25c6f0cccb7c09..669fa7133a2f414dce15f20e2cdd2d44954bdbd6 100644 (file)
@@ -16,6 +16,7 @@
 #include "../disk-io.h"
 #include "../qgroup.h"
 #include "../block-group.h"
+#include "../fs.h"
 
 static struct vfsmount *test_mnt = NULL;
 
index d12903f01f835e2d6f61857fa9f2443cb200317e..b26c869f02262e65834b1d55aee8afa4291e3b7a 100644 (file)
@@ -12,8 +12,9 @@
 #include <linux/posix_acl_xattr.h>
 #include <linux/iversion.h>
 #include <linux/sched/mm.h>
-#include "messages.h"
 #include "ctree.h"
+#include "fs.h"
+#include "messages.h"
 #include "btrfs_inode.h"
 #include "transaction.h"
 #include "xattr.h"