diff options
| author | Christoph Hellwig <hch@lst.de> | 2024-11-03 20:18:43 -0800 |
|---|---|---|
| committer | Darrick J. Wong <djwong@kernel.org> | 2024-11-05 13:38:29 -0800 |
| commit | adbc76aa0fedcb6da2d1ceb1ce786d1f963afee8 (patch) | |
| tree | 2fcfa5a59412da321f284e7f0e54cb25b56ab38f /fs/xfs/xfs_discard.c | |
| parent | 0e10cb98f149aa62b381a81b09c479661149a0b2 (diff) | |
xfs: convert busy extent tracking to the generic group structure
Split busy extent tracking from struct xfs_perag into its own private
structure, which can be pointed to by the generic group structure.
Note that this structure is now dynamically allocated instead of embedded
as the upcoming zone XFS code doesn't need it and will also have an
unusually high number of groups due to hardware constraints. Dynamically
allocating the structure this is a big memory saver for this case.
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_discard.c')
| -rw-r--r-- | fs/xfs/xfs_discard.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c index 739ec69c4428..019371c865d2 100644 --- a/fs/xfs/xfs_discard.c +++ b/fs/xfs/xfs_discard.c @@ -117,10 +117,12 @@ xfs_discard_extents( blk_start_plug(&plug); list_for_each_entry(busyp, &extents->extent_list, list) { - trace_xfs_discard_extent(busyp->pag, busyp->bno, busyp->length); + struct xfs_perag *pag = to_perag(busyp->group); + + trace_xfs_discard_extent(pag, busyp->bno, busyp->length); error = __blkdev_issue_discard(mp->m_ddev_targp->bt_bdev, - xfs_agbno_to_daddr(busyp->pag, busyp->bno), + xfs_agbno_to_daddr(pag, busyp->bno), XFS_FSB_TO_BB(mp, busyp->length), GFP_KERNEL, &bio); if (error && error != -EOPNOTSUPP) { @@ -271,12 +273,12 @@ xfs_trim_gather_extents( * If any blocks in the range are still busy, skip the * discard and try again the next time. */ - if (xfs_extent_busy_search(pag, fbno, flen)) { + if (xfs_extent_busy_search(pag_group(pag), fbno, flen)) { trace_xfs_discard_busy(pag, fbno, flen); goto next_extent; } - xfs_extent_busy_insert_discard(pag, fbno, flen, + xfs_extent_busy_insert_discard(pag_group(pag), fbno, flen, &extents->extent_list); next_extent: if (tcur->by_bno) |
