Message ID | 20170829174835.2218-7-hch@lst.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Tue, Aug 29, 2017 at 07:48:33PM +0200, Christoph Hellwig wrote: > 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> > --- > fs/xfs/libxfs/xfs_bmap.c | 20 ++++---------------- > 1 file changed, 4 insertions(+), 16 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c > index 02725becedfa..51571113b270 100644 > --- a/fs/xfs/libxfs/xfs_bmap.c > +++ b/fs/xfs/libxfs/xfs_bmap.c > @@ -6253,7 +6253,6 @@ xfs_bmap_split_extent_at( > { > int whichfork = XFS_DATA_FORK; > struct xfs_btree_cur *cur = NULL; > - struct xfs_bmbt_rec_host *gotp; > struct xfs_bmbt_irec got; > struct xfs_bmbt_irec new; /* split extent */ > struct xfs_mount *mp = ip->i_mount; > @@ -6285,21 +6284,10 @@ xfs_bmap_split_extent_at( > } > > /* > - * gotp can be null in 2 cases: 1) if there are no extents > - * or 2) split_fsb lies in a hole beyond which there are > - * no extents. Either way, we are done. > + * If there are not extents, or split_fsb lies in a hole we are done. > */ > - gotp = xfs_iext_bno_to_ext(ifp, split_fsb, ¤t_ext); > - if (!gotp) > - return 0; > - > - xfs_bmbt_get_all(gotp, &got); > - > - /* > - * Check split_fsb lies in a hole or the start boundary offset > - * of the extent. > - */ > - if (got.br_startoff >= split_fsb) > + if (!xfs_iext_lookup_extent(ip, ifp, split_fsb, ¤t_ext, &got) || > + got.br_startoff >= split_fsb) > return 0; > > gotblkcnt = split_fsb - got.br_startoff; > @@ -6322,8 +6310,8 @@ xfs_bmap_split_extent_at( > XFS_WANT_CORRUPTED_GOTO(mp, i == 1, del_cursor); > } > > - xfs_bmbt_set_blockcount(gotp, gotblkcnt); > got.br_blockcount = gotblkcnt; > + xfs_iext_update_extent(ifp, current_ext, &got); > > logflags = XFS_ILOG_CORE; > if (cur) { > -- > 2.11.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 02725becedfa..51571113b270 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -6253,7 +6253,6 @@ xfs_bmap_split_extent_at( { int whichfork = XFS_DATA_FORK; struct xfs_btree_cur *cur = NULL; - struct xfs_bmbt_rec_host *gotp; struct xfs_bmbt_irec got; struct xfs_bmbt_irec new; /* split extent */ struct xfs_mount *mp = ip->i_mount; @@ -6285,21 +6284,10 @@ xfs_bmap_split_extent_at( } /* - * gotp can be null in 2 cases: 1) if there are no extents - * or 2) split_fsb lies in a hole beyond which there are - * no extents. Either way, we are done. + * If there are not extents, or split_fsb lies in a hole we are done. */ - gotp = xfs_iext_bno_to_ext(ifp, split_fsb, ¤t_ext); - if (!gotp) - return 0; - - xfs_bmbt_get_all(gotp, &got); - - /* - * Check split_fsb lies in a hole or the start boundary offset - * of the extent. - */ - if (got.br_startoff >= split_fsb) + if (!xfs_iext_lookup_extent(ip, ifp, split_fsb, ¤t_ext, &got) || + got.br_startoff >= split_fsb) return 0; gotblkcnt = split_fsb - got.br_startoff; @@ -6322,8 +6310,8 @@ xfs_bmap_split_extent_at( XFS_WANT_CORRUPTED_GOTO(mp, i == 1, del_cursor); } - xfs_bmbt_set_blockcount(gotp, gotblkcnt); got.br_blockcount = gotblkcnt; + xfs_iext_update_extent(ifp, current_ext, &got); logflags = XFS_ILOG_CORE; if (cur) {
This abstracts the function away from details of the low-level extent list implementation. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/libxfs/xfs_bmap.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)