Re: [PATCH v4 6/6] xfs: introduce software write streams

Christoph Hellwig <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,org.kernel.vger.linux-block,org.kernel.vger.linux-fsdevel
Message-ID <[email protected]>
On Fri, Jul 17, 2026 at 06:25:38PM +0530, Kanchan Joshi wrote:
> Even when the underlying block device does not advertise write streams,
> XFS can choose do so, as that enables logical spatial isolation and
> dynamic AG-set based concurrency for the standard storage, excluding
> rtvolume.

Ok, this gets back to my previous point.  Pleadse just ignore the
hardware write streams in the initial patch, and then add the aligning
to hardware write streams later.

> +	nr_streams = bdev_max_write_streams(bdev);
> +	if (nr_streams > 0)
> +		return nr_streams;
> +	/*
> +	 * Enable software-only streams if hardware streams are not available.
> +	 * This helps to
> +	 * - improve isolation; reduce allocation interleaving.
> +	 * - improve concurrency using AG-set based steering within and across streams.

Overly long line.

> +	 */
> +	nr_ags = mp->m_sb.sb_agcount;
> +	if (nr_ags >= 16)
> +		ag_set_size = 4;
> +	else if (nr_ags >= 8)
> +		ag_set_size = 2;
> +	else
> +		ag_set_size = 1;
> +	nr_streams = nr_ags / ag_set_size;
> +	return min_t(uint16_t, nr_streams, XFS_SW_WRITE_STREAMS_MAX);

.. and this value should be cached somewhere.

>  	nr_streams = bdev_max_write_streams(mp->m_ddev_targp->bt_bdev);
> -	if (nr_streams) {
> -		mp->m_streams_in_use = bitmap_zalloc(nr_streams, GFP_KERNEL);
> -		if (!mp->m_streams_in_use) {
> -			error = -ENOMEM;
> -			goto out_shutdown_devices;
> -		}
> +	if (!nr_streams)
> +		nr_streams = XFS_SW_WRITE_STREAMS_MAX;
> +	mp->m_streams_in_use = bitmap_zalloc(nr_streams, GFP_KERNEL);
> +	if (!mp->m_streams_in_use) {
> +		error = -ENOMEM;
> +		goto out_shutdown_devices;
>  	}

and also be used here?

While we're at it, the stream allocator should probably go into
the buftarg to prepare for also adding it for the RT volume.
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.