Skip to content

Commit 2bf6e35

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
xfs: fix rtalloc rotoring when delalloc is in use
If we're trying to allocate real space for a delalloc reservation at offset 0, we should use the rotor to spread files across the rt volume. Switch the rtalloc to use the XFS_ALLOC_INITIAL_USER_DATA flag that is set for any write at startoff to make it match the behavior for the main data device. Based on a patch from Darrick J. Wong. Fixes: 6a94b1a ("xfs: reinstate delalloc for RT inodes (if sb_rextsize == 1)") Reported-by: Darrick J. Wong <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent 49cdc4e commit 2bf6e35

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/xfs/xfs_rtalloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "xfs_bit.h"
1313
#include "xfs_mount.h"
1414
#include "xfs_inode.h"
15+
#include "xfs_alloc.h"
1516
#include "xfs_bmap.h"
1617
#include "xfs_bmap_btree.h"
1718
#include "xfs_bmap_util.h"
@@ -1382,7 +1383,7 @@ xfs_bmap_rtalloc(
13821383
start = 0;
13831384
} else if (xfs_bmap_adjacent(ap)) {
13841385
start = xfs_rtb_to_rtx(mp, ap->blkno);
1385-
} else if (ap->eof && ap->offset == 0) {
1386+
} else if (ap->datatype & XFS_ALLOC_INITIAL_USER_DATA) {
13861387
/*
13871388
* If it's an allocation to an empty file at offset 0, pick an
13881389
* extent that will space things out in the rt area.

0 commit comments

Comments
 (0)