]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: use the state defines in xfs_bmap_del_extent_real
authorChristoph Hellwig <hch@lst.de>
Fri, 17 Nov 2017 04:11:30 +0000 (22:11 -0600)
committerEric Sandeen <sandeen@redhat.com>
Fri, 17 Nov 2017 04:11:30 +0000 (22:11 -0600)
Source kernel commit: 491f6f8abfa7a91d23b969be67ed476817bcefd7

Use the same defines as the other extent add and delete helpers, which
both improves code readability and trace point output.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_bmap.c

index 84bd1981b8dd75b18c887570469f1f1d5da7b8f8..c0063e803b80c9abc62ed4effe8055bbd9d7c25a 100644 (file)
@@ -5151,13 +5151,13 @@ xfs_bmap_del_extent_real(
                XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
        }
 
-       /*
-        * Set flag value to use in switch statement.
-        * Left-contig is 2, right-contig is 1.
-        */
-       switch (((got.br_startoff == del->br_startoff) << 1) |
-               (got_endoff == del_endoff)) {
-       case 3:
+       if (got.br_startoff == del->br_startoff)
+               state |= BMAP_LEFT_FILLING;
+       if (got_endoff == del_endoff)
+               state |= BMAP_RIGHT_FILLING;
+
+       switch (state & (BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING)) {
+       case BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING:
                /*
                 * Matches the whole extent.  Delete the entry.
                 */
@@ -5177,8 +5177,7 @@ xfs_bmap_del_extent_real(
                        goto done;
                XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
                break;
-
-       case 2:
+       case BMAP_LEFT_FILLING:
                /*
                 * Deleting the first part of the extent.
                 */
@@ -5197,8 +5196,7 @@ xfs_bmap_del_extent_real(
                                got.br_state)))
                        goto done;
                break;
-
-       case 1:
+       case BMAP_RIGHT_FILLING:
                /*
                 * Deleting the last part of the extent.
                 */
@@ -5216,7 +5214,6 @@ xfs_bmap_del_extent_real(
                                got.br_state)))
                        goto done;
                break;
-
        case 0:
                /*
                 * Deleting the middle of the extent.