Commit 86f12ab0 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dave Chinner

xfs: use new extent lookup helpers in xfs_reflink_trim_irec_to_next_cow

And remove the unused return value.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 092d5d9d
...@@ -451,43 +451,34 @@ xfs_reflink_find_cow_mapping( ...@@ -451,43 +451,34 @@ xfs_reflink_find_cow_mapping(
/* /*
* Trim an extent to end at the next CoW reservation past offset_fsb. * Trim an extent to end at the next CoW reservation past offset_fsb.
*/ */
int void
xfs_reflink_trim_irec_to_next_cow( xfs_reflink_trim_irec_to_next_cow(
struct xfs_inode *ip, struct xfs_inode *ip,
xfs_fileoff_t offset_fsb, xfs_fileoff_t offset_fsb,
struct xfs_bmbt_irec *imap) struct xfs_bmbt_irec *imap)
{ {
struct xfs_bmbt_irec irec; struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
struct xfs_ifork *ifp; struct xfs_bmbt_irec got;
struct xfs_bmbt_rec_host *gotp;
xfs_extnum_t idx; xfs_extnum_t idx;
if (!xfs_is_reflink_inode(ip)) if (!xfs_is_reflink_inode(ip))
return 0; return;
/* Find the extent in the CoW fork. */ /* Find the extent in the CoW fork. */
ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK); if (!xfs_iext_lookup_extent(ip, ifp, offset_fsb, &idx, &got))
gotp = xfs_iext_bno_to_ext(ifp, offset_fsb, &idx); return;
if (!gotp)
return 0;
xfs_bmbt_get_all(gotp, &irec);
/* This is the extent before; try sliding up one. */ /* This is the extent before; try sliding up one. */
if (irec.br_startoff < offset_fsb) { if (got.br_startoff < offset_fsb) {
idx++; if (!xfs_iext_get_extent(ifp, idx + 1, &got))
if (idx >= xfs_iext_count(ifp)) return;
return 0;
gotp = xfs_iext_get_ext(ifp, idx);
xfs_bmbt_get_all(gotp, &irec);
} }
if (irec.br_startoff >= imap->br_startoff + imap->br_blockcount) if (got.br_startoff >= imap->br_startoff + imap->br_blockcount)
return 0; return;
imap->br_blockcount = irec.br_startoff - imap->br_startoff; imap->br_blockcount = got.br_startoff - imap->br_startoff;
trace_xfs_reflink_trim_irec(ip, imap); trace_xfs_reflink_trim_irec(ip, imap);
return 0;
} }
/* /*
......
...@@ -32,7 +32,7 @@ extern int xfs_reflink_allocate_cow_range(struct xfs_inode *ip, ...@@ -32,7 +32,7 @@ extern int xfs_reflink_allocate_cow_range(struct xfs_inode *ip,
xfs_off_t offset, xfs_off_t count); xfs_off_t offset, xfs_off_t count);
extern bool xfs_reflink_find_cow_mapping(struct xfs_inode *ip, xfs_off_t offset, extern bool xfs_reflink_find_cow_mapping(struct xfs_inode *ip, xfs_off_t offset,
struct xfs_bmbt_irec *imap); struct xfs_bmbt_irec *imap);
extern int xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip, extern void xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip,
xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap); xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap);
extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip, extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment