btrfs: move flush related definitions to space-info.h
authorJosef Bacik <josef@toxicpanda.com>
Wed, 14 Sep 2022 15:06:35 +0000 (11:06 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 5 Dec 2022 17:00:37 +0000 (18:00 +0100)
This code is used in space-info.c, move the definitions to space-info.h.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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/ctree.h
fs/btrfs/delayed-inode.c
fs/btrfs/inode-item.c
fs/btrfs/props.c
fs/btrfs/relocation.c
fs/btrfs/space-info.h

index 03d665b21244ca4fdc96b1dbbcf658bf23422c6a..39974f4b441f3ecc39cfb5a25f6d98268e4ea5cc 100644 (file)
@@ -2639,65 +2639,6 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
 
 void btrfs_clear_space_info_full(struct btrfs_fs_info *info);
 
-/*
- * Different levels for to flush space when doing space reservations.
- *
- * The higher the level, the more methods we try to reclaim space.
- */
-enum btrfs_reserve_flush_enum {
-       /* If we are in the transaction, we can't flush anything.*/
-       BTRFS_RESERVE_NO_FLUSH,
-
-       /*
-        * Flush space by:
-        * - Running delayed inode items
-        * - Allocating a new chunk
-        */
-       BTRFS_RESERVE_FLUSH_LIMIT,
-
-       /*
-        * Flush space by:
-        * - Running delayed inode items
-        * - Running delayed refs
-        * - Running delalloc and waiting for ordered extents
-        * - Allocating a new chunk
-        */
-       BTRFS_RESERVE_FLUSH_EVICT,
-
-       /*
-        * Flush space by above mentioned methods and by:
-        * - Running delayed iputs
-        * - Committing transaction
-        *
-        * Can be interrupted by a fatal signal.
-        */
-       BTRFS_RESERVE_FLUSH_DATA,
-       BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE,
-       BTRFS_RESERVE_FLUSH_ALL,
-
-       /*
-        * Pretty much the same as FLUSH_ALL, but can also steal space from
-        * global rsv.
-        *
-        * Can be interrupted by a fatal signal.
-        */
-       BTRFS_RESERVE_FLUSH_ALL_STEAL,
-};
-
-enum btrfs_flush_state {
-       FLUSH_DELAYED_ITEMS_NR  =       1,
-       FLUSH_DELAYED_ITEMS     =       2,
-       FLUSH_DELAYED_REFS_NR   =       3,
-       FLUSH_DELAYED_REFS      =       4,
-       FLUSH_DELALLOC          =       5,
-       FLUSH_DELALLOC_WAIT     =       6,
-       FLUSH_DELALLOC_FULL     =       7,
-       ALLOC_CHUNK             =       8,
-       ALLOC_CHUNK_FORCE       =       9,
-       RUN_DELAYED_IPUTS       =       10,
-       COMMIT_TRANS            =       11,
-};
-
 int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
                                     struct btrfs_block_rsv *rsv,
                                     int nitems, bool use_global_rsv);
index cac5169eaf8dea6256bae0165d757cbc51f60f23..a411f04a7b9772594ea4e216f16743d8397ff98c 100644 (file)
@@ -14,6 +14,7 @@
 #include "qgroup.h"
 #include "locking.h"
 #include "inode-item.h"
+#include "space-info.h"
 
 #define BTRFS_DELAYED_WRITEBACK                512
 #define BTRFS_DELAYED_BACKGROUND       128
index 0eeb5ea878948e129fe8824a68fe57d9b62a9e3c..366f3a788c6a9c930f19f0e6b4c6280a8f96dab9 100644 (file)
@@ -8,6 +8,7 @@
 #include "disk-io.h"
 #include "transaction.h"
 #include "print-tree.h"
+#include "space-info.h"
 
 struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
                                                   int slot, const char *name,
index 055a631276ce110300cfbbb5c911e9dc9368fb70..07f62e3ba6a51c8b92e080797f18039344776811 100644 (file)
@@ -10,6 +10,7 @@
 #include "ctree.h"
 #include "xattr.h"
 #include "compression.h"
+#include "space-info.h"
 
 #define BTRFS_PROP_HANDLERS_HT_BITS 8
 static DEFINE_HASHTABLE(prop_handlers_ht, BTRFS_PROP_HANDLERS_HT_BITS);
index 9dcf9b39c7983a78ceac4ed76fc23c5ce54fb883..216a4485d9141fd190338c2c500d86d556cf1da5 100644 (file)
@@ -27,6 +27,7 @@
 #include "subpage.h"
 #include "zoned.h"
 #include "inode-item.h"
+#include "space-info.h"
 
 /*
  * Relocation overview
index ce66023a9eb8b0e2e7e4901fdd93b3eaf2d3aa7d..7e17bb80343608b65a817b33aabec76fe91256d7 100644 (file)
@@ -5,6 +5,65 @@
 
 #include "volumes.h"
 
+/*
+ * Different levels for to flush space when doing space reservations.
+ *
+ * The higher the level, the more methods we try to reclaim space.
+ */
+enum btrfs_reserve_flush_enum {
+       /* If we are in the transaction, we can't flush anything.*/
+       BTRFS_RESERVE_NO_FLUSH,
+
+       /*
+        * Flush space by:
+        * - Running delayed inode items
+        * - Allocating a new chunk
+        */
+       BTRFS_RESERVE_FLUSH_LIMIT,
+
+       /*
+        * Flush space by:
+        * - Running delayed inode items
+        * - Running delayed refs
+        * - Running delalloc and waiting for ordered extents
+        * - Allocating a new chunk
+        */
+       BTRFS_RESERVE_FLUSH_EVICT,
+
+       /*
+        * Flush space by above mentioned methods and by:
+        * - Running delayed iputs
+        * - Committing transaction
+        *
+        * Can be interrupted by a fatal signal.
+        */
+       BTRFS_RESERVE_FLUSH_DATA,
+       BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE,
+       BTRFS_RESERVE_FLUSH_ALL,
+
+       /*
+        * Pretty much the same as FLUSH_ALL, but can also steal space from
+        * global rsv.
+        *
+        * Can be interrupted by a fatal signal.
+        */
+       BTRFS_RESERVE_FLUSH_ALL_STEAL,
+};
+
+enum btrfs_flush_state {
+       FLUSH_DELAYED_ITEMS_NR  = 1,
+       FLUSH_DELAYED_ITEMS     = 2,
+       FLUSH_DELAYED_REFS_NR   = 3,
+       FLUSH_DELAYED_REFS      = 4,
+       FLUSH_DELALLOC          = 5,
+       FLUSH_DELALLOC_WAIT     = 6,
+       FLUSH_DELALLOC_FULL     = 7,
+       ALLOC_CHUNK             = 8,
+       ALLOC_CHUNK_FORCE       = 9,
+       RUN_DELAYED_IPUTS       = 10,
+       COMMIT_TRANS            = 11,
+};
+
 struct btrfs_space_info {
        spinlock_t lock;