summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_extent_busy.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-11-03 20:18:29 -0800
committerDarrick J. Wong <djwong@kernel.org>2024-11-05 13:38:25 -0800
commit4a137e09151e3abe9439601013126d877fa25775 (patch)
treee3d78079e49826707a8349384041e11d93eae175 /fs/xfs/xfs_extent_busy.c
parentb6dc8c6dd2d3f230e1a554f869d6df4568a2dfbb (diff)
xfs: keep a reference to the pag for busy extents
Processing of busy extents requires the perag structure, so keep the reference while they are in flight. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_extent_busy.c')
-rw-r--r--fs/xfs/xfs_extent_busy.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/xfs/xfs_extent_busy.c b/fs/xfs/xfs_extent_busy.c
index 22c16fa56bcc..7c0595db2985 100644
--- a/fs/xfs/xfs_extent_busy.c
+++ b/fs/xfs/xfs_extent_busy.c
@@ -34,7 +34,7 @@ xfs_extent_busy_insert_list(
new = kzalloc(sizeof(struct xfs_extent_busy),
GFP_KERNEL | __GFP_NOFAIL);
- new->agno = pag->pag_agno;
+ new->pag = xfs_perag_hold(pag);
new->bno = bno;
new->length = len;
INIT_LIST_HEAD(&new->list);
@@ -526,12 +526,14 @@ xfs_extent_busy_clear_one(
busyp->flags = XFS_EXTENT_BUSY_DISCARDED;
return false;
}
- trace_xfs_extent_busy_clear(pag->pag_mount, busyp->agno,
- busyp->bno, busyp->length);
+ trace_xfs_extent_busy_clear(pag->pag_mount,
+ busyp->pag->pag_agno, busyp->bno,
+ busyp->length);
rb_erase(&busyp->rb_node, &pag->pagb_tree);
}
list_del_init(&busyp->list);
+ xfs_perag_put(busyp->pag);
kfree(busyp);
return true;
}
@@ -554,10 +556,9 @@ xfs_extent_busy_clear(
return;
do {
+ struct xfs_perag *pag = xfs_perag_hold(busyp->pag);
bool wakeup = false;
- struct xfs_perag *pag;
- pag = xfs_perag_get(mp, busyp->agno);
spin_lock(&pag->pagb_lock);
do {
next = list_next_entry(busyp, list);
@@ -565,7 +566,7 @@ xfs_extent_busy_clear(
wakeup = true;
busyp = next;
} while (!list_entry_is_head(busyp, list, list) &&
- busyp->agno == pag->pag_agno);
+ busyp->pag == pag);
if (wakeup) {
pag->pagb_gen++;
@@ -662,7 +663,7 @@ xfs_extent_busy_ag_cmp(
container_of(l2, struct xfs_extent_busy, list);
s32 diff;
- diff = b1->agno - b2->agno;
+ diff = b1->pag->pag_agno - b2->pag->pag_agno;
if (!diff)
diff = b1->bno - b2->bno;
return diff;