diff options
author | Christoph Hellwig <hch@lst.de> | 2017-10-17 14:16:23 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-10-26 15:38:21 -0700 |
commit | 491f6f8abfa7a91d23b969be67ed476817bcefd7 (patch) | |
tree | 2ae6e3df209ce02de77330f29f053a062956fd71 /fs/xfs/libxfs/xfs_bmap.c | |
parent | 0173c689ff4c0855e24ceb898274af1339b5db48 (diff) | |
download | lwn-491f6f8abfa7a91d23b969be67ed476817bcefd7.tar.gz lwn-491f6f8abfa7a91d23b969be67ed476817bcefd7.zip |
xfs: use the state defines in xfs_bmap_del_extent_real
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>
Diffstat (limited to 'fs/xfs/libxfs/xfs_bmap.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 8c5b7e624917..fc052efb52f9 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5160,13 +5160,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. */ @@ -5186,8 +5186,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. */ @@ -5206,8 +5205,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. */ @@ -5225,7 +5223,6 @@ xfs_bmap_del_extent_real( got.br_state))) goto done; break; - case 0: /* * Deleting the middle of the extent. |