xfs: add a xfs_iext_update_extent helper

This helper is used to update an extent record based on the extent index,
and can be used to provide a level of abstractions between callers that
want to modify in-core extent records and the details of the extent list
implementation.

Also switch all users of the xfs_bmbt_set_all(xfs_iext_get_ext(...))
pattern to this new helper.

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>
This commit is contained in:
Christoph Hellwig
2017-08-29 15:44:11 -07:00
committed by Darrick J. Wong
parent d522d569d6
commit 67e4e69cb2
3 changed files with 20 additions and 6 deletions

View File

@@ -2023,3 +2023,15 @@ xfs_iext_get_extent(
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), gotp);
return true;
}
void
xfs_iext_update_extent(
struct xfs_ifork *ifp,
xfs_extnum_t idx,
struct xfs_bmbt_irec *gotp)
{
ASSERT(idx >= 0);
ASSERT(idx < xfs_iext_count(ifp));
xfs_bmbt_set_all(xfs_iext_get_ext(ifp, idx), gotp);
}