Skip to content

Commit 72ba455

Browse files
author
Darrick J. Wong
committed
xfs: pass xfs_extent_free_item directly through the log intent code
Pass the incore xfs_extent_free_item through the EFI logging code instead of repeatedly boxing and unboxing parameters. Signed-off-by: Darrick J. Wong <[email protected]>
1 parent f3ebac4 commit 72ba455

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

fs/xfs/xfs_extfree_item.c

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -345,23 +345,30 @@ static int
345345
xfs_trans_free_extent(
346346
struct xfs_trans *tp,
347347
struct xfs_efd_log_item *efdp,
348-
xfs_fsblock_t start_block,
349-
xfs_extlen_t ext_len,
350-
const struct xfs_owner_info *oinfo,
351-
bool skip_discard)
348+
struct xfs_extent_free_item *free)
352349
{
350+
struct xfs_owner_info oinfo = { };
353351
struct xfs_mount *mp = tp->t_mountp;
354352
struct xfs_extent *extp;
355353
uint next_extent;
356-
xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, start_block);
354+
xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp,
355+
free->xefi_startblock);
357356
xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp,
358-
start_block);
357+
free->xefi_startblock);
359358
int error;
360359

361-
trace_xfs_bmap_free_deferred(tp->t_mountp, agno, 0, agbno, ext_len);
360+
oinfo.oi_owner = free->xefi_owner;
361+
if (free->xefi_flags & XFS_EFI_ATTR_FORK)
362+
oinfo.oi_flags |= XFS_OWNER_INFO_ATTR_FORK;
363+
if (free->xefi_flags & XFS_EFI_BMBT_BLOCK)
364+
oinfo.oi_flags |= XFS_OWNER_INFO_BMBT_BLOCK;
365+
366+
trace_xfs_bmap_free_deferred(tp->t_mountp, agno, 0, agbno,
367+
free->xefi_blockcount);
362368

363-
error = __xfs_free_extent(tp, start_block, ext_len,
364-
oinfo, XFS_AG_RESV_NONE, skip_discard);
369+
error = __xfs_free_extent(tp, free->xefi_startblock,
370+
free->xefi_blockcount, &oinfo, XFS_AG_RESV_NONE,
371+
free->xefi_flags & XFS_EFI_SKIP_DISCARD);
365372
/*
366373
* Mark the transaction dirty, even on error. This ensures the
367374
* transaction is aborted, which:
@@ -375,8 +382,8 @@ xfs_trans_free_extent(
375382
next_extent = efdp->efd_next_extent;
376383
ASSERT(next_extent < efdp->efd_format.efd_nextents);
377384
extp = &(efdp->efd_format.efd_extents[next_extent]);
378-
extp->ext_start = start_block;
379-
extp->ext_len = ext_len;
385+
extp->ext_start = free->xefi_startblock;
386+
extp->ext_len = free->xefi_blockcount;
380387
efdp->efd_next_extent++;
381388

382389
return error;
@@ -463,20 +470,12 @@ xfs_extent_free_finish_item(
463470
struct list_head *item,
464471
struct xfs_btree_cur **state)
465472
{
466-
struct xfs_owner_info oinfo = { };
467473
struct xfs_extent_free_item *free;
468474
int error;
469475

470476
free = container_of(item, struct xfs_extent_free_item, xefi_list);
471-
oinfo.oi_owner = free->xefi_owner;
472-
if (free->xefi_flags & XFS_EFI_ATTR_FORK)
473-
oinfo.oi_flags |= XFS_OWNER_INFO_ATTR_FORK;
474-
if (free->xefi_flags & XFS_EFI_BMBT_BLOCK)
475-
oinfo.oi_flags |= XFS_OWNER_INFO_BMBT_BLOCK;
476-
error = xfs_trans_free_extent(tp, EFD_ITEM(done),
477-
free->xefi_startblock,
478-
free->xefi_blockcount,
479-
&oinfo, free->xefi_flags & XFS_EFI_SKIP_DISCARD);
477+
478+
error = xfs_trans_free_extent(tp, EFD_ITEM(done), free);
480479
kmem_cache_free(xfs_extfree_item_cache, free);
481480
return error;
482481
}
@@ -599,7 +598,6 @@ xfs_efi_item_recover(
599598
struct xfs_mount *mp = lip->li_log->l_mp;
600599
struct xfs_efd_log_item *efdp;
601600
struct xfs_trans *tp;
602-
struct xfs_extent *extp;
603601
int i;
604602
int error = 0;
605603

@@ -624,10 +622,17 @@ xfs_efi_item_recover(
624622
efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents);
625623

626624
for (i = 0; i < efip->efi_format.efi_nextents; i++) {
625+
struct xfs_extent_free_item fake = {
626+
.xefi_owner = XFS_RMAP_OWN_UNKNOWN,
627+
};
628+
struct xfs_extent *extp;
629+
627630
extp = &efip->efi_format.efi_extents[i];
628-
error = xfs_trans_free_extent(tp, efdp, extp->ext_start,
629-
extp->ext_len,
630-
&XFS_RMAP_OINFO_ANY_OWNER, false);
631+
632+
fake.xefi_startblock = extp->ext_start;
633+
fake.xefi_blockcount = extp->ext_len;
634+
635+
error = xfs_trans_free_extent(tp, efdp, &fake);
631636
if (error == -EFSCORRUPTED)
632637
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
633638
extp, sizeof(*extp));

0 commit comments

Comments
 (0)