aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-11-23 19:39:50 -0500
committerDave Chinner <david@fromorbit.com>2016-11-23 19:39:50 -0500
commit86f12ab05ffc45fa88a09110f582875fa9f07c8a (patch)
tree0cbe99a2057db3be71251e3df72b517d48a82e93 /fs/xfs/xfs_reflink.c
parent092d5d9d5812a80e4496cdbb24fe58e6f77da56b (diff)
xfs: use new extent lookup helpers in xfs_reflink_trim_irec_to_next_cow
And remove the unused return value. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
-rw-r--r--fs/xfs/xfs_reflink.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index e92355a39304..d3cfae842237 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -451,43 +451,34 @@ xfs_reflink_find_cow_mapping(
451/* 451/*
452 * Trim an extent to end at the next CoW reservation past offset_fsb. 452 * Trim an extent to end at the next CoW reservation past offset_fsb.
453 */ 453 */
454int 454void
455xfs_reflink_trim_irec_to_next_cow( 455xfs_reflink_trim_irec_to_next_cow(
456 struct xfs_inode *ip, 456 struct xfs_inode *ip,
457 xfs_fileoff_t offset_fsb, 457 xfs_fileoff_t offset_fsb,
458 struct xfs_bmbt_irec *imap) 458 struct xfs_bmbt_irec *imap)
459{ 459{
460 struct xfs_bmbt_irec irec; 460 struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
461 struct xfs_ifork *ifp; 461 struct xfs_bmbt_irec got;
462 struct xfs_bmbt_rec_host *gotp;
463 xfs_extnum_t idx; 462 xfs_extnum_t idx;
464 463
465 if (!xfs_is_reflink_inode(ip)) 464 if (!xfs_is_reflink_inode(ip))
466 return 0; 465 return;
467 466
468 /* Find the extent in the CoW fork. */ 467 /* Find the extent in the CoW fork. */
469 ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK); 468 if (!xfs_iext_lookup_extent(ip, ifp, offset_fsb, &idx, &got))
470 gotp = xfs_iext_bno_to_ext(ifp, offset_fsb, &idx); 469 return;
471 if (!gotp)
472 return 0;
473 xfs_bmbt_get_all(gotp, &irec);
474 470
475 /* This is the extent before; try sliding up one. */ 471 /* This is the extent before; try sliding up one. */
476 if (irec.br_startoff < offset_fsb) { 472 if (got.br_startoff < offset_fsb) {
477 idx++; 473 if (!xfs_iext_get_extent(ifp, idx + 1, &got))
478 if (idx >= xfs_iext_count(ifp)) 474 return;
479 return 0;
480 gotp = xfs_iext_get_ext(ifp, idx);
481 xfs_bmbt_get_all(gotp, &irec);
482 } 475 }
483 476
484 if (irec.br_startoff >= imap->br_startoff + imap->br_blockcount) 477 if (got.br_startoff >= imap->br_startoff + imap->br_blockcount)
485 return 0; 478 return;
486 479
487 imap->br_blockcount = irec.br_startoff - imap->br_startoff; 480 imap->br_blockcount = got.br_startoff - imap->br_startoff;
488 trace_xfs_reflink_trim_irec(ip, imap); 481 trace_xfs_reflink_trim_irec(ip, imap);
489
490 return 0;
491} 482}
492 483
493/* 484/*