diff options
author | Christoph Hellwig <hch@lst.de> | 2024-04-05 09:07:08 +0300 |
---|---|---|
committer | Chandan Babu R <chandanbabu@kernel.org> | 2024-04-22 10:23:34 +0300 |
commit | e78a3ce28331583cc0b57b0602528c4d7628fc19 (patch) | |
tree | 3679d3f75a8caafe5a8ec48b7169860f77632b1e /fs/xfs/xfs_extent_busy.c | |
parent | 05150d46a33fdb567d9849b831aa139e1693e39c (diff) | |
download | linux-e78a3ce28331583cc0b57b0602528c4d7628fc19.tar.xz |
xfs: move more logic into xfs_extent_busy_clear_one
Move the handling of discarded entries into xfs_extent_busy_clear_one
to reuse the length check and tidy up the logic in the caller.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_extent_busy.c')
-rw-r--r-- | fs/xfs/xfs_extent_busy.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/xfs/xfs_extent_busy.c b/fs/xfs/xfs_extent_busy.c index 56cfa1498571..6fbffa46e5e9 100644 --- a/fs/xfs/xfs_extent_busy.c +++ b/fs/xfs/xfs_extent_busy.c @@ -518,20 +518,26 @@ fail: goto out; } -STATIC void +static bool xfs_extent_busy_clear_one( - struct xfs_mount *mp, struct xfs_perag *pag, - struct xfs_extent_busy *busyp) + struct xfs_extent_busy *busyp, + bool do_discard) { if (busyp->length) { - trace_xfs_extent_busy_clear(mp, busyp->agno, busyp->bno, - busyp->length); + if (do_discard && + !(busyp->flags & XFS_EXTENT_BUSY_SKIP_DISCARD)) { + busyp->flags = XFS_EXTENT_BUSY_DISCARDED; + return false; + } + trace_xfs_extent_busy_clear(pag->pag_mount, busyp->agno, + busyp->bno, busyp->length); rb_erase(&busyp->rb_node, &pag->pagb_tree); } list_del_init(&busyp->list); kfree(busyp); + return true; } static void @@ -575,13 +581,8 @@ xfs_extent_busy_clear( wakeup = false; } - if (do_discard && busyp->length && - !(busyp->flags & XFS_EXTENT_BUSY_SKIP_DISCARD)) { - busyp->flags = XFS_EXTENT_BUSY_DISCARDED; - } else { - xfs_extent_busy_clear_one(mp, pag, busyp); + if (xfs_extent_busy_clear_one(pag, busyp, do_discard)) wakeup = true; - } } if (pag) |