public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Keith Busch <kbusch@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Keith Busch <kbusch@meta.com>,
	linux-block@vger.kernel.org, shinichiro.kawasaki@wdc.com
Subject: Re: [PATCH blktests] create a test for direct io offsets
Date: Tue, 21 Oct 2025 21:46:30 -0700	[thread overview]
Message-ID: <aPhhpohu8mc95oLp@infradead.org> (raw)
In-Reply-To: <aPf5gAOlnJtVUV6E@kbusch-mbp>

On Tue, Oct 21, 2025 at 03:22:08PM -0600, Keith Busch wrote:
> On Mon, Oct 20, 2025 at 10:28:09PM -0700, Christoph Hellwig wrote:
> > seems like a huge win.  Any chance you could try to get this done ASAP
> > so that we could make the interface fully discoverable before 6.18 is
> > released?
> 
> I just want to make sure I am aligned to what you have in mind. Is this
> something like this what you're looking for? This reports the kernel's
> ability to handle a dio with memory that is discontiguous for a single
> device "sector", and reports the virtual gap requirements.

So, I think Christian really did not want more random stuff in statx,
which would lead to using fsxattr instead.

Question:  Should we event advertize virt_boundary based unaligned
segment support?  It is almost impossible to use correctly unless I'm
missing something, so the better idea might be to just not offer the
value when using PRPs?

> +	if (request_mask & STATX_DIO_VIRT_SPLIT) {
> +		stat->dio_virt_boundary_mask = queue_virt_boundary(
> +								bdev->bd_queue);

Consumer code like file systems, or the bdev fake file system should
never see the queue (and yes, I realize the atomic code just below got
this wrong as well).  Please either add a bdev_virt_boundary wrapper,
or use bdev_limit and just access the limits directly.

> +	if (bdev_max_segments(bdev) > 1)
> +		stat->attributes |= STATX_ATTR_DIO_VEC_SPLIT;
> +	stat->attributes_mask |= STATX_ATTR_DIO_VEC_SPLIT;

> +	if (request_mask & STATX_DIO_VIRT_SPLIT) {
> +		struct block_device *bdev = inode->i_sb->s_bdev;
> +
> +		stat->dio_virt_boundary_mask = queue_virt_boundary(bdev->bd_queue);
> +		stat->result_mask |= STATX_DIO_VIRT_SPLIT;
> +	}

> +static void
> +xfs_report_dio_split(
> +	struct xfs_inode	*ip,
> +	struct kstat		*stat)
> +{
> +	struct xfs_buftarg	*target = xfs_inode_buftarg(ip);
> +	struct block_device	*bdev = target->bt_bdev;
> +
> +	stat->dio_virt_boundary_mask = queue_virt_boundary(bdev->bd_queue);
> +	stat->result_mask |= STATX_DIO_VIRT_SPLIT;
> +}
> +

Why does the bdev set different flags from the file system?  Shouldn't
the capabilities be the same?  And we'll probably want a little helper
to set these based on the bdev instead of opencoding the logic in
multiple places.


  reply	other threads:[~2025-10-22  4:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 20:54 [PATCH blktests] create a test for direct io offsets Keith Busch
2025-10-14 21:21 ` Bart Van Assche
2025-10-14 21:59   ` Keith Busch
2025-10-17 11:13 ` Christoph Hellwig
2025-10-20 16:20   ` Keith Busch
2025-10-21  5:28     ` Christoph Hellwig
2025-10-21 21:22       ` Keith Busch
2025-10-22  4:46         ` Christoph Hellwig [this message]
2025-11-17 21:53           ` Keith Busch
2025-11-18  5:54             ` Christoph Hellwig
2025-10-20 12:40 ` Shinichiro Kawasaki
2025-10-20 21:03   ` Keith Busch
2025-10-21  1:32     ` Shinichiro Kawasaki
2025-10-20 23:25 ` Chaitanya Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aPhhpohu8mc95oLp@infradead.org \
    --to=hch@infradead.org \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox