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@fb.com>,
	linux-block@vger.kernel.org, axboe@kernel.dk,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH 1/3] block: export dma_alignment attribute
Date: Wed, 18 May 2022 00:23:48 -0700	[thread overview]
Message-ID: <YoSfBA6cKV1WsZah@infradead.org> (raw)
In-Reply-To: <YoQn2KkI/nwnUmIG@kbusch-mbp.dhcp.thefacebook.com>

On Tue, May 17, 2022 at 04:55:20PM -0600, Keith Busch wrote:
> A little less easy than I thought... This is what I'm coming up with, and it's
> bad enough that I'm sure there has to be a better way. Specifically concerning
> is the new "do_dma()" function below, and was the only way I managed to get the
> correct 'struct block_device' whether we're stat'ing a filesystem file or raw
> block device file.

I don't think doing this in common code makes much sense.  The core
VFS code should not have to know if something is on a block device or
not.

Instead add a new getattr method to block/bdev.c for the block devices,
and just have a helper to set the alinments(s) based on that by it,
and any file systems that is made ready to accept lower alignment.
And I'd prefer to do them individully and tested as there might be all
kinds of assumptions.  For all other instances keep the value as 0
for unknown.

> --- a/include/uapi/linux/stat.h
> +++ b/include/uapi/linux/stat.h
> @@ -106,7 +106,7 @@ struct statx {
>  	__u32	stx_uid;	/* User ID of owner */
>  	__u32	stx_gid;	/* Group ID of owner */
>  	__u16	stx_mode;	/* File mode */
> -	__u16	__spare0[1];
> +	__u16	stx_dma;	/* DMA alignment */

I'd name this dio_mem_alignment, because it is is:

 a) specific to direct I/O
 b) DMA is just the implementation detail, but not the user semantics

while we're at it, please also add a dio_file_alignment for the
alignment in the file, which can be sector or fs block size.  I'm
perfectly fine if you only do it for the block layer first, I'll
take up the wok to update the most common file systems after that.

      reply	other threads:[~2022-05-18  7:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 16:13 [PATCH 1/3] block: export dma_alignment attribute Keith Busch
2022-05-13 16:13 ` [PATCH 2/3] block: relax direct io memory alignment Keith Busch
2022-05-13 16:13 ` [PATCH 3/3] block: ensure direct io is a block size Keith Busch
2022-05-14  2:26   ` Bart Van Assche
2022-05-16 10:13   ` Damien Le Moal
2022-05-16 14:01     ` Keith Busch
2022-05-16  6:52 ` [PATCH 1/3] block: export dma_alignment attribute Christoph Hellwig
2022-05-16 14:32   ` Keith Busch
2022-05-17 22:55     ` Keith Busch
2022-05-18  7:23       ` Christoph Hellwig [this message]

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=YoSfBA6cKV1WsZah@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=kbusch@fb.com \
    --cc=kbusch@kernel.org \
    --cc=kernel-team@fb.com \
    --cc=linux-block@vger.kernel.org \
    /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