]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: move up the definition of struct walk_control
authorFilipe Manana <fdmanana@suse.com>
Wed, 27 Aug 2025 14:48:49 +0000 (15:48 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Sep 2025 06:49:18 +0000 (08:49 +0200)
In upcoming changes we need to pass struct walk_control as an argument to
replay_dir_deletes() and link_to_fixup_dir() so we need to move its
definition above the prototypes of those functions. So move it up right
below the enum that defines log replay stages and before any functions and
function prototypes are declared. Also fixup the comments while moving it
so that they comply with the preferred code style (capitalize the first
word in a sentence, end sentences with punctuation, makes lines wider and
closer to the 80 characters limit).

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c

index cd4c5ae3e0a30d9727907af5129c93145f526240..2780f0e1db0195c216f5b799e9e29a378d21b4da 100644 (file)
@@ -101,6 +101,57 @@ enum {
        LOG_WALK_REPLAY_ALL,
 };
 
+/*
+ * The walk control struct is used to pass state down the chain when processing
+ * the log tree. The stage field tells us which part of the log tree processing
+ * we are currently doing.
+ */
+struct walk_control {
+       /*
+        * Signal that we are freeing the metadata extents of a log tree.
+        * This is used at transaction commit time while freeing a log tree.
+        */
+       bool free;
+
+       /*
+        * Signal that we are pinning the metadata extents of a log tree and the
+        * data extents its leaves point to (if using mixed block groups).
+        * This happens in the first stage of log replay to ensure that during
+        * replay, while we are modifying subvolume trees, we don't overwrite
+        * the metadata extents of log trees.
+        */
+       bool pin;
+
+       /* What stage of the replay code we're currently in. */
+       int stage;
+
+       /*
+        * Ignore any items from the inode currently being processed. Needs
+        * to be set every time we find a BTRFS_INODE_ITEM_KEY.
+        */
+       bool ignore_cur_inode;
+
+       /*
+        * The root we are currently replaying to. This is NULL for the replay
+        * stage LOG_WALK_PIN_ONLY.
+        */
+       struct btrfs_root *root;
+
+       /* The log tree we are currently processing (not NULL for any stage). */
+       struct btrfs_root *log;
+
+       /* The transaction handle used for replaying all log trees. */
+       struct btrfs_trans_handle *trans;
+
+       /*
+        * The function that gets used to process blocks we find in the tree.
+        * Note the extent_buffer might not be up to date when it is passed in,
+        * and it must be checked or read if you need the data inside it.
+        */
+       int (*process_func)(struct extent_buffer *eb,
+                           struct walk_control *wc, u64 gen, int level);
+};
+
 static int btrfs_log_inode(struct btrfs_trans_handle *trans,
                           struct btrfs_inode *inode,
                           int inode_only,
@@ -299,58 +350,6 @@ void btrfs_end_log_trans(struct btrfs_root *root)
        }
 }
 
-/*
- * the walk control struct is used to pass state down the chain when
- * processing the log tree.  The stage field tells us which part
- * of the log tree processing we are currently doing.  The others
- * are state fields used for that specific part
- */
-struct walk_control {
-       /*
-        * Signal that we are freeing the metadata extents of a log tree.
-        * This is used at transaction commit time while freeing a log tree.
-        */
-       bool free;
-
-       /*
-        * Signal that we are pinning the metadata extents of a log tree and the
-        * data extents its leaves point to (if using mixed block groups).
-        * This happens in the first stage of log replay to ensure that during
-        * replay, while we are modifying subvolume trees, we don't overwrite
-        * the metadata extents of log trees.
-        */
-       bool pin;
-
-       /* what stage of the replay code we're currently in */
-       int stage;
-
-       /*
-        * Ignore any items from the inode currently being processed. Needs
-        * to be set every time we find a BTRFS_INODE_ITEM_KEY.
-        */
-       bool ignore_cur_inode;
-
-       /*
-        * The root we are currently replaying to. This is NULL for the replay
-        * stage LOG_WALK_PIN_ONLY.
-        */
-       struct btrfs_root *root;
-
-       /* The log tree we are currently processing (not NULL for any stage). */
-       struct btrfs_root *log;
-
-       /* the trans handle for the current replay */
-       struct btrfs_trans_handle *trans;
-
-       /* the function that gets used to process blocks we find in the
-        * tree.  Note the extent_buffer might not be up to date when it is
-        * passed in, and it must be checked or read if you need the data
-        * inside it
-        */
-       int (*process_func)(struct extent_buffer *eb,
-                           struct walk_control *wc, u64 gen, int level);
-};
-
 /*
  * process_func used to pin down extents, write them or wait on them
  */