]> www.infradead.org Git - users/hch/misc.git/commitdiff
xfs: fix rtalloc rotoring when delalloc is in use
authorChristoph Hellwig <hch@lst.de>
Tue, 16 Jul 2024 21:50:25 +0000 (14:50 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 24 Jul 2024 05:33:26 +0000 (22:33 -0700)
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: 6a94b1acda7e ("xfs: reinstate delalloc for RT inodes (if sb_rextsize == 1)")
Reported-by: Darrick J. Wong <djwong@kernel.org>
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>
fs/xfs/xfs_rtalloc.c

index 5a7ddfed1bb8554992c91bb4bdcf576ed206cd84..0c3e96c621a672d43fb9394d703f7a5dfbb8e0e4 100644 (file)
@@ -12,6 +12,7 @@
 #include "xfs_bit.h"
 #include "xfs_mount.h"
 #include "xfs_inode.h"
+#include "xfs_alloc.h"
 #include "xfs_bmap.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_bmap_util.h"
@@ -1382,7 +1383,7 @@ retry:
                start = 0;
        } else if (xfs_bmap_adjacent(ap)) {
                start = xfs_rtb_to_rtx(mp, ap->blkno);
-       } else if (ap->eof && ap->offset == 0) {
+       } else if (ap->datatype & XFS_ALLOC_INITIAL_USER_DATA) {
                /*
                 * If it's an allocation to an empty file at offset 0, pick an
                 * extent that will space things out in the rt area.