aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-08-29 18:44:13 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2017-09-01 16:08:25 -0400
commit4c35445b591ee669097c5b98e4bb677808e9f582 (patch)
tree8b271e65f8334e31ac01562f7e6bfd45d199e9d9 /fs/xfs
parent4da6b514eaa168c246fc5c1245c4f82084bcf24e (diff)
xfs: use xfs_iext_*_extent helpers in xfs_bmap_split_extent_at
This abstracts the function away from details of the low-level extent list implementation. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 88beac28258e..9b877024c804 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -6253,7 +6253,6 @@ xfs_bmap_split_extent_at(
6253{ 6253{
6254 int whichfork = XFS_DATA_FORK; 6254 int whichfork = XFS_DATA_FORK;
6255 struct xfs_btree_cur *cur = NULL; 6255 struct xfs_btree_cur *cur = NULL;
6256 struct xfs_bmbt_rec_host *gotp;
6257 struct xfs_bmbt_irec got; 6256 struct xfs_bmbt_irec got;
6258 struct xfs_bmbt_irec new; /* split extent */ 6257 struct xfs_bmbt_irec new; /* split extent */
6259 struct xfs_mount *mp = ip->i_mount; 6258 struct xfs_mount *mp = ip->i_mount;
@@ -6285,21 +6284,10 @@ xfs_bmap_split_extent_at(
6285 } 6284 }
6286 6285
6287 /* 6286 /*
6288 * gotp can be null in 2 cases: 1) if there are no extents 6287 * If there are not extents, or split_fsb lies in a hole we are done.
6289 * or 2) split_fsb lies in a hole beyond which there are
6290 * no extents. Either way, we are done.
6291 */ 6288 */
6292 gotp = xfs_iext_bno_to_ext(ifp, split_fsb, &current_ext); 6289 if (!xfs_iext_lookup_extent(ip, ifp, split_fsb, &current_ext, &got) ||
6293 if (!gotp) 6290 got.br_startoff >= split_fsb)
6294 return 0;
6295
6296 xfs_bmbt_get_all(gotp, &got);
6297
6298 /*
6299 * Check split_fsb lies in a hole or the start boundary offset
6300 * of the extent.
6301 */
6302 if (got.br_startoff >= split_fsb)
6303 return 0; 6291 return 0;
6304 6292
6305 gotblkcnt = split_fsb - got.br_startoff; 6293 gotblkcnt = split_fsb - got.br_startoff;
@@ -6322,8 +6310,8 @@ xfs_bmap_split_extent_at(
6322 XFS_WANT_CORRUPTED_GOTO(mp, i == 1, del_cursor); 6310 XFS_WANT_CORRUPTED_GOTO(mp, i == 1, del_cursor);
6323 } 6311 }
6324 6312
6325 xfs_bmbt_set_blockcount(gotp, gotblkcnt);
6326 got.br_blockcount = gotblkcnt; 6313 got.br_blockcount = gotblkcnt;
6314 xfs_iext_update_extent(ifp, current_ext, &got);
6327 6315
6328 logflags = XFS_ILOG_CORE; 6316 logflags = XFS_ILOG_CORE;
6329 if (cur) { 6317 if (cur) {