* [PATCH] xfs: fix rtalloc rotoring when delalloc is in use
@ 2024-07-08 12:02 Christoph Hellwig
2024-07-08 17:24 ` Darrick J. Wong
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2024-07-08 12:02 UTC (permalink / raw)
To: chandan.babu; +Cc: djwong, linux-xfs
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)")
Repored-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_rtalloc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 5a7ddfed1bb855..0c3e96c621a672 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -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 @@ xfs_bmap_rtalloc(
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.
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfs: fix rtalloc rotoring when delalloc is in use
2024-07-08 12:02 [PATCH] xfs: fix rtalloc rotoring when delalloc is in use Christoph Hellwig
@ 2024-07-08 17:24 ` Darrick J. Wong
0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2024-07-08 17:24 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: chandan.babu, linux-xfs
On Mon, Jul 08, 2024 at 02:02:57PM +0200, Christoph Hellwig wrote:
> 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)")
> Repored-by: Darrick J. Wong <djwong@kernel.org>
Reported-by:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
With that fixed,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_rtalloc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
> index 5a7ddfed1bb855..0c3e96c621a672 100644
> --- a/fs/xfs/xfs_rtalloc.c
> +++ b/fs/xfs/xfs_rtalloc.c
> @@ -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 @@ xfs_bmap_rtalloc(
> 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.
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-08 17:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-08 12:02 [PATCH] xfs: fix rtalloc rotoring when delalloc is in use Christoph Hellwig
2024-07-08 17:24 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox