Re: [PATCH] xfs: update BDI {io,ra}_pages values based on the RT device limits

Carlos Maiolino <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,org.kernel.vger.linux-fsdevel
Message-ID <[email protected]>
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 <[email protected]>
> Signed-off-by: Christoph Hellwig <[email protected]>
> ---
>  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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.