]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: make staging file forks explicit
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 17:01:03 +0000 (10:01 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:38 +0000 (11:37 -0700)
Source kernel commit: 42e357c806c8c0ffb9c5c2faa4ad034bfe950d77

Don't open-code "-1" for whichfork when we're creating a staging btree
for a repair; let's define an actual symbol to make grepping and
understanding easier.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
libxfs/xfs_bmap_btree.c
libxfs/xfs_types.h

index dedc33dc5049a160a44dd949533f3e4798dc4b23..6b377d129c33966a65bf6f753e64741deadab2e9 100644 (file)
@@ -613,7 +613,7 @@ xfs_bmbt_stage_cursor(
        cur = xfs_bmbt_init_common(mp, NULL, ip, XFS_DATA_FORK);
 
        /* Don't let anyone think we're attached to the real fork yet. */
-       cur->bc_ino.whichfork = -1;
+       cur->bc_ino.whichfork = XFS_STAGING_FORK;
        xfs_btree_stage_ifakeroot(cur, ifake);
        return cur;
 }
index 62e02d5380ad3b47d6dc403a3b1ffba0d202ce43..a1004fb3c8fb4878f0c592a6a8858b0e8dd82735 100644 (file)
@@ -80,11 +80,13 @@ typedef void *              xfs_failaddr_t;
 /*
  * Inode fork identifiers.
  */
-#define        XFS_DATA_FORK   0
-#define        XFS_ATTR_FORK   1
-#define        XFS_COW_FORK    2
+#define XFS_STAGING_FORK       (-1)    /* fake fork for staging a btree */
+#define        XFS_DATA_FORK           (0)
+#define        XFS_ATTR_FORK           (1)
+#define        XFS_COW_FORK            (2)
 
 #define XFS_WHICHFORK_STRINGS \
+       { XFS_STAGING_FORK,     "staging" }, \
        { XFS_DATA_FORK,        "data" }, \
        { XFS_ATTR_FORK,        "attr" }, \
        { XFS_COW_FORK,         "cow" }