Skip to content

Commit b91afef

Browse files
author
Darrick J. Wong
committed
xfs: don't merge ioends across RTGs
Unlike AGs, RTGs don't always have metadata in their first blocks, and thus we don't get automatic protection from merging I/O completions across RTG boundaries. Add code to set the IOMAP_F_BOUNDARY flag for ioends that start at the first block of a RTG so that they never get merged into the previous ioend. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 44e69c9 commit b91afef

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

fs/xfs/libxfs/xfs_rtgroup.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ xfs_rtb_to_rgbno(
188188
return __xfs_rtb_to_rgbno(mp, rtbno);
189189
}
190190

191+
/* Is rtbno the start of a RT group? */
192+
static inline bool
193+
xfs_rtbno_is_group_start(
194+
struct xfs_mount *mp,
195+
xfs_rtblock_t rtbno)
196+
{
197+
return (rtbno & mp->m_rgblkmask) == 0;
198+
}
199+
191200
static inline xfs_daddr_t
192201
xfs_rtb_to_daddr(
193202
struct xfs_mount *mp,

fs/xfs/xfs_iomap.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "xfs_iomap.h"
2525
#include "xfs_trace.h"
2626
#include "xfs_quota.h"
27+
#include "xfs_rtgroup.h"
2728
#include "xfs_dquot_item.h"
2829
#include "xfs_dquot.h"
2930
#include "xfs_reflink.h"
@@ -115,7 +116,9 @@ xfs_bmbt_to_iomap(
115116
iomap->addr = IOMAP_NULL_ADDR;
116117
iomap->type = IOMAP_DELALLOC;
117118
} else {
118-
iomap->addr = BBTOB(xfs_fsb_to_db(ip, imap->br_startblock));
119+
xfs_daddr_t daddr = xfs_fsb_to_db(ip, imap->br_startblock);
120+
121+
iomap->addr = BBTOB(daddr);
119122
if (mapping_flags & IOMAP_DAX)
120123
iomap->addr += target->bt_dax_part_off;
121124

@@ -124,6 +127,14 @@ xfs_bmbt_to_iomap(
124127
else
125128
iomap->type = IOMAP_MAPPED;
126129

130+
/*
131+
* Mark iomaps starting at the first sector of a RTG as merge
132+
* boundary so that each I/O completions is contained to a
133+
* single RTG.
134+
*/
135+
if (XFS_IS_REALTIME_INODE(ip) && xfs_has_rtgroups(mp) &&
136+
xfs_rtbno_is_group_start(mp, imap->br_startblock))
137+
iomap->flags |= IOMAP_F_BOUNDARY;
127138
}
128139
iomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff);
129140
iomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount);

0 commit comments

Comments
 (0)