* [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-06-23 14:21 Christoph Hellwig
@ 2026-06-23 14:21 ` Christoph Hellwig
2026-07-02 22:25 ` Damien Le Moal
2026-07-20 9:02 ` Carlos Maiolino
0 siblings, 2 replies; 13+ messages in thread
From: Christoph Hellwig @ 2026-06-23 14:21 UTC (permalink / raw)
To: Carlos Maiolino
Cc: Jan Kara, Filip Blagojevic, Matthew Wilcox, Damien Le Moal,
linux-fsdevel, linux-xfs
When using XFS with a main device on an SSD that stores metadata and a RT
device to store data on a HDD, we fail to take the I/O sizes for the RT
device into accounting, leading to up to 5% slower read performance when
using an SSD for metadata vs storing data and metadata on the HDD.
Fix this up by taking the RT settings into account. Note that this
updates the BDI owned by the main device, and leaves those settings in
place even when the file system is unmounted. This is a bit unexpected
but not different from manual tuning through sysfs (although that is only
possible for the ra_pages value).
Reported-by: Filip Blagojevic <filip.blagojevic@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_super.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index e6781f86d867..88edd3822872 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -546,6 +546,29 @@ xfs_open_devices(
return error;
}
+/*
+ * When using a RT device some or all data I/O is using the RT device, but
+ * the BDI is inherited from the main data device. When the underlying block
+ * device for the RT device has larger I/O sizes, the BDI settings might be
+ * incorrect, which is especially bad if the main device is a SSD and the
+ * RT device is a HDD, as the io_opt fixup in blk_apply_bdi_limits is missing
+ * for this case.
+ *
+ * Update the BDI values to the max of the data and RT device to cover our
+ * bases.
+ */
+static void
+xfs_update_bdi_rahead(
+ struct xfs_mount *mp)
+{
+ struct backing_dev_info *rt_bdi =
+ mp->m_rtdev_targp->bt_bdev->bd_disk->bdi;
+ struct backing_dev_info *sb_bdi = mp->m_super->s_bdi;
+
+ sb_bdi->ra_pages = max(sb_bdi->ra_pages, rt_bdi->ra_pages);
+ sb_bdi->io_pages = max(sb_bdi->io_pages, rt_bdi->io_pages);
+}
+
/*
* Setup xfs_mount buffer target pointers based on superblock
*/
@@ -583,6 +606,7 @@ xfs_setup_devices(
mp->m_sb.sb_sectsize, mp->m_sb.sb_rblocks);
if (error)
return error;
+ xfs_update_bdi_rahead(mp);
}
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-06-23 14:21 ` [PATCH] xfs: " Christoph Hellwig
@ 2026-07-02 22:25 ` Damien Le Moal
2026-07-20 9:02 ` Carlos Maiolino
1 sibling, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2026-07-02 22:25 UTC (permalink / raw)
To: Christoph Hellwig, Carlos Maiolino
Cc: Jan Kara, Filip Blagojevic, Matthew Wilcox, linux-fsdevel,
linux-xfs
On 6/23/26 23:21, Christoph Hellwig wrote:
> When using XFS with a main device on an SSD that stores metadata and a RT
> device to store data on a HDD, we fail to take the I/O sizes for the RT
> device into accounting, leading to up to 5% slower read performance when
> using an SSD for metadata vs storing data and metadata on the HDD.
>
> Fix this up by taking the RT settings into account. Note that this
> updates the BDI owned by the main device, and leaves those settings in
> place even when the file system is unmounted. This is a bit unexpected
> but not different from manual tuning through sysfs (although that is only
> possible for the ra_pages value).
>
> Reported-by: Filip Blagojevic <filip.blagojevic@wdc.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Until we have a better API to do this, given the performance improvements this
gives with HDDs, I am all for it.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-06-23 14:21 ` [PATCH] xfs: " Christoph Hellwig
2026-07-02 22:25 ` Damien Le Moal
@ 2026-07-20 9:02 ` Carlos Maiolino
2026-07-20 9:11 ` Christoph Hellwig
1 sibling, 1 reply; 13+ messages in thread
From: Carlos Maiolino @ 2026-07-20 9:02 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jan Kara, Filip Blagojevic, Matthew Wilcox, Damien Le Moal,
linux-fsdevel, linux-xfs
On Tue, Jun 23, 2026 at 04:21:06PM +0200, Christoph Hellwig wrote:
> When using XFS with a main device on an SSD that stores metadata and a RT
> device to store data on a HDD, we fail to take the I/O sizes for the RT
> device into accounting, leading to up to 5% slower read performance when
> using an SSD for metadata vs storing data and metadata on the HDD.
>
> Fix this up by taking the RT settings into account. Note that this
> updates the BDI owned by the main device, and leaves those settings in
> place even when the file system is unmounted. This is a bit unexpected
> but not different from manual tuning through sysfs (although that is only
> possible for the ra_pages value).
Sorry a 'very late reply', but...
On a second thought, wouldn't be wise to cache the original value in
memory and restore it during unmount/filesystem shutdown?
I could send a patch to complement this one if you guys agree, otherwise
just ignore me.
>
> Reported-by: Filip Blagojevic <filip.blagojevic@wdc.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/xfs_super.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index e6781f86d867..88edd3822872 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -546,6 +546,29 @@ xfs_open_devices(
> return error;
> }
>
> +/*
> + * When using a RT device some or all data I/O is using the RT device, but
> + * the BDI is inherited from the main data device. When the underlying block
> + * device for the RT device has larger I/O sizes, the BDI settings might be
> + * incorrect, which is especially bad if the main device is a SSD and the
> + * RT device is a HDD, as the io_opt fixup in blk_apply_bdi_limits is missing
> + * for this case.
> + *
> + * Update the BDI values to the max of the data and RT device to cover our
> + * bases.
> + */
> +static void
> +xfs_update_bdi_rahead(
> + struct xfs_mount *mp)
> +{
> + struct backing_dev_info *rt_bdi =
> + mp->m_rtdev_targp->bt_bdev->bd_disk->bdi;
> + struct backing_dev_info *sb_bdi = mp->m_super->s_bdi;
> +
> + sb_bdi->ra_pages = max(sb_bdi->ra_pages, rt_bdi->ra_pages);
> + sb_bdi->io_pages = max(sb_bdi->io_pages, rt_bdi->io_pages);
> +}
> +
> /*
> * Setup xfs_mount buffer target pointers based on superblock
> */
> @@ -583,6 +606,7 @@ xfs_setup_devices(
> mp->m_sb.sb_sectsize, mp->m_sb.sb_rblocks);
> if (error)
> return error;
> + xfs_update_bdi_rahead(mp);
> }
>
> return 0;
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-07-20 9:02 ` Carlos Maiolino
@ 2026-07-20 9:11 ` Christoph Hellwig
2026-07-20 9:38 ` Carlos Maiolino
0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2026-07-20 9:11 UTC (permalink / raw)
To: Carlos Maiolino
Cc: Christoph Hellwig, Jan Kara, Filip Blagojevic, Matthew Wilcox,
Damien Le Moal, linux-fsdevel, linux-xfs
On Mon, Jul 20, 2026 at 11:02:15AM +0200, Carlos Maiolino wrote:
> On Tue, Jun 23, 2026 at 04:21:06PM +0200, Christoph Hellwig wrote:
> > When using XFS with a main device on an SSD that stores metadata and a RT
> > device to store data on a HDD, we fail to take the I/O sizes for the RT
> > device into accounting, leading to up to 5% slower read performance when
> > using an SSD for metadata vs storing data and metadata on the HDD.
> >
> > Fix this up by taking the RT settings into account. Note that this
> > updates the BDI owned by the main device, and leaves those settings in
> > place even when the file system is unmounted. This is a bit unexpected
> > but not different from manual tuning through sysfs (although that is only
> > possible for the ra_pages value).
>
> Sorry a 'very late reply', but...
> On a second thought, wouldn't be wise to cache the original value in
> memory and restore it during unmount/filesystem shutdown?
>
> I could send a patch to complement this one if you guys agree, otherwise
> just ignore me.
As mentioned this does seem like a valid option, there's tradeoff
both ways. Although we'd also want a flag to avoid restoring them
if they were changed while mounted so it would get a bit more
complicated. Happy to respin it for that if there is a general
preference.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-07-20 9:11 ` Christoph Hellwig
@ 2026-07-20 9:38 ` Carlos Maiolino
0 siblings, 0 replies; 13+ messages in thread
From: Carlos Maiolino @ 2026-07-20 9:38 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jan Kara, Filip Blagojevic, Matthew Wilcox, Damien Le Moal,
linux-fsdevel, linux-xfs
On Mon, Jul 20, 2026 at 11:11:28AM +0200, Christoph Hellwig wrote:
> On Mon, Jul 20, 2026 at 11:02:15AM +0200, Carlos Maiolino wrote:
> > On Tue, Jun 23, 2026 at 04:21:06PM +0200, Christoph Hellwig wrote:
> > > When using XFS with a main device on an SSD that stores metadata and a RT
> > > device to store data on a HDD, we fail to take the I/O sizes for the RT
> > > device into accounting, leading to up to 5% slower read performance when
> > > using an SSD for metadata vs storing data and metadata on the HDD.
> > >
> > > Fix this up by taking the RT settings into account. Note that this
> > > updates the BDI owned by the main device, and leaves those settings in
> > > place even when the file system is unmounted. This is a bit unexpected
> > > but not different from manual tuning through sysfs (although that is only
> > > possible for the ra_pages value).
> >
> > Sorry a 'very late reply', but...
> > On a second thought, wouldn't be wise to cache the original value in
> > memory and restore it during unmount/filesystem shutdown?
> >
> > I could send a patch to complement this one if you guys agree, otherwise
> > just ignore me.
>
> As mentioned this does seem like a valid option, there's tradeoff
> both ways. Although we'd also want a flag to avoid restoring them
> if they were changed while mounted so it would get a bit more
> complicated. Happy to respin it for that if there is a general
> preference.
>
Sorry coming back late to it, I don't want to give you extra work after
we've already discussed the implementation.
I was going to merge this patch today, but it came to my mind that might
not be a good idea to just quietly update BDI settings while XFS is
using it and just keep whatever change we made persist after the mount.
I can still merge it this week and we decide what to do later or just wait a
bit for extra thoughts on this.
Perhaps let's see if we get other comments soon and we make a decision
later this week.
^ permalink raw reply [flat|nested] 13+ messages in thread
* update BDI {io,ra}_pages values based on the RT device limits v2
@ 2026-07-20 14:08 Christoph Hellwig
2026-07-20 14:08 ` [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits Christoph Hellwig
0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2026-07-20 14:08 UTC (permalink / raw)
To: Carlos Maiolino
Cc: Jan Kara, Filip Blagojevic, Matthew Wilcox, Damien Le Moal,
linux-fsdevel, linux-xfs
Hi all,
we ran into a bit of a funny case where adding an SSD to store metadata
to a (zoned) XFS file system reduced the performance vs using a HDD for
both data and metadata. It turns out this is due to readahead code
looking at the BDI limits, including the io_pages value that can't be
inspected or tuned from userspace.
Changes since v1:
- restore the old value at unmount, unless the BDI values changed
since mount
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-07-20 14:08 update BDI {io,ra}_pages values based on the RT device limits v2 Christoph Hellwig
@ 2026-07-20 14:08 ` Christoph Hellwig
2026-07-20 23:07 ` Damien Le Moal
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Christoph Hellwig @ 2026-07-20 14:08 UTC (permalink / raw)
To: Carlos Maiolino
Cc: Jan Kara, Filip Blagojevic, Matthew Wilcox, Damien Le Moal,
linux-fsdevel, linux-xfs
When using XFS with a main device on an SSD that stores metadata and a RT
device to store data on a HDD, we fail to take the I/O sizes for the RT
device into accounting, leading to up to 5% slower read performance when
using an SSD for metadata vs storing data and metadata on the HDD.
Fix this up by taking the RT settings into account at mount an restoring
the old settings at unmount time, unless the BDI settings have changed
from those set by XFS.
Reported-by: Filip Blagojevic <filip.blagojevic@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_mount.h | 7 ++++++
fs/xfs/xfs_super.c | 53 +++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 66a02d1b9ad7..216a38a354e7 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -349,6 +349,13 @@ typedef struct xfs_mount {
/* Index of uuid record in the uuid xarray. */
unsigned int m_uuid_table_index;
+
+ /*
+ * Old io_pages/ra_pages valued in the main bdev BDI, and our initial
+ * calculated values.
+ */
+ unsigned long m_old_io_pages, m_initial_io_pages;
+ unsigned long m_old_ra_pages, m_initial_ra_pages;
} xfs_mount_t;
#define M_IGEO(mp) (&(mp)->m_ino_geo)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 8531d526fc44..63c4bcbe6c2b 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -548,6 +548,52 @@ xfs_open_devices(
return error;
}
+/*
+ * When using a RT device some or all data I/O is using the RT device, but
+ * the BDI is inherited from the main data device. When the underlying block
+ * device for the RT device has larger I/O sizes, the BDI settings might be
+ * incorrect, which is especially bad if the main device is a SSD and the
+ * RT device is a HDD, as the io_opt fixup in blk_apply_bdi_limits is missing
+ * for this case.
+ *
+ * Update the BDI values to the max of the data and RT device to cover our
+ * bases.
+ */
+static void
+xfs_update_bdi_rahead(
+ struct xfs_mount *mp)
+{
+ struct backing_dev_info *rt_bdi =
+ mp->m_rtdev_targp->bt_bdev->bd_disk->bdi;
+ struct backing_dev_info *sb_bdi = mp->m_super->s_bdi;
+
+ mp->m_old_io_pages = sb_bdi->io_pages;
+ mp->m_old_ra_pages = sb_bdi->ra_pages;
+
+ sb_bdi->io_pages = mp->m_initial_io_pages =
+ max(sb_bdi->io_pages, rt_bdi->io_pages);
+ sb_bdi->ra_pages = mp->m_initial_ra_pages =
+ max(sb_bdi->ra_pages, rt_bdi->ra_pages);
+}
+
+static void
+xfs_restore_bdi_rahead(
+ struct xfs_mount *mp)
+{
+ struct backing_dev_info *sb_bdi = mp->m_super->s_bdi;
+
+ if (sb_bdi->io_pages == mp->m_initial_io_pages)
+ sb_bdi->io_pages = mp->m_old_io_pages;
+ else
+ xfs_info(mp, "io_pages changed from %lu to %lu, not restoring.",
+ mp->m_initial_io_pages, sb_bdi->io_pages);
+ if (sb_bdi->ra_pages == mp->m_initial_ra_pages)
+ sb_bdi->ra_pages = mp->m_old_ra_pages;
+ else
+ xfs_info(mp, "ra_pages changed from %lu to %lu, not restoring.",
+ mp->m_initial_ra_pages, sb_bdi->ra_pages);
+}
+
/*
* Setup xfs_mount buffer target pointers based on superblock
*/
@@ -585,6 +631,7 @@ xfs_setup_devices(
mp->m_sb.sb_sectsize, mp->m_sb.sb_rblocks);
if (error)
return error;
+ xfs_update_bdi_rahead(mp);
}
return 0;
@@ -2283,8 +2330,12 @@ static void
xfs_kill_sb(
struct super_block *sb)
{
+ struct xfs_mount *mp = XFS_M(sb);
+
+ if (mp->m_rtdev_targp && mp->m_rtdev_targp != mp->m_ddev_targp)
+ xfs_restore_bdi_rahead(mp);
kill_block_super(sb);
- xfs_mount_free(XFS_M(sb));
+ xfs_mount_free(mp);
}
static struct file_system_type xfs_fs_type = {
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-07-20 14:08 ` [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits Christoph Hellwig
@ 2026-07-20 23:07 ` Damien Le Moal
2026-07-21 4:30 ` Christoph Hellwig
2026-07-21 9:24 ` Carlos Maiolino
2026-07-21 10:44 ` Carlos Maiolino
2 siblings, 1 reply; 13+ messages in thread
From: Damien Le Moal @ 2026-07-20 23:07 UTC (permalink / raw)
To: Christoph Hellwig, Carlos Maiolino
Cc: Jan Kara, Filip Blagojevic, Matthew Wilcox, linux-fsdevel,
linux-xfs
On 7/20/26 23:08, Christoph Hellwig wrote:
> When using XFS with a main device on an SSD that stores metadata and a RT
> device to store data on a HDD, we fail to take the I/O sizes for the RT
> device into accounting, leading to up to 5% slower read performance when
> using an SSD for metadata vs storing data and metadata on the HDD.
>
> Fix this up by taking the RT settings into account at mount an restoring
> the old settings at unmount time, unless the BDI settings have changed
> from those set by XFS.
>
> Reported-by: Filip Blagojevic <filip.blagojevic@wdc.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
[...]
> +/*
> + * When using a RT device some or all data I/O is using the RT device, but
> + * the BDI is inherited from the main data device. When the underlying block
> + * device for the RT device has larger I/O sizes, the BDI settings might be
> + * incorrect, which is especially bad if the main device is a SSD and the
> + * RT device is a HDD, as the io_opt fixup in blk_apply_bdi_limits is missing
> + * for this case.
> + *
> + * Update the BDI values to the max of the data and RT device to cover our
s/data/main ?
I am still confused about the proper name for the device holding metadata :)
Other than this, this looks OK to me.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-07-20 23:07 ` Damien Le Moal
@ 2026-07-21 4:30 ` Christoph Hellwig
2026-07-21 9:23 ` Carlos Maiolino
0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2026-07-21 4:30 UTC (permalink / raw)
To: Damien Le Moal
Cc: Christoph Hellwig, Carlos Maiolino, Jan Kara, Filip Blagojevic,
Matthew Wilcox, linux-fsdevel, linux-xfs
On Tue, Jul 21, 2026 at 08:07:40AM +0900, Damien Le Moal wrote:
> > + * Update the BDI values to the max of the data and RT device to cover our
>
> s/data/main ?
> I am still confused about the proper name for the device holding metadata :)
>
> Other than this, this looks OK to me.
Historically the main device is called the data device, which is
also reflected in all kinds of field naming. But yes, it is confusing
especially for zoned xfs setups. Maybe I should do a little global
naming sweep..
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-07-21 4:30 ` Christoph Hellwig
@ 2026-07-21 9:23 ` Carlos Maiolino
2026-07-21 15:18 ` Darrick J. Wong
0 siblings, 1 reply; 13+ messages in thread
From: Carlos Maiolino @ 2026-07-21 9:23 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Damien Le Moal, Jan Kara, Filip Blagojevic, Matthew Wilcox,
linux-fsdevel, linux-xfs
On Tue, Jul 21, 2026 at 06:30:11AM +0200, Christoph Hellwig wrote:
> On Tue, Jul 21, 2026 at 08:07:40AM +0900, Damien Le Moal wrote:
> > > + * Update the BDI values to the max of the data and RT device to cover our
> >
> > s/data/main ?
> > I am still confused about the proper name for the device holding metadata :)
> >
> > Other than this, this looks OK to me.
>
> Historically the main device is called the data device, which is
> also reflected in all kinds of field naming. But yes, it is confusing
> especially for zoned xfs setups. Maybe I should do a little global
> naming sweep..
>
>
+1, please keep /data/ here, this makes much more sense in xfs lingo...
Perhaps we should start naming them to something like ndata (for normal
data) and zdata for zoned data, but that's talk for another thread.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-07-20 14:08 ` [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits Christoph Hellwig
2026-07-20 23:07 ` Damien Le Moal
@ 2026-07-21 9:24 ` Carlos Maiolino
2026-07-21 10:44 ` Carlos Maiolino
2 siblings, 0 replies; 13+ messages in thread
From: Carlos Maiolino @ 2026-07-21 9:24 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jan Kara, Filip Blagojevic, Matthew Wilcox, Damien Le Moal,
linux-fsdevel, linux-xfs
On Mon, Jul 20, 2026 at 04:08:47PM +0200, Christoph Hellwig wrote:
> When using XFS with a main device on an SSD that stores metadata and a RT
> device to store data on a HDD, we fail to take the I/O sizes for the RT
> device into accounting, leading to up to 5% slower read performance when
> using an SSD for metadata vs storing data and metadata on the HDD.
>
> Fix this up by taking the RT settings into account at mount an restoring
> the old settings at unmount time, unless the BDI settings have changed
> from those set by XFS.
>
> Reported-by: Filip Blagojevic <filip.blagojevic@wdc.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
> fs/xfs/xfs_mount.h | 7 ++++++
> fs/xfs/xfs_super.c | 53 +++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 59 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index 66a02d1b9ad7..216a38a354e7 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -349,6 +349,13 @@ typedef struct xfs_mount {
>
> /* Index of uuid record in the uuid xarray. */
> unsigned int m_uuid_table_index;
> +
> + /*
> + * Old io_pages/ra_pages valued in the main bdev BDI, and our initial
> + * calculated values.
> + */
> + unsigned long m_old_io_pages, m_initial_io_pages;
> + unsigned long m_old_ra_pages, m_initial_ra_pages;
> } xfs_mount_t;
>
> #define M_IGEO(mp) (&(mp)->m_ino_geo)
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 8531d526fc44..63c4bcbe6c2b 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -548,6 +548,52 @@ xfs_open_devices(
> return error;
> }
>
> +/*
> + * When using a RT device some or all data I/O is using the RT device, but
> + * the BDI is inherited from the main data device. When the underlying block
> + * device for the RT device has larger I/O sizes, the BDI settings might be
> + * incorrect, which is especially bad if the main device is a SSD and the
> + * RT device is a HDD, as the io_opt fixup in blk_apply_bdi_limits is missing
> + * for this case.
> + *
> + * Update the BDI values to the max of the data and RT device to cover our
> + * bases.
> + */
> +static void
> +xfs_update_bdi_rahead(
> + struct xfs_mount *mp)
> +{
> + struct backing_dev_info *rt_bdi =
> + mp->m_rtdev_targp->bt_bdev->bd_disk->bdi;
> + struct backing_dev_info *sb_bdi = mp->m_super->s_bdi;
> +
> + mp->m_old_io_pages = sb_bdi->io_pages;
> + mp->m_old_ra_pages = sb_bdi->ra_pages;
> +
> + sb_bdi->io_pages = mp->m_initial_io_pages =
> + max(sb_bdi->io_pages, rt_bdi->io_pages);
> + sb_bdi->ra_pages = mp->m_initial_ra_pages =
> + max(sb_bdi->ra_pages, rt_bdi->ra_pages);
> +}
> +
> +static void
> +xfs_restore_bdi_rahead(
> + struct xfs_mount *mp)
> +{
> + struct backing_dev_info *sb_bdi = mp->m_super->s_bdi;
> +
> + if (sb_bdi->io_pages == mp->m_initial_io_pages)
> + sb_bdi->io_pages = mp->m_old_io_pages;
> + else
> + xfs_info(mp, "io_pages changed from %lu to %lu, not restoring.",
> + mp->m_initial_io_pages, sb_bdi->io_pages);
> + if (sb_bdi->ra_pages == mp->m_initial_ra_pages)
> + sb_bdi->ra_pages = mp->m_old_ra_pages;
> + else
> + xfs_info(mp, "ra_pages changed from %lu to %lu, not restoring.",
> + mp->m_initial_ra_pages, sb_bdi->ra_pages);
> +}
> +
> /*
> * Setup xfs_mount buffer target pointers based on superblock
> */
> @@ -585,6 +631,7 @@ xfs_setup_devices(
> mp->m_sb.sb_sectsize, mp->m_sb.sb_rblocks);
> if (error)
> return error;
> + xfs_update_bdi_rahead(mp);
> }
>
> return 0;
> @@ -2283,8 +2330,12 @@ static void
> xfs_kill_sb(
> struct super_block *sb)
> {
> + struct xfs_mount *mp = XFS_M(sb);
> +
> + if (mp->m_rtdev_targp && mp->m_rtdev_targp != mp->m_ddev_targp)
> + xfs_restore_bdi_rahead(mp);
> kill_block_super(sb);
> - xfs_mount_free(XFS_M(sb));
> + xfs_mount_free(mp);
> }
>
> static struct file_system_type xfs_fs_type = {
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-07-20 14:08 ` [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits Christoph Hellwig
2026-07-20 23:07 ` Damien Le Moal
2026-07-21 9:24 ` Carlos Maiolino
@ 2026-07-21 10:44 ` Carlos Maiolino
2 siblings, 0 replies; 13+ messages in thread
From: Carlos Maiolino @ 2026-07-21 10:44 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jan Kara, Filip Blagojevic, Matthew Wilcox, Damien Le Moal,
linux-fsdevel, linux-xfs
On Mon, 20 Jul 2026 16:08:47 +0200, Christoph Hellwig wrote:
> When using XFS with a main device on an SSD that stores metadata and a RT
> device to store data on a HDD, we fail to take the I/O sizes for the RT
> device into accounting, leading to up to 5% slower read performance when
> using an SSD for metadata vs storing data and metadata on the HDD.
>
> Fix this up by taking the RT settings into account at mount an restoring
> the old settings at unmount time, unless the BDI settings have changed
> from those set by XFS.
>
> [...]
Applied to for-next, thanks!
[1/1] xfs: update BDI {io,ra}_pages values based on the RT device limits
commit: 39de8c9f3e4bc059bb0bc85a39affcf52664c1ed
Best regards,
--
Carlos Maiolino <cem@kernel.org>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits
2026-07-21 9:23 ` Carlos Maiolino
@ 2026-07-21 15:18 ` Darrick J. Wong
0 siblings, 0 replies; 13+ messages in thread
From: Darrick J. Wong @ 2026-07-21 15:18 UTC (permalink / raw)
To: Carlos Maiolino
Cc: Christoph Hellwig, Damien Le Moal, Jan Kara, Filip Blagojevic,
Matthew Wilcox, linux-fsdevel, linux-xfs
On Tue, Jul 21, 2026 at 11:23:29AM +0200, Carlos Maiolino wrote:
> On Tue, Jul 21, 2026 at 06:30:11AM +0200, Christoph Hellwig wrote:
> > On Tue, Jul 21, 2026 at 08:07:40AM +0900, Damien Le Moal wrote:
> > > > + * Update the BDI values to the max of the data and RT device to cover our
> > >
> > > s/data/main ?
> > > I am still confused about the proper name for the device holding metadata :)
> > >
> > > Other than this, this looks OK to me.
> >
> > Historically the main device is called the data device, which is
> > also reflected in all kinds of field naming. But yes, it is confusing
> > especially for zoned xfs setups. Maybe I should do a little global
> > naming sweep..
> >
> >
>
> +1, please keep /data/ here, this makes much more sense in xfs lingo...
> Perhaps we should start naming them to something like ndata (for normal
> data) and zdata for zoned data, but that's talk for another thread.
I've been trying to be consistent at calling them the 'datadev' and
'rtdev' (no spaces) so it's more obvious that I'm using a jargon. But
'rt' makes no sense these days and I never did come up with a good
retcon for it though.
"RelaTive"? Because the rtdev is "related" to the datadev by metadata?
:D
--D
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-07-21 15:18 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 14:08 update BDI {io,ra}_pages values based on the RT device limits v2 Christoph Hellwig
2026-07-20 14:08 ` [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits Christoph Hellwig
2026-07-20 23:07 ` Damien Le Moal
2026-07-21 4:30 ` Christoph Hellwig
2026-07-21 9:23 ` Carlos Maiolino
2026-07-21 15:18 ` Darrick J. Wong
2026-07-21 9:24 ` Carlos Maiolino
2026-07-21 10:44 ` Carlos Maiolino
-- strict thread matches above, loose matches on Subject: below --
2026-06-23 14:21 Christoph Hellwig
2026-06-23 14:21 ` [PATCH] xfs: " Christoph Hellwig
2026-07-02 22:25 ` Damien Le Moal
2026-07-20 9:02 ` Carlos Maiolino
2026-07-20 9:11 ` Christoph Hellwig
2026-07-20 9:38 ` Carlos Maiolino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox