diff options
| author | Carlos Maiolino <cem@kernel.org> | 2024-11-12 11:00:16 +0100 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2024-11-12 11:00:16 +0100 |
| commit | cb288c9fb2aba9a5d71b8191dfcb6f2cced37f7a (patch) | |
| tree | 971015f390ddc3b7f3e51b46112b44bc2c8952cb /fs | |
| parent | Merge tag 'incore-rtgroups-6.13_2024-11-05' of https://git.kernel.org/pub/scm... (diff) | |
| parent | iomap: add a merge boundary flag (diff) | |
| download | linux-cb288c9fb2aba9a5d71b8191dfcb6f2cced37f7a.tar.gz linux-cb288c9fb2aba9a5d71b8191dfcb6f2cced37f7a.zip | |
Merge tag 'rtgroups-prep-6.13_2024-11-05' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into staging-merge
xfs: preparation for realtime allocation groups [v5.5 05/10]
Prepare for realtime groups by adding a few bug fixes and generic code
that will be necessary.
With a bit of luck, this should all go splendidly.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/iomap/buffered-io.c | 6 | ||||
| -rw-r--r-- | fs/xfs/xfs_discard.c | 19 |
2 files changed, 17 insertions, 8 deletions
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index ef0b68bccbb6..fcadd31017d1 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1601,6 +1601,8 @@ iomap_ioend_can_merge(struct iomap_ioend *ioend, struct iomap_ioend *next) { if (ioend->io_bio.bi_status != next->io_bio.bi_status) return false; + if (next->io_flags & IOMAP_F_BOUNDARY) + return false; if ((ioend->io_flags & IOMAP_F_SHARED) ^ (next->io_flags & IOMAP_F_SHARED)) return false; @@ -1720,6 +1722,8 @@ static struct iomap_ioend *iomap_alloc_ioend(struct iomap_writepage_ctx *wpc, INIT_LIST_HEAD(&ioend->io_list); ioend->io_type = wpc->iomap.type; ioend->io_flags = wpc->iomap.flags; + if (pos > wpc->iomap.offset) + wpc->iomap.flags &= ~IOMAP_F_BOUNDARY; ioend->io_inode = inode; ioend->io_size = 0; ioend->io_offset = pos; @@ -1731,6 +1735,8 @@ static struct iomap_ioend *iomap_alloc_ioend(struct iomap_writepage_ctx *wpc, static bool iomap_can_add_to_ioend(struct iomap_writepage_ctx *wpc, loff_t pos) { + if (wpc->iomap.offset == pos && (wpc->iomap.flags & IOMAP_F_BOUNDARY)) + return false; if ((wpc->iomap.flags & IOMAP_F_SHARED) != (wpc->ioend->io_flags & IOMAP_F_SHARED)) return false; diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c index 4f3e4736f13e..42b8b5e0e931 100644 --- a/fs/xfs/xfs_discard.c +++ b/fs/xfs/xfs_discard.c @@ -480,7 +480,7 @@ xfs_discard_rtdev_extents( trace_xfs_discard_rtextent(mp, busyp->bno, busyp->length); error = __blkdev_issue_discard(bdev, - XFS_FSB_TO_BB(mp, busyp->bno), + xfs_rtb_to_daddr(mp, busyp->bno), XFS_FSB_TO_BB(mp, busyp->length), GFP_NOFS, &bio); if (error) @@ -612,22 +612,25 @@ xfs_trim_rtdev_extents( xfs_rtblock_t start_rtbno, end_rtbno; xfs_rtxnum_t start_rtx, end_rtx; xfs_rgnumber_t start_rgno, end_rgno; + xfs_daddr_t daddr_offset; int last_error = 0, error; struct xfs_rtgroup *rtg = NULL; /* Shift the start and end downwards to match the rt device. */ - start_rtbno = xfs_daddr_to_rtb(mp, start); - if (start_rtbno > mp->m_sb.sb_dblocks) - start_rtbno -= mp->m_sb.sb_dblocks; + daddr_offset = XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); + if (start > daddr_offset) + start -= daddr_offset; else - start_rtbno = 0; + start = 0; + start_rtbno = xfs_daddr_to_rtb(mp, start); start_rtx = xfs_rtb_to_rtx(mp, start_rtbno); start_rgno = xfs_rtb_to_rgno(mp, start_rtbno); - end_rtbno = xfs_daddr_to_rtb(mp, end); - if (end_rtbno <= mp->m_sb.sb_dblocks) + if (end <= daddr_offset) return 0; - end_rtbno -= mp->m_sb.sb_dblocks; + else + end -= daddr_offset; + end_rtbno = xfs_daddr_to_rtb(mp, end); end_rtx = xfs_rtb_to_rtx(mp, end_rtbno + mp->m_sb.sb_rextsize - 1); end_rgno = xfs_rtb_to_rgno(mp, end_rtbno); |
