diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2016-01-04 00:12:42 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-01-04 00:12:42 -0500 |
commit | 6d3eb1eca0e35cc1c0c80eacb7e7fe23c0dbfb07 (patch) | |
tree | 9abacbf689851a9d0a5021ad1c62760c1f7dc80c /fs/xfs | |
parent | 9b434a347c3d0aab5a14911fc65531e792da3ae6 (diff) |
libxfs: use a convenience variable instead of open-coding the fork
Use a convenience variable instead of open-coding the inode fork.
This isn't really needed for now, but will become important when we
add the copy-on-write fork later.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index bb3c6590035e..73884953b21c 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -1723,10 +1723,11 @@ xfs_bmap_add_extent_delay_real( | |||
1723 | xfs_filblks_t temp=0; /* value for da_new calculations */ | 1723 | xfs_filblks_t temp=0; /* value for da_new calculations */ |
1724 | xfs_filblks_t temp2=0;/* value for da_new calculations */ | 1724 | xfs_filblks_t temp2=0;/* value for da_new calculations */ |
1725 | int tmp_rval; /* partial logging flags */ | 1725 | int tmp_rval; /* partial logging flags */ |
1726 | int whichfork = XFS_DATA_FORK; | ||
1726 | struct xfs_mount *mp; | 1727 | struct xfs_mount *mp; |
1727 | 1728 | ||
1728 | mp = bma->ip->i_mount; | 1729 | mp = bma->ip->i_mount; |
1729 | ifp = XFS_IFORK_PTR(bma->ip, XFS_DATA_FORK); | 1730 | ifp = XFS_IFORK_PTR(bma->ip, whichfork); |
1730 | 1731 | ||
1731 | ASSERT(bma->idx >= 0); | 1732 | ASSERT(bma->idx >= 0); |
1732 | ASSERT(bma->idx <= ifp->if_bytes / sizeof(struct xfs_bmbt_rec)); | 1733 | ASSERT(bma->idx <= ifp->if_bytes / sizeof(struct xfs_bmbt_rec)); |
@@ -1785,7 +1786,7 @@ xfs_bmap_add_extent_delay_real( | |||
1785 | * Don't set contiguous if the combined extent would be too large. | 1786 | * Don't set contiguous if the combined extent would be too large. |
1786 | * Also check for all-three-contiguous being too large. | 1787 | * Also check for all-three-contiguous being too large. |
1787 | */ | 1788 | */ |
1788 | if (bma->idx < bma->ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t) - 1) { | 1789 | if (bma->idx < ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t) - 1) { |
1789 | state |= BMAP_RIGHT_VALID; | 1790 | state |= BMAP_RIGHT_VALID; |
1790 | xfs_bmbt_get_all(xfs_iext_get_ext(ifp, bma->idx + 1), &RIGHT); | 1791 | xfs_bmbt_get_all(xfs_iext_get_ext(ifp, bma->idx + 1), &RIGHT); |
1791 | 1792 | ||
@@ -2016,10 +2017,10 @@ xfs_bmap_add_extent_delay_real( | |||
2016 | XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done); | 2017 | XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done); |
2017 | } | 2018 | } |
2018 | 2019 | ||
2019 | if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) { | 2020 | if (xfs_bmap_needs_btree(bma->ip, whichfork)) { |
2020 | error = xfs_bmap_extents_to_btree(bma->tp, bma->ip, | 2021 | error = xfs_bmap_extents_to_btree(bma->tp, bma->ip, |
2021 | bma->firstblock, bma->flist, | 2022 | bma->firstblock, bma->flist, |
2022 | &bma->cur, 1, &tmp_rval, XFS_DATA_FORK); | 2023 | &bma->cur, 1, &tmp_rval, whichfork); |
2023 | rval |= tmp_rval; | 2024 | rval |= tmp_rval; |
2024 | if (error) | 2025 | if (error) |
2025 | goto done; | 2026 | goto done; |
@@ -2100,10 +2101,10 @@ xfs_bmap_add_extent_delay_real( | |||
2100 | XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done); | 2101 | XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done); |
2101 | } | 2102 | } |
2102 | 2103 | ||
2103 | if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) { | 2104 | if (xfs_bmap_needs_btree(bma->ip, whichfork)) { |
2104 | error = xfs_bmap_extents_to_btree(bma->tp, bma->ip, | 2105 | error = xfs_bmap_extents_to_btree(bma->tp, bma->ip, |
2105 | bma->firstblock, bma->flist, &bma->cur, 1, | 2106 | bma->firstblock, bma->flist, &bma->cur, 1, |
2106 | &tmp_rval, XFS_DATA_FORK); | 2107 | &tmp_rval, whichfork); |
2107 | rval |= tmp_rval; | 2108 | rval |= tmp_rval; |
2108 | if (error) | 2109 | if (error) |
2109 | goto done; | 2110 | goto done; |
@@ -2169,10 +2170,10 @@ xfs_bmap_add_extent_delay_real( | |||
2169 | XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done); | 2170 | XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done); |
2170 | } | 2171 | } |
2171 | 2172 | ||
2172 | if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) { | 2173 | if (xfs_bmap_needs_btree(bma->ip, whichfork)) { |
2173 | error = xfs_bmap_extents_to_btree(bma->tp, bma->ip, | 2174 | error = xfs_bmap_extents_to_btree(bma->tp, bma->ip, |
2174 | bma->firstblock, bma->flist, &bma->cur, | 2175 | bma->firstblock, bma->flist, &bma->cur, |
2175 | 1, &tmp_rval, XFS_DATA_FORK); | 2176 | 1, &tmp_rval, whichfork); |
2176 | rval |= tmp_rval; | 2177 | rval |= tmp_rval; |
2177 | if (error) | 2178 | if (error) |
2178 | goto done; | 2179 | goto done; |
@@ -2215,13 +2216,13 @@ xfs_bmap_add_extent_delay_real( | |||
2215 | } | 2216 | } |
2216 | 2217 | ||
2217 | /* convert to a btree if necessary */ | 2218 | /* convert to a btree if necessary */ |
2218 | if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) { | 2219 | if (xfs_bmap_needs_btree(bma->ip, whichfork)) { |
2219 | int tmp_logflags; /* partial log flag return val */ | 2220 | int tmp_logflags; /* partial log flag return val */ |
2220 | 2221 | ||
2221 | ASSERT(bma->cur == NULL); | 2222 | ASSERT(bma->cur == NULL); |
2222 | error = xfs_bmap_extents_to_btree(bma->tp, bma->ip, | 2223 | error = xfs_bmap_extents_to_btree(bma->tp, bma->ip, |
2223 | bma->firstblock, bma->flist, &bma->cur, | 2224 | bma->firstblock, bma->flist, &bma->cur, |
2224 | da_old > 0, &tmp_logflags, XFS_DATA_FORK); | 2225 | da_old > 0, &tmp_logflags, whichfork); |
2225 | bma->logflags |= tmp_logflags; | 2226 | bma->logflags |= tmp_logflags; |
2226 | if (error) | 2227 | if (error) |
2227 | goto done; | 2228 | goto done; |
@@ -2242,7 +2243,7 @@ xfs_bmap_add_extent_delay_real( | |||
2242 | if (bma->cur) | 2243 | if (bma->cur) |
2243 | bma->cur->bc_private.b.allocated = 0; | 2244 | bma->cur->bc_private.b.allocated = 0; |
2244 | 2245 | ||
2245 | xfs_bmap_check_leaf_extents(bma->cur, bma->ip, XFS_DATA_FORK); | 2246 | xfs_bmap_check_leaf_extents(bma->cur, bma->ip, whichfork); |
2246 | done: | 2247 | done: |
2247 | bma->logflags |= rval; | 2248 | bma->logflags |= rval; |
2248 | return error; | 2249 | return error; |