summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/libxfs/xfs_ag.c3
-rw-r--r--fs/xfs/libxfs/xfs_alloc.c7
-rw-r--r--fs/xfs/libxfs/xfs_alloc.h19
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c14
-rw-r--r--fs/xfs/libxfs/xfs_bmap_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_ialloc.c6
-rw-r--r--fs/xfs/libxfs/xfs_refcount.c7
-rw-r--r--fs/xfs/scrub/alloc_repair.c5
-rw-r--r--fs/xfs/scrub/newbt.c7
-rw-r--r--fs/xfs/scrub/reap.c11
-rw-r--r--fs/xfs/xfs_reflink.c2
11 files changed, 45 insertions, 38 deletions
diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
index 5cea4725b239..f444950f3ddc 100644
--- a/fs/xfs/libxfs/xfs_ag.c
+++ b/fs/xfs/libxfs/xfs_ag.c
@@ -928,7 +928,8 @@ xfs_ag_shrink_space(
if (err2 != -ENOSPC)
goto resv_err;
- __xfs_free_extent_later(*tpp, args.fsbno, delta, NULL, true);
+ xfs_free_extent_later(*tpp, args.fsbno, delta, NULL,
+ XFS_FREE_EXTENT_SKIP_DISCARD);
/*
* Roll the transaction before trying to re-init the per-ag
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index e788d1560a79..e23b55f92e04 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -2598,12 +2598,12 @@ xfs_defer_agfl_block(
* The list is maintained sorted (by block number).
*/
void
-__xfs_free_extent_later(
+xfs_free_extent_later(
struct xfs_trans *tp,
xfs_fsblock_t bno,
xfs_filblks_t len,
const struct xfs_owner_info *oinfo,
- bool skip_discard)
+ unsigned int flags)
{
struct xfs_extent_free_item *xefi;
struct xfs_mount *mp = tp->t_mountp;
@@ -2622,13 +2622,14 @@ __xfs_free_extent_later(
ASSERT(len < mp->m_sb.sb_agblocks);
ASSERT(agbno + len <= mp->m_sb.sb_agblocks);
#endif
+ ASSERT(!(flags & ~XFS_FREE_EXTENT_ALL_FLAGS));
ASSERT(xfs_extfree_item_cache != NULL);
xefi = kmem_cache_zalloc(xfs_extfree_item_cache,
GFP_KERNEL | __GFP_NOFAIL);
xefi->xefi_startblock = bno;
xefi->xefi_blockcount = (xfs_extlen_t)len;
- if (skip_discard)
+ if (flags & XFS_FREE_EXTENT_SKIP_DISCARD)
xefi->xefi_flags |= XFS_EFI_SKIP_DISCARD;
if (oinfo) {
ASSERT(oinfo->oi_offset == 0);
diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h
index 83b92c3b3452..19c5f046c3c4 100644
--- a/fs/xfs/libxfs/xfs_alloc.h
+++ b/fs/xfs/libxfs/xfs_alloc.h
@@ -221,9 +221,14 @@ xfs_buf_to_agfl_bno(
return bp->b_addr;
}
-void __xfs_free_extent_later(struct xfs_trans *tp, xfs_fsblock_t bno,
+void xfs_free_extent_later(struct xfs_trans *tp, xfs_fsblock_t bno,
xfs_filblks_t len, const struct xfs_owner_info *oinfo,
- bool skip_discard);
+ unsigned int flags);
+
+/* Don't issue a discard for the blocks freed. */
+#define XFS_FREE_EXTENT_SKIP_DISCARD (1U << 0)
+
+#define XFS_FREE_EXTENT_ALL_FLAGS (XFS_FREE_EXTENT_SKIP_DISCARD)
/*
* List of extents to be free "later".
@@ -245,16 +250,6 @@ void xfs_extent_free_get_group(struct xfs_mount *mp,
#define XFS_EFI_ATTR_FORK (1U << 1) /* freeing attr fork block */
#define XFS_EFI_BMBT_BLOCK (1U << 2) /* freeing bmap btree block */
-static inline void
-xfs_free_extent_later(
- struct xfs_trans *tp,
- xfs_fsblock_t bno,
- xfs_filblks_t len,
- const struct xfs_owner_info *oinfo)
-{
- __xfs_free_extent_later(tp, bno, len, oinfo, false);
-}
-
extern struct kmem_cache *xfs_extfree_item_cache;
int __init xfs_extfree_intent_init_cache(void);
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index dbf68a2b3f1a..b24b35ba0815 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -585,7 +585,7 @@ xfs_bmap_btree_to_extents(
if ((error = xfs_btree_check_block(cur, cblock, 0, cbp)))
return error;
xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, whichfork);
- xfs_free_extent_later(cur->bc_tp, cbno, 1, &oinfo);
+ xfs_free_extent_later(cur->bc_tp, cbno, 1, &oinfo, 0);
ip->i_nblocks--;
xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L);
xfs_trans_binval(tp, cbp);
@@ -5308,10 +5308,14 @@ xfs_bmap_del_extent_real(
if (xfs_is_reflink_inode(ip) && whichfork == XFS_DATA_FORK) {
xfs_refcount_decrease_extent(tp, del);
} else {
- __xfs_free_extent_later(tp, del->br_startblock,
- del->br_blockcount, NULL,
- (bflags & XFS_BMAPI_NODISCARD) ||
- del->br_state == XFS_EXT_UNWRITTEN);
+ unsigned int efi_flags = 0;
+
+ if ((bflags & XFS_BMAPI_NODISCARD) ||
+ del->br_state == XFS_EXT_UNWRITTEN)
+ efi_flags |= XFS_FREE_EXTENT_SKIP_DISCARD;
+
+ xfs_free_extent_later(tp, del->br_startblock,
+ del->br_blockcount, NULL, efi_flags);
}
}
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
index 9923149741d4..25bd90561dca 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.c
+++ b/fs/xfs/libxfs/xfs_bmap_btree.c
@@ -289,7 +289,7 @@ xfs_bmbt_free_block(
struct xfs_owner_info oinfo;
xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, cur->bc_ino.whichfork);
- xfs_free_extent_later(cur->bc_tp, fsbno, 1, &oinfo);
+ xfs_free_extent_later(cur->bc_tp, fsbno, 1, &oinfo, 0);
ip->i_nblocks--;
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 33139a7b9968..f8c475fa63af 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -1918,8 +1918,8 @@ xfs_difree_inode_chunk(
if (!xfs_inobt_issparse(rec->ir_holemask)) {
/* not sparse, calculate extent info directly */
xfs_free_extent_later(tp, XFS_AGB_TO_FSB(mp, agno, sagbno),
- M_IGEO(mp)->ialloc_blks,
- &XFS_RMAP_OINFO_INODES);
+ M_IGEO(mp)->ialloc_blks,
+ &XFS_RMAP_OINFO_INODES, 0);
return;
}
@@ -1963,7 +1963,7 @@ xfs_difree_inode_chunk(
ASSERT(agbno % mp->m_sb.sb_spino_align == 0);
ASSERT(contigblk % mp->m_sb.sb_spino_align == 0);
xfs_free_extent_later(tp, XFS_AGB_TO_FSB(mp, agno, agbno),
- contigblk, &XFS_RMAP_OINFO_INODES);
+ contigblk, &XFS_RMAP_OINFO_INODES, 0);
/* reset range to current bit and carry on... */
startidx = endidx = nextbit;
diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c
index 95be26250b6b..b157806b2b2c 100644
--- a/fs/xfs/libxfs/xfs_refcount.c
+++ b/fs/xfs/libxfs/xfs_refcount.c
@@ -1066,7 +1066,7 @@ xfs_refcount_adjust_extents(
cur->bc_ag.pag->pag_agno,
tmp.rc_startblock);
xfs_free_extent_later(cur->bc_tp, fsbno,
- tmp.rc_blockcount, NULL);
+ tmp.rc_blockcount, NULL, 0);
}
(*agbno) += tmp.rc_blockcount;
@@ -1127,7 +1127,7 @@ xfs_refcount_adjust_extents(
cur->bc_ag.pag->pag_agno,
ext.rc_startblock);
xfs_free_extent_later(cur->bc_tp, fsbno,
- ext.rc_blockcount, NULL);
+ ext.rc_blockcount, NULL, 0);
}
skip:
@@ -1907,7 +1907,8 @@ xfs_refcount_recover_cow_leftovers(
rr->rr_rrec.rc_blockcount);
/* Free the block. */
- xfs_free_extent_later(tp, fsb, rr->rr_rrec.rc_blockcount, NULL);
+ xfs_free_extent_later(tp, fsb, rr->rr_rrec.rc_blockcount, NULL,
+ 0);
error = xfs_trans_commit(tp);
if (error)
diff --git a/fs/xfs/scrub/alloc_repair.c b/fs/xfs/scrub/alloc_repair.c
index 30da7c7d4343..44d85d18c6ef 100644
--- a/fs/xfs/scrub/alloc_repair.c
+++ b/fs/xfs/scrub/alloc_repair.c
@@ -492,8 +492,9 @@ xrep_abt_dispose_one(
if (resv->used == resv->len)
return;
- __xfs_free_extent_later(sc->tp, fsbno + resv->used,
- resv->len - resv->used, NULL, true);
+ xfs_free_extent_later(sc->tp, fsbno + resv->used,
+ resv->len - resv->used, NULL,
+ XFS_FREE_EXTENT_SKIP_DISCARD);
}
/*
diff --git a/fs/xfs/scrub/newbt.c b/fs/xfs/scrub/newbt.c
index c85575c922d5..87143d3b29bd 100644
--- a/fs/xfs/scrub/newbt.c
+++ b/fs/xfs/scrub/newbt.c
@@ -415,7 +415,8 @@ xrep_newbt_cancel_resv(
resv->agbno, resv->len, xnr->oinfo.oi_owner);
fsbno = XFS_AGB_TO_FSB(sc->mp, resv->pag->pag_agno, resv->agbno);
- __xfs_free_extent_later(sc->tp, fsbno, resv->len, &xnr->oinfo, true);
+ xfs_free_extent_later(sc->tp, fsbno, resv->len, &xnr->oinfo,
+ XFS_FREE_EXTENT_SKIP_DISCARD);
xrep_newbt_finish_autoreap(sc, resv);
}
@@ -497,8 +498,8 @@ xrep_newbt_destroy_resv(
resv->len - resv->used, xnr->oinfo.oi_owner);
fsbno = XFS_AGB_TO_FSB(sc->mp, resv->pag->pag_agno, agbno);
- __xfs_free_extent_later(sc->tp, fsbno, resv->len - resv->used,
- &xnr->oinfo, true);
+ xfs_free_extent_later(sc->tp, fsbno, resv->len - resv->used,
+ &xnr->oinfo, XFS_FREE_EXTENT_SKIP_DISCARD);
done:
xrep_newbt_finish_autoreap(sc, resv);
}
diff --git a/fs/xfs/scrub/reap.c b/fs/xfs/scrub/reap.c
index f43ad4dfc6f7..151afacab982 100644
--- a/fs/xfs/scrub/reap.c
+++ b/fs/xfs/scrub/reap.c
@@ -382,7 +382,8 @@ xreap_agextent(
rs->force_roll = true;
xfs_refcount_free_cow_extent(sc->tp, fsbno, *aglenp);
- __xfs_free_extent_later(sc->tp, fsbno, *aglenp, NULL, true);
+ xfs_free_extent_later(sc->tp, fsbno, *aglenp, NULL,
+ XFS_FREE_EXTENT_SKIP_DISCARD);
return 0;
}
@@ -412,7 +413,8 @@ xreap_agextent(
* to minimize the window in which we could crash and lose the
* old blocks.
*/
- __xfs_free_extent_later(sc->tp, fsbno, *aglenp, rs->oinfo, true);
+ xfs_free_extent_later(sc->tp, fsbno, *aglenp, rs->oinfo,
+ XFS_FREE_EXTENT_SKIP_DISCARD);
rs->deferred++;
break;
}
@@ -959,8 +961,9 @@ xreap_ifork_extent(
xfs_bmap_unmap_extent(sc->tp, ip, whichfork, imap);
xfs_trans_mod_dquot_byino(sc->tp, ip, XFS_TRANS_DQ_BCOUNT,
-(int64_t)imap->br_blockcount);
- __xfs_free_extent_later(sc->tp, imap->br_startblock,
- imap->br_blockcount, NULL, true);
+ xfs_free_extent_later(sc->tp, imap->br_startblock,
+ imap->br_blockcount, NULL,
+ XFS_FREE_EXTENT_SKIP_DISCARD);
}
out_agf:
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index b7ecd3811e07..b80d6f52caf9 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -620,7 +620,7 @@ xfs_reflink_cancel_cow_blocks(
del.br_blockcount);
xfs_free_extent_later(*tpp, del.br_startblock,
- del.br_blockcount, NULL);
+ del.br_blockcount, NULL, 0);
/* Roll the transaction */
error = xfs_defer_finish(tpp);