]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
btrfs: move mount option definitions to fs.h
authorJosef Bacik <josef@toxicpanda.com>
Wed, 19 Oct 2022 14:50:53 +0000 (10:50 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 5 Dec 2022 17:00:42 +0000 (18:00 +0100)
These are fs wide definitions and helpers, move them out of ctree.h and
into 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>
fs/btrfs/block-rsv.c
fs/btrfs/ctree.h
fs/btrfs/delayed-ref.c
fs/btrfs/discard.c
fs/btrfs/fs.h
fs/btrfs/ref-verify.c

index 89e3e7d1bff63323722c4e55db86df6fdc6edfc1..a48fa7ac74ccf75bc49998f202034ac1b279e861 100644 (file)
@@ -7,6 +7,7 @@
 #include "transaction.h"
 #include "block-group.h"
 #include "disk-io.h"
+#include "fs.h"
 
 /*
  * HOW DO BLOCK RESERVES WORK
index 6f1eefbe3691630087122d26e352f106c7d17505..86af9d36fdf7ac46cc560b55970fbfcb6a42560f 100644 (file)
@@ -1328,69 +1328,6 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info)
        return BTRFS_MAX_ITEM_SIZE(info) - sizeof(struct btrfs_dir_item);
 }
 
-/*
- * Flags for mount options.
- *
- * Note: don't forget to add new options to btrfs_show_options()
- */
-enum {
-       BTRFS_MOUNT_NODATASUM                   = (1UL << 0),
-       BTRFS_MOUNT_NODATACOW                   = (1UL << 1),
-       BTRFS_MOUNT_NOBARRIER                   = (1UL << 2),
-       BTRFS_MOUNT_SSD                         = (1UL << 3),
-       BTRFS_MOUNT_DEGRADED                    = (1UL << 4),
-       BTRFS_MOUNT_COMPRESS                    = (1UL << 5),
-       BTRFS_MOUNT_NOTREELOG                   = (1UL << 6),
-       BTRFS_MOUNT_FLUSHONCOMMIT               = (1UL << 7),
-       BTRFS_MOUNT_SSD_SPREAD                  = (1UL << 8),
-       BTRFS_MOUNT_NOSSD                       = (1UL << 9),
-       BTRFS_MOUNT_DISCARD_SYNC                = (1UL << 10),
-       BTRFS_MOUNT_FORCE_COMPRESS              = (1UL << 11),
-       BTRFS_MOUNT_SPACE_CACHE                 = (1UL << 12),
-       BTRFS_MOUNT_CLEAR_CACHE                 = (1UL << 13),
-       BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED      = (1UL << 14),
-       BTRFS_MOUNT_ENOSPC_DEBUG                = (1UL << 15),
-       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),
-};
-
-#define BTRFS_DEFAULT_COMMIT_INTERVAL  (30)
-#define BTRFS_DEFAULT_MAX_INLINE       (2048)
-
-#define btrfs_clear_opt(o, opt)                ((o) &= ~BTRFS_MOUNT_##opt)
-#define btrfs_set_opt(o, opt)          ((o) |= BTRFS_MOUNT_##opt)
-#define btrfs_raw_test_opt(o, opt)     ((o) & BTRFS_MOUNT_##opt)
-#define btrfs_test_opt(fs_info, opt)   ((fs_info)->mount_opt & \
-                                        BTRFS_MOUNT_##opt)
-
-#define btrfs_set_and_info(fs_info, opt, fmt, args...)                 \
-do {                                                                   \
-       if (!btrfs_test_opt(fs_info, opt))                              \
-               btrfs_info(fs_info, fmt, ##args);                       \
-       btrfs_set_opt(fs_info->mount_opt, opt);                         \
-} while (0)
-
-#define btrfs_clear_and_info(fs_info, opt, fmt, args...)               \
-do {                                                                   \
-       if (btrfs_test_opt(fs_info, opt))                               \
-               btrfs_info(fs_info, fmt, ##args);                       \
-       btrfs_clear_opt(fs_info->mount_opt, opt);                       \
-} while (0)
-
 /*
  * Requests for changes that need to be done during transaction commit.
  *
index c775ff4f1cb1526aa9bf20c02b6b3b75ad3fae49..010cc16297d868c95738215e0db32dc22244f9c0 100644 (file)
@@ -13,6 +13,7 @@
 #include "qgroup.h"
 #include "space-info.h"
 #include "tree-mod-log.h"
+#include "fs.h"
 
 struct kmem_cache *btrfs_delayed_ref_head_cachep;
 struct kmem_cache *btrfs_delayed_tree_ref_cachep;
index e1b7bd927d69148bb79f82d29cfa0991027d60a7..51f0ef386046f938d169e7392278f2c9f5b65137 100644 (file)
@@ -11,6 +11,7 @@
 #include "block-group.h"
 #include "discard.h"
 #include "free-space-cache.h"
+#include "fs.h"
 
 /*
  * This contains the logic to handle async discard.
index 682542ed964fb35a564a89c7758bbe23190e27f3..4799812a7351dd3b5d450f3d10bc2a00a7b7fdc4 100644 (file)
@@ -34,6 +34,49 @@ enum {
        BTRFS_FS_STATE_COUNT
 };
 
+/*
+ * Flags for mount options.
+ *
+ * Note: don't forget to add new options to btrfs_show_options()
+ */
+enum {
+       BTRFS_MOUNT_NODATASUM                   = (1UL << 0),
+       BTRFS_MOUNT_NODATACOW                   = (1UL << 1),
+       BTRFS_MOUNT_NOBARRIER                   = (1UL << 2),
+       BTRFS_MOUNT_SSD                         = (1UL << 3),
+       BTRFS_MOUNT_DEGRADED                    = (1UL << 4),
+       BTRFS_MOUNT_COMPRESS                    = (1UL << 5),
+       BTRFS_MOUNT_NOTREELOG                   = (1UL << 6),
+       BTRFS_MOUNT_FLUSHONCOMMIT               = (1UL << 7),
+       BTRFS_MOUNT_SSD_SPREAD                  = (1UL << 8),
+       BTRFS_MOUNT_NOSSD                       = (1UL << 9),
+       BTRFS_MOUNT_DISCARD_SYNC                = (1UL << 10),
+       BTRFS_MOUNT_FORCE_COMPRESS              = (1UL << 11),
+       BTRFS_MOUNT_SPACE_CACHE                 = (1UL << 12),
+       BTRFS_MOUNT_CLEAR_CACHE                 = (1UL << 13),
+       BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED      = (1UL << 14),
+       BTRFS_MOUNT_ENOSPC_DEBUG                = (1UL << 15),
+       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),
+};
+
+#define BTRFS_DEFAULT_COMMIT_INTERVAL  (30)
+#define BTRFS_DEFAULT_MAX_INLINE       (2048)
+
 /* Compatibility and incompatibility defines */
 void __btrfs_set_fs_incompat(struct btrfs_fs_info *fs_info, u64 flag,
                             const char *name);
@@ -68,6 +111,26 @@ void __btrfs_clear_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag,
 #define btrfs_fs_compat_ro(fs_info, opt)                               \
        __btrfs_fs_compat_ro((fs_info), BTRFS_FEATURE_COMPAT_RO_##opt)
 
+#define btrfs_clear_opt(o, opt)                ((o) &= ~BTRFS_MOUNT_##opt)
+#define btrfs_set_opt(o, opt)          ((o) |= BTRFS_MOUNT_##opt)
+#define btrfs_raw_test_opt(o, opt)     ((o) & BTRFS_MOUNT_##opt)
+#define btrfs_test_opt(fs_info, opt)   ((fs_info)->mount_opt & \
+                                        BTRFS_MOUNT_##opt)
+
+#define btrfs_set_and_info(fs_info, opt, fmt, args...)                 \
+do {                                                                   \
+       if (!btrfs_test_opt(fs_info, opt))                              \
+               btrfs_info(fs_info, fmt, ##args);                       \
+       btrfs_set_opt(fs_info->mount_opt, opt);                         \
+} while (0)
+
+#define btrfs_clear_and_info(fs_info, opt, fmt, args...)               \
+do {                                                                   \
+       if (btrfs_test_opt(fs_info, opt))                               \
+               btrfs_info(fs_info, fmt, ##args);                       \
+       btrfs_clear_opt(fs_info->mount_opt, opt);                       \
+} while (0)
+
 static inline int btrfs_fs_closing(struct btrfs_fs_info *fs_info)
 {
        /* Do it this way so we only ever do one test_bit in the normal case. */
index f7535b8b62f56573313cfab2e0d9599395fc250b..9b09dc50ba14b32e4fc245d4594f011e39d4982d 100644 (file)
@@ -11,6 +11,7 @@
 #include "locking.h"
 #include "delayed-ref.h"
 #include "ref-verify.h"
+#include "fs.h"
 
 /*
  * Used to keep track the roots and number of refs each root has for a given