From: Christian Brauner <firstname.lastname@example.org>
To: Eric Biggers <email@example.com>
Cc: firstname.lastname@example.org, email@example.com,
firstname.lastname@example.org, Keith Busch <email@example.com>,
Christoph Hellwig <firstname.lastname@example.org>,
"Darrick J. Wong" <email@example.com>,
"Martin K. Petersen" <firstname.lastname@example.org>
Subject: Re: [PATCH v5 1/8] statx: add direct I/O alignment information
Date: Wed, 7 Sep 2022 11:10:02 +0200 [thread overview]
Message-ID: <20220907091002.6ay72r4tgk5g6rma@wittgenstein> (raw)
On Fri, Aug 26, 2022 at 11:58:44PM -0700, Eric Biggers wrote:
> From: Eric Biggers <email@example.com>
> Traditionally, the conditions for when DIO (direct I/O) is supported
> were fairly simple. For both block devices and regular files, DIO had
> to be aligned to the logical block size of the block device.
> However, due to filesystem features that have been added over time (e.g.
> multi-device support, data journalling, inline data, encryption, verity,
> compression, checkpoint disabling, log-structured mode), the conditions
> for when DIO is allowed on a regular file have gotten increasingly
> complex. Whether a particular regular file supports DIO, and with what
> alignment, can depend on various file attributes and filesystem mount
> options, as well as which block device(s) the file's data is located on.
> Moreover, the general rule of DIO needing to be aligned to the block
> device's logical block size was recently relaxed to allow user buffers
> (but not file offsets) aligned to the DMA alignment instead. See
> commit bf8d08532bc1 ("iomap: add support for dma aligned direct-io").
> XFS has an ioctl XFS_IOC_DIOINFO that exposes DIO alignment information.
> Uplifting this to the VFS is one possibility. However, as discussed
> this ioctl is rarely used and not known to be used outside of
> XFS-specific code. It was also never intended to indicate when a file
> doesn't support DIO at all, nor was it intended for block devices.
> Therefore, let's expose this information via statx(). Add the
> STATX_DIOALIGN flag and two new statx fields associated with it:
> * stx_dio_mem_align: the alignment (in bytes) required for user memory
> buffers for DIO, or 0 if DIO is not supported on the file.
> * stx_dio_offset_align: the alignment (in bytes) required for file
> offsets and I/O segment lengths for DIO, or 0 if DIO is not supported
> on the file. This will only be nonzero if stx_dio_mem_align is
> nonzero, and vice versa.
> Note that as with other statx() extensions, if STATX_DIOALIGN isn't set
> in the returned statx struct, then these new fields won't be filled in.
> This will happen if the file is neither a regular file nor a block
> device, or if the file is a regular file and the filesystem doesn't
> support STATX_DIOALIGN. It might also happen if the caller didn't
> include STATX_DIOALIGN in the request mask, since statx() isn't required
> to return unrequested information.
> This commit only adds the VFS-level plumbing for STATX_DIOALIGN. For
> regular files, individual filesystems will still need to add code to
> support it. For block devices, a separate commit will wire it up too.
> Reviewed-by: Christoph Hellwig <firstname.lastname@example.org>
> Reviewed-by: Darrick J. Wong <email@example.com>
> Reviewed-by: Martin K. Petersen <firstname.lastname@example.org>
> Signed-off-by: Eric Biggers <email@example.com>
Looks good to me,
Reviewed-by: Christian Brauner (Microsoft) <firstname.lastname@example.org>
next prev parent reply other threads:[~2022-09-07 9:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-27 6:58 [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
2022-08-27 6:58 ` [PATCH v5 1/8] statx: add direct I/O " Eric Biggers
2022-09-07 9:10 ` Christian Brauner [this message]
2022-08-27 6:58 ` [PATCH v5 2/8] vfs: support STATX_DIOALIGN on block devices Eric Biggers
2022-09-06 8:10 ` Christoph Hellwig
2022-09-07 9:09 ` Christian Brauner
2022-08-27 6:58 ` [PATCH v5 3/8] fscrypt: change fscrypt_dio_supported() to prepare for STATX_DIOALIGN Eric Biggers
2022-08-27 6:58 ` [PATCH v5 4/8] ext4: support STATX_DIOALIGN Eric Biggers
2022-08-27 6:58 ` [PATCH v5 5/8] f2fs: move f2fs_force_buffered_io() into file.c Eric Biggers
2022-08-29 17:37 ` Jaegeuk Kim
2022-08-27 6:58 ` [PATCH v5 6/8] f2fs: simplify f2fs_force_buffered_io() Eric Biggers
2022-08-29 17:36 ` Jaegeuk Kim
2022-08-27 6:58 ` [PATCH v5 7/8] f2fs: support STATX_DIOALIGN Eric Biggers
2022-08-29 17:43 ` Jaegeuk Kim
2022-08-27 6:58 ` [PATCH v5 8/8] xfs: " Eric Biggers
2022-08-27 15:34 ` Darrick J. Wong
2022-09-06 8:11 ` Christoph Hellwig
2022-09-06 22:08 ` [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
2022-09-12 0:54 ` Eric Biggers
2022-09-12 20:30 ` Stephen Rothwell
2022-10-18 4:55 ` Stephen Rothwell
2022-10-18 7:07 ` Eric Biggers
2022-10-18 20:08 ` Stephen Rothwell
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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;
as well as URLs for NNTP newsgroup(s).