summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-07-14 11:06:38 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-10-14 14:16:48 -0700
commit2b77cd75da73c2a18d786250ad5fe311c3c812d2 (patch)
tree8218fa3996234726cb7f007e1c98094c7ca0af99
parente906c6285e28b7d8e40499fbf23c3441e5c35651 (diff)
xfs: ignore intents targetting file data on the realtime device
Provide a way to mask off the scrub intent counter bump and drop operations when we deal with realtime extents. We'll need this functionality when we gain the need to create deferred rmap and refcount update chains, but for now this API change just makes it so that we can ignore anything touching rt. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r--fs/xfs/scrub/newbt.c12
-rw-r--r--fs/xfs/xfs_bmap_item.c9
-rw-r--r--fs/xfs/xfs_extfree_item.c4
-rw-r--r--fs/xfs/xfs_mount.c8
-rw-r--r--fs/xfs/xfs_mount.h8
-rw-r--r--fs/xfs/xfs_refcount_item.c6
-rw-r--r--fs/xfs/xfs_rmap_item.c6
7 files changed, 33 insertions, 20 deletions
diff --git a/fs/xfs/scrub/newbt.c b/fs/xfs/scrub/newbt.c
index 02c8538a9b5b..3739b420e0af 100644
--- a/fs/xfs/scrub/newbt.c
+++ b/fs/xfs/scrub/newbt.c
@@ -160,16 +160,16 @@ xrep_newbt_schedule_autoreap(
INIT_LIST_HEAD(&efi_item.xefi_list);
list_add(&efi_item.xefi_list, &items);
- xfs_fs_bump_intents(xnr->sc->mp, resv->fsbno);
+ xfs_fs_bump_intents(xnr->sc->mp, false, resv->fsbno);
lip = xfs_extent_free_defer_type.create_intent(xnr->sc->tp,
&items, 1, false);
if (!lip) {
ASSERT(0);
- xfs_fs_drop_intents(xnr->sc->mp, resv->fsbno);
+ xfs_fs_drop_intents(xnr->sc->mp, false, resv->fsbno);
return -EFSCORRUPTED;
}
if (IS_ERR(lip)) {
- xfs_fs_drop_intents(xnr->sc->mp, resv->fsbno);
+ xfs_fs_drop_intents(xnr->sc->mp, false, resv->fsbno);
return PTR_ERR(lip);
}
@@ -383,7 +383,7 @@ xrep_newbt_free_resv(
*/
list_for_each_entry_safe(resv, n, &xnr->resv_list, list) {
xrep_newbt_cancel_autoreap(resv);
- xfs_fs_drop_intents(sc->mp, resv->fsbno);
+ xfs_fs_drop_intents(sc->mp, false, resv->fsbno);
list_del(&resv->list);
kfree(resv);
}
@@ -418,7 +418,7 @@ xrep_newbt_cancel_resv(
&xnr->oinfo, true);
/* Drop the intent drain after we commit the new item. */
- xfs_fs_drop_intents(sc->mp, resv->fsbno);
+ xfs_fs_drop_intents(sc->mp, false, resv->fsbno);
}
/*
@@ -515,7 +515,7 @@ xrep_newbt_destroy_resv(
* original fsbno from the reservation because destroying the
* reservation consumes resv->fsbno.
*/
- xfs_fs_drop_intents(sc->mp, fsbno);
+ xfs_fs_drop_intents(sc->mp, false, fsbno);
}
/* Free all the accounting info and disk space we reserved for a new btree. */
diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
index 8b5edb862852..227bd72b071a 100644
--- a/fs/xfs/xfs_bmap_item.c
+++ b/fs/xfs/xfs_bmap_item.c
@@ -360,10 +360,13 @@ xfs_bmap_drop_intents(
const struct xfs_bmap_intent *bi,
xfs_fsblock_t orig_startblock)
{
+ bool isrt;
+
if (!xfs_has_rmapbt(mp))
return;
- xfs_fs_drop_intents(mp, orig_startblock);
+ isrt = xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork);
+ xfs_fs_drop_intents(mp, isrt, orig_startblock);
}
/* Process a deferred rmap update. */
@@ -426,6 +429,7 @@ xfs_bmap_update_add_item(
const struct list_head *item)
{
const struct xfs_bmap_intent *bi;
+ bool isrt;
bi = container_of(item, struct xfs_bmap_intent, bi_list);
@@ -436,7 +440,8 @@ xfs_bmap_update_add_item(
if (!xfs_has_rmapbt(mp))
return;
- xfs_fs_bump_intents(mp, bi->bi_bmap.br_startblock);
+ isrt = xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork);
+ xfs_fs_bump_intents(mp, isrt, bi->bi_bmap.br_startblock);
}
const struct xfs_defer_op_type xfs_bmap_update_defer_type = {
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 92032f2b7be0..358a9ae6a4c7 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -482,7 +482,7 @@ xfs_extent_free_drop_intents(
struct xfs_mount *mp,
const struct xfs_extent_free_item *xefi)
{
- xfs_fs_drop_intents(mp, xefi->xefi_startblock);
+ xfs_fs_drop_intents(mp, false, xefi->xefi_startblock);
}
/* Process a free extent. */
@@ -546,7 +546,7 @@ xfs_extent_free_add_item(
xefi = container_of(item, struct xfs_extent_free_item, xefi_list);
/* Grab an intent counter reference for this intent item. */
- xfs_fs_bump_intents(mp, xefi->xefi_startblock);
+ xfs_fs_bump_intents(mp, false, xefi->xefi_startblock);
}
const struct xfs_defer_op_type xfs_extent_free_defer_type = {
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index c7bba1662914..eff72f0ff0a2 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1448,10 +1448,14 @@ static inline int xfs_drain_wait(struct xfs_drain *dr)
void
xfs_fs_bump_intents(
struct xfs_mount *mp,
+ bool isrt,
xfs_fsblock_t fsb)
{
struct xfs_perag *pag;
+ if (isrt)
+ return;
+
pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, fsb));
trace_xfs_perag_bump_intents(pag, __return_address);
xfs_drain_bump(&pag->pag_intents);
@@ -1462,10 +1466,14 @@ xfs_fs_bump_intents(
void
xfs_fs_drop_intents(
struct xfs_mount *mp,
+ bool isrt,
xfs_fsblock_t fsb)
{
struct xfs_perag *pag;
+ if (isrt)
+ return;
+
pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, fsb));
trace_xfs_perag_drop_intents(pag, __return_address);
xfs_drain_drop(&pag->pag_intents);
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index a9c61bf04841..07b357bcf9f3 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -139,8 +139,8 @@ bool xfs_ag_intents_busy(struct xfs_perag *pag);
void xfs_drain_wait_disable(void);
void xfs_drain_wait_enable(void);
-void xfs_fs_bump_intents(struct xfs_mount *mp, xfs_fsblock_t fsb);
-void xfs_fs_drop_intents(struct xfs_mount *mp, xfs_fsblock_t fsb);
+void xfs_fs_bump_intents(struct xfs_mount *mp, bool isrt, xfs_fsblock_t fsb);
+void xfs_fs_drop_intents(struct xfs_mount *mp, bool isrt, xfs_fsblock_t fsb);
/*
* Use a large batch value for the drain counter so that writer threads
@@ -171,12 +171,12 @@ static inline void xfs_drain_free(struct xfs_drain *dr)
struct xfs_drain { /* empty */ };
static inline void
-xfs_fs_bump_intents(struct xfs_mount *mp, xfs_fsblock_t fsb)
+xfs_fs_bump_intents(struct xfs_mount *mp, bool isrt, xfs_fsblock_t fsb)
{
}
static inline void
-xfs_fs_drop_intents(struct xfs_mount *mp, xfs_fsblock_t fsb)
+xfs_fs_drop_intents(struct xfs_mount *mp, bool isrt, xfs_fsblock_t fsb)
{
}
# define xfs_drain_init(dr) (0)
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index f16208b0929d..bcdc62385498 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -405,7 +405,7 @@ xfs_refcount_update_finish_item(
* work or failed. Be careful to use the original startblock because
* the finishing functions can update the intent state.
*/
- xfs_fs_drop_intents(mp, orig_startblock);
+ xfs_fs_drop_intents(mp, false, orig_startblock);
kmem_cache_free(xfs_refcount_intent_cache, refc);
return error;
}
@@ -427,7 +427,7 @@ xfs_refcount_update_cancel_item(
struct xfs_refcount_intent *refc;
refc = container_of(item, struct xfs_refcount_intent, ri_list);
- xfs_fs_drop_intents(mp, refc->ri_startblock);
+ xfs_fs_drop_intents(mp, false, refc->ri_startblock);
kmem_cache_free(xfs_refcount_intent_cache, refc);
}
@@ -440,7 +440,7 @@ xfs_refcount_update_add_item(
const struct xfs_refcount_intent *ri;
ri = container_of(item, struct xfs_refcount_intent, ri_list);
- xfs_fs_bump_intents(mp, ri->ri_startblock);
+ xfs_fs_bump_intents(mp, false, ri->ri_startblock);
}
const struct xfs_defer_op_type xfs_refcount_update_defer_type = {
diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
index b107eb4759b1..c3e73ae7394b 100644
--- a/fs/xfs/xfs_rmap_item.c
+++ b/fs/xfs/xfs_rmap_item.c
@@ -441,7 +441,7 @@ xfs_rmap_update_finish_item(
rmap->ri_bmap.br_blockcount, rmap->ri_bmap.br_state,
state);
- xfs_fs_drop_intents(mp, rmap->ri_bmap.br_startblock);
+ xfs_fs_drop_intents(mp, false, rmap->ri_bmap.br_startblock);
kmem_cache_free(xfs_rmap_intent_cache, rmap);
return error;
}
@@ -463,7 +463,7 @@ xfs_rmap_update_cancel_item(
struct xfs_rmap_intent *rmap;
rmap = container_of(item, struct xfs_rmap_intent, ri_list);
- xfs_fs_drop_intents(mp, rmap->ri_bmap.br_startblock);
+ xfs_fs_drop_intents(mp, false, rmap->ri_bmap.br_startblock);
kmem_cache_free(xfs_rmap_intent_cache, rmap);
}
@@ -476,7 +476,7 @@ xfs_rmap_update_add_item(
const struct xfs_rmap_intent *ri;
ri = container_of(item, struct xfs_rmap_intent, ri_list);
- xfs_fs_bump_intents(mp, ri->ri_bmap.br_startblock);
+ xfs_fs_bump_intents(mp, false, ri->ri_bmap.br_startblock);
}
const struct xfs_defer_op_type xfs_rmap_update_defer_type = {