linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/8] make statx() return DIO alignment information
@ 2022-08-27  6:58 Eric Biggers
  2022-08-27  6:58 ` [PATCH v5 1/8] statx: add direct I/O " Eric Biggers
                   ` (8 more replies)
  0 siblings, 9 replies; 23+ messages in thread
From: Eric Biggers @ 2022-08-27  6:58 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, linux-f2fs-devel, linux-xfs, linux-api,
	linux-fscrypt, linux-block, linux-kernel, Keith Busch

This patchset makes the statx() system call return direct I/O (DIO)
alignment information.  This allows userspace to easily determine
whether a file supports DIO, and if so with what alignment restrictions.

Patch 1 adds the basic VFS support for STATX_DIOALIGN.  Patch 2 wires it
up for all block device files.  The remaining patches wire it up for
regular files on ext4, f2fs, and xfs.  Support for regular files on
other filesystems can be added later.

I've also written a man-pages patch, which I sent separately:
https://lore.kernel.org/r/20220722074229.148925-1-ebiggers@kernel.org

Note, f2fs has a corner case where DIO reads are allowed but not DIO
writes.  The proposed statx fields can't represent this.  The current
proposal just reports that DIO is unsupported in this case.

This patchset applies to v6.0-rc2.

Changed in v5:
   - Accounted for the DIO changes in 6.0 by setting dio_mem_align to
     the DMA alignment instead of the logical block size where needed.

   - Dropped the patch "f2fs: don't allow DIO reads but not DIO writes".

   - Added some Reviewed-by and Acked-by tags.

Changed in v4:
   - Added xfs support.

   - Moved the helper function for block devices into block/bdev.c.
   
   - Adjusted the ext4 patch to not introduce a bug where misaligned DIO
     starts being allowed on encrypted files when it gets combined with
     the patch "iomap: add support for dma aligned direct-io" that is
     queued in the block tree for 5.20.

   - Made a simplification in fscrypt_dio_supported().

Changed in v3:
   - Dropped the stx_offset_align_optimal field, since its purpose
     wasn't clearly distinguished from the existing stx_blksize.

   - Renamed STATX_IOALIGN to STATX_DIOALIGN, to reflect the new focus
     on DIO only.

   - Similarly, renamed stx_{mem,offset}_align_dio to
     stx_dio_{mem,offset}_align, to reflect the new focus on DIO only.

   - Wired up STATX_DIOALIGN on block device files.

Changed in v2:
   - No changes.

Eric Biggers (8):
  statx: add direct I/O alignment information
  vfs: support STATX_DIOALIGN on block devices
  fscrypt: change fscrypt_dio_supported() to prepare for STATX_DIOALIGN
  ext4: support STATX_DIOALIGN
  f2fs: move f2fs_force_buffered_io() into file.c
  f2fs: simplify f2fs_force_buffered_io()
  f2fs: support STATX_DIOALIGN
  xfs: support STATX_DIOALIGN

 block/bdev.c              | 23 ++++++++++++++++++
 fs/crypto/inline_crypt.c  | 49 +++++++++++++++++++--------------------
 fs/ext4/ext4.h            |  1 +
 fs/ext4/file.c            | 37 ++++++++++++++++++++---------
 fs/ext4/inode.c           | 37 +++++++++++++++++++++++++++++
 fs/f2fs/f2fs.h            | 40 --------------------------------
 fs/f2fs/file.c            | 43 +++++++++++++++++++++++++++++++++-
 fs/stat.c                 | 14 +++++++++++
 fs/xfs/xfs_iops.c         | 10 ++++++++
 include/linux/blkdev.h    |  4 ++++
 include/linux/fscrypt.h   |  7 ++----
 include/linux/stat.h      |  2 ++
 include/uapi/linux/stat.h |  4 +++-
 13 files changed, 188 insertions(+), 83 deletions(-)


base-commit: 1c23f9e627a7b412978b4e852793c5e3c3efc555
-- 
2.37.2


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v5 1/8] statx: add direct I/O alignment information
  2022-08-27  6:58 [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
@ 2022-08-27  6:58 ` Eric Biggers
  2022-09-07  9:10   ` Christian Brauner
  2022-08-27  6:58 ` [PATCH v5 2/8] vfs: support STATX_DIOALIGN on block devices Eric Biggers
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Eric Biggers @ 2022-08-27  6:58 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, linux-f2fs-devel, linux-xfs, linux-api,
	linux-fscrypt, linux-block, linux-kernel, Keith Busch,
	Christoph Hellwig, Darrick J. Wong, Martin K. Petersen

From: Eric Biggers <ebiggers@google.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
(https://lore.kernel.org/linux-fsdevel/20220120071215.123274-1-ebiggers@kernel.org/T/#u),
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 <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/stat.c                 | 2 ++
 include/linux/stat.h      | 2 ++
 include/uapi/linux/stat.h | 4 +++-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/stat.c b/fs/stat.c
index 9ced8860e0f35d..a7930d74448304 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -611,6 +611,8 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer)
 	tmp.stx_dev_major = MAJOR(stat->dev);
 	tmp.stx_dev_minor = MINOR(stat->dev);
 	tmp.stx_mnt_id = stat->mnt_id;
+	tmp.stx_dio_mem_align = stat->dio_mem_align;
+	tmp.stx_dio_offset_align = stat->dio_offset_align;
 
 	return copy_to_user(buffer, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 7df06931f25d85..ff277ced50e9fd 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -50,6 +50,8 @@ struct kstat {
 	struct timespec64 btime;			/* File creation time */
 	u64		blocks;
 	u64		mnt_id;
+	u32		dio_mem_align;
+	u32		dio_offset_align;
 };
 
 #endif
diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h
index 1500a0f58041ae..7cab2c65d3d7fc 100644
--- a/include/uapi/linux/stat.h
+++ b/include/uapi/linux/stat.h
@@ -124,7 +124,8 @@ struct statx {
 	__u32	stx_dev_minor;
 	/* 0x90 */
 	__u64	stx_mnt_id;
-	__u64	__spare2;
+	__u32	stx_dio_mem_align;	/* Memory buffer alignment for direct I/O */
+	__u32	stx_dio_offset_align;	/* File offset alignment for direct I/O */
 	/* 0xa0 */
 	__u64	__spare3[12];	/* Spare space for future expansion */
 	/* 0x100 */
@@ -152,6 +153,7 @@ struct statx {
 #define STATX_BASIC_STATS	0x000007ffU	/* The stuff in the normal stat struct */
 #define STATX_BTIME		0x00000800U	/* Want/got stx_btime */
 #define STATX_MNT_ID		0x00001000U	/* Got stx_mnt_id */
+#define STATX_DIOALIGN		0x00002000U	/* Want/got direct I/O alignment info */
 
 #define STATX__RESERVED		0x80000000U	/* Reserved for future struct statx expansion */
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 2/8] vfs: support STATX_DIOALIGN on block devices
  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-08-27  6:58 ` 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
                   ` (6 subsequent siblings)
  8 siblings, 2 replies; 23+ messages in thread
From: Eric Biggers @ 2022-08-27  6:58 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, linux-f2fs-devel, linux-xfs, linux-api,
	linux-fscrypt, linux-block, linux-kernel, Keith Busch

From: Eric Biggers <ebiggers@google.com>

Add support for STATX_DIOALIGN to block devices, so that direct I/O
alignment restrictions are exposed to userspace in a generic way.

Note that this breaks the tradition of stat operating only on the block
device node, not the block device itself.  However, it was felt that
doing this is preferable, in order to make the interface useful and
avoid needing separate interfaces for regular files and block devices.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 block/bdev.c           | 23 +++++++++++++++++++++++
 fs/stat.c              | 12 ++++++++++++
 include/linux/blkdev.h |  4 ++++
 3 files changed, 39 insertions(+)

diff --git a/block/bdev.c b/block/bdev.c
index ce05175e71cea4..d699ecdb32604e 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -26,6 +26,7 @@
 #include <linux/namei.h>
 #include <linux/part_stat.h>
 #include <linux/uaccess.h>
+#include <linux/stat.h>
 #include "../fs/internal.h"
 #include "blk.h"
 
@@ -1069,3 +1070,25 @@ void sync_bdevs(bool wait)
 	spin_unlock(&blockdev_superblock->s_inode_list_lock);
 	iput(old_inode);
 }
+
+/*
+ * Handle STATX_DIOALIGN for block devices.
+ *
+ * Note that the inode passed to this is the inode of a block device node file,
+ * not the block device's internal inode.  Therefore it is *not* valid to use
+ * I_BDEV() here; the block device has to be looked up by i_rdev instead.
+ */
+void bdev_statx_dioalign(struct inode *inode, struct kstat *stat)
+{
+	struct block_device *bdev;
+
+	bdev = blkdev_get_no_open(inode->i_rdev);
+	if (!bdev)
+		return;
+
+	stat->dio_mem_align = bdev_dma_alignment(bdev) + 1;
+	stat->dio_offset_align = bdev_logical_block_size(bdev);
+	stat->result_mask |= STATX_DIOALIGN;
+
+	blkdev_put_no_open(bdev);
+}
diff --git a/fs/stat.c b/fs/stat.c
index a7930d74448304..ef50573c72a269 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -5,6 +5,7 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
+#include <linux/blkdev.h>
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
@@ -230,11 +231,22 @@ static int vfs_statx(int dfd, struct filename *filename, int flags,
 		goto out;
 
 	error = vfs_getattr(&path, stat, request_mask, flags);
+
 	stat->mnt_id = real_mount(path.mnt)->mnt_id;
 	stat->result_mask |= STATX_MNT_ID;
+
 	if (path.mnt->mnt_root == path.dentry)
 		stat->attributes |= STATX_ATTR_MOUNT_ROOT;
 	stat->attributes_mask |= STATX_ATTR_MOUNT_ROOT;
+
+	/* Handle STATX_DIOALIGN for block devices. */
+	if (request_mask & STATX_DIOALIGN) {
+		struct inode *inode = d_backing_inode(path.dentry);
+
+		if (S_ISBLK(inode->i_mode))
+			bdev_statx_dioalign(inode, stat);
+	}
+
 	path_put(&path);
 	if (retry_estale(error, lookup_flags)) {
 		lookup_flags |= LOOKUP_REVAL;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 84b13fdd34a716..8038c5fbde4099 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1498,6 +1498,7 @@ int sync_blockdev(struct block_device *bdev);
 int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend);
 int sync_blockdev_nowait(struct block_device *bdev);
 void sync_bdevs(bool wait);
+void bdev_statx_dioalign(struct inode *inode, struct kstat *stat);
 void printk_all_partitions(void);
 #else
 static inline void invalidate_bdev(struct block_device *bdev)
@@ -1514,6 +1515,9 @@ static inline int sync_blockdev_nowait(struct block_device *bdev)
 static inline void sync_bdevs(bool wait)
 {
 }
+static inline void bdev_statx_dioalign(struct inode *inode, struct kstat *stat)
+{
+}
 static inline void printk_all_partitions(void)
 {
 }
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 3/8] fscrypt: change fscrypt_dio_supported() to prepare for STATX_DIOALIGN
  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-08-27  6:58 ` [PATCH v5 2/8] vfs: support STATX_DIOALIGN on block devices Eric Biggers
@ 2022-08-27  6:58 ` Eric Biggers
  2022-08-27  6:58 ` [PATCH v5 4/8] ext4: support STATX_DIOALIGN Eric Biggers
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 23+ messages in thread
From: Eric Biggers @ 2022-08-27  6:58 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, linux-f2fs-devel, linux-xfs, linux-api,
	linux-fscrypt, linux-block, linux-kernel, Keith Busch,
	Christoph Hellwig

From: Eric Biggers <ebiggers@google.com>

To prepare for STATX_DIOALIGN support, make two changes to
fscrypt_dio_supported().

First, remove the filesystem-block-alignment check and make the
filesystems handle it instead.  It previously made sense to have it in
fs/crypto/; however, to support STATX_DIOALIGN the alignment restriction
would have to be returned to filesystems.  It ends up being simpler if
filesystems handle this part themselves, especially for f2fs which only
allows fs-block-aligned DIO in the first place.

Second, make fscrypt_dio_supported() work on inodes whose encryption key
hasn't been set up yet, by making it set up the key if needed.  This is
required for statx(), since statx() doesn't require a file descriptor.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/crypto/inline_crypt.c | 49 ++++++++++++++++++++--------------------
 fs/ext4/file.c           |  9 ++++++--
 fs/f2fs/f2fs.h           |  2 +-
 include/linux/fscrypt.h  |  7 ++----
 4 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/fs/crypto/inline_crypt.c b/fs/crypto/inline_crypt.c
index 90f3e68f166e39..8d4bee5bccbf42 100644
--- a/fs/crypto/inline_crypt.c
+++ b/fs/crypto/inline_crypt.c
@@ -401,46 +401,45 @@ bool fscrypt_mergeable_bio_bh(struct bio *bio,
 EXPORT_SYMBOL_GPL(fscrypt_mergeable_bio_bh);
 
 /**
- * fscrypt_dio_supported() - check whether a DIO (direct I/O) request is
- *			     supported as far as encryption is concerned
- * @iocb: the file and position the I/O is targeting
- * @iter: the I/O data segment(s)
+ * fscrypt_dio_supported() - check whether DIO (direct I/O) is supported on an
+ *			     inode, as far as encryption is concerned
+ * @inode: the inode in question
  *
  * Return: %true if there are no encryption constraints that prevent DIO from
  *	   being supported; %false if DIO is unsupported.  (Note that in the
  *	   %true case, the filesystem might have other, non-encryption-related
- *	   constraints that prevent DIO from actually being supported.)
+ *	   constraints that prevent DIO from actually being supported.  Also, on
+ *	   encrypted files the filesystem is still responsible for only allowing
+ *	   DIO when requests are filesystem-block-aligned.)
  */
-bool fscrypt_dio_supported(struct kiocb *iocb, struct iov_iter *iter)
+bool fscrypt_dio_supported(struct inode *inode)
 {
-	const struct inode *inode = file_inode(iocb->ki_filp);
-	const unsigned int blocksize = i_blocksize(inode);
+	int err;
 
 	/* If the file is unencrypted, no veto from us. */
 	if (!fscrypt_needs_contents_encryption(inode))
 		return true;
 
-	/* We only support DIO with inline crypto, not fs-layer crypto. */
-	if (!fscrypt_inode_uses_inline_crypto(inode))
-		return false;
-
 	/*
-	 * Since the granularity of encryption is filesystem blocks, the file
-	 * position and total I/O length must be aligned to the filesystem block
-	 * size -- not just to the block device's logical block size as is
-	 * traditionally the case for DIO on many filesystems.
+	 * We only support DIO with inline crypto, not fs-layer crypto.
 	 *
-	 * We require that the user-provided memory buffers be filesystem block
-	 * aligned too.  It is simpler to have a single alignment value required
-	 * for all properties of the I/O, as is normally the case for DIO.
-	 * Also, allowing less aligned buffers would imply that data units could
-	 * cross bvecs, which would greatly complicate the I/O stack, which
-	 * assumes that bios can be split at any bvec boundary.
+	 * To determine whether the inode is using inline crypto, we have to set
+	 * up the key if it wasn't already done.  This is because in the current
+	 * design of fscrypt, the decision of whether to use inline crypto or
+	 * not isn't made until the inode's encryption key is being set up.  In
+	 * the DIO read/write case, the key will always be set up already, since
+	 * the file will be open.  But in the case of statx(), the key might not
+	 * be set up yet, as the file might not have been opened yet.
 	 */
-	if (!IS_ALIGNED(iocb->ki_pos | iov_iter_alignment(iter), blocksize))
+	err = fscrypt_require_key(inode);
+	if (err) {
+		/*
+		 * Key unavailable or couldn't be set up.  This edge case isn't
+		 * worth worrying about; just report that DIO is unsupported.
+		 */
 		return false;
-
-	return true;
+	}
+	return fscrypt_inode_uses_inline_crypto(inode);
 }
 EXPORT_SYMBOL_GPL(fscrypt_dio_supported);
 
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 109d07629f81fb..26d7426208970d 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -40,8 +40,13 @@ static bool ext4_dio_supported(struct kiocb *iocb, struct iov_iter *iter)
 {
 	struct inode *inode = file_inode(iocb->ki_filp);
 
-	if (!fscrypt_dio_supported(iocb, iter))
-		return false;
+	if (IS_ENCRYPTED(inode)) {
+		if (!fscrypt_dio_supported(inode))
+			return false;
+		if (!IS_ALIGNED(iocb->ki_pos | iov_iter_alignment(iter),
+				i_blocksize(inode)))
+			return false;
+	}
 	if (fsverity_active(inode))
 		return false;
 	if (ext4_should_journal_data(inode))
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 3c7cdb70fe2efc..0759da1919f4ad 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -4498,7 +4498,7 @@ static inline bool f2fs_force_buffered_io(struct inode *inode,
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 	int rw = iov_iter_rw(iter);
 
-	if (!fscrypt_dio_supported(iocb, iter))
+	if (!fscrypt_dio_supported(inode))
 		return true;
 	if (fsverity_active(inode))
 		return true;
diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h
index 7d2f1e0f23b1fe..13598859d5b394 100644
--- a/include/linux/fscrypt.h
+++ b/include/linux/fscrypt.h
@@ -768,7 +768,7 @@ bool fscrypt_mergeable_bio(struct bio *bio, const struct inode *inode,
 bool fscrypt_mergeable_bio_bh(struct bio *bio,
 			      const struct buffer_head *next_bh);
 
-bool fscrypt_dio_supported(struct kiocb *iocb, struct iov_iter *iter);
+bool fscrypt_dio_supported(struct inode *inode);
 
 u64 fscrypt_limit_io_blocks(const struct inode *inode, u64 lblk, u64 nr_blocks);
 
@@ -801,11 +801,8 @@ static inline bool fscrypt_mergeable_bio_bh(struct bio *bio,
 	return true;
 }
 
-static inline bool fscrypt_dio_supported(struct kiocb *iocb,
-					 struct iov_iter *iter)
+static inline bool fscrypt_dio_supported(struct inode *inode)
 {
-	const struct inode *inode = file_inode(iocb->ki_filp);
-
 	return !fscrypt_needs_contents_encryption(inode);
 }
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 4/8] ext4: support STATX_DIOALIGN
  2022-08-27  6:58 [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
                   ` (2 preceding siblings ...)
  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 ` Eric Biggers
  2022-08-27  6:58 ` [PATCH v5 5/8] f2fs: move f2fs_force_buffered_io() into file.c Eric Biggers
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 23+ messages in thread
From: Eric Biggers @ 2022-08-27  6:58 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, linux-f2fs-devel, linux-xfs, linux-api,
	linux-fscrypt, linux-block, linux-kernel, Keith Busch,
	Theodore Ts'o

From: Eric Biggers <ebiggers@google.com>

Add support for STATX_DIOALIGN to ext4, so that direct I/O alignment
restrictions are exposed to userspace in a generic way.

Acked-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/ext4/ext4.h  |  1 +
 fs/ext4/file.c  | 42 ++++++++++++++++++++++++++----------------
 fs/ext4/inode.c | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+), 16 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 9bca5565547bae..e6674504ca2abe 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2979,6 +2979,7 @@ extern struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
 extern int  ext4_write_inode(struct inode *, struct writeback_control *);
 extern int  ext4_setattr(struct user_namespace *, struct dentry *,
 			 struct iattr *);
+extern u32  ext4_dio_alignment(struct inode *inode);
 extern int  ext4_getattr(struct user_namespace *, const struct path *,
 			 struct kstat *, u32, unsigned int);
 extern void ext4_evict_inode(struct inode *);
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 26d7426208970d..8bb1c35fd6dd5a 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -36,24 +36,34 @@
 #include "acl.h"
 #include "truncate.h"
 
-static bool ext4_dio_supported(struct kiocb *iocb, struct iov_iter *iter)
+/*
+ * Returns %true if the given DIO request should be attempted with DIO, or
+ * %false if it should fall back to buffered I/O.
+ *
+ * DIO isn't well specified; when it's unsupported (either due to the request
+ * being misaligned, or due to the file not supporting DIO at all), filesystems
+ * either fall back to buffered I/O or return EINVAL.  For files that don't use
+ * any special features like encryption or verity, ext4 has traditionally
+ * returned EINVAL for misaligned DIO.  iomap_dio_rw() uses this convention too.
+ * In this case, we should attempt the DIO, *not* fall back to buffered I/O.
+ *
+ * In contrast, in cases where DIO is unsupported due to ext4 features, ext4
+ * traditionally falls back to buffered I/O.
+ *
+ * This function implements the traditional ext4 behavior in all these cases.
+ */
+static bool ext4_should_use_dio(struct kiocb *iocb, struct iov_iter *iter)
 {
 	struct inode *inode = file_inode(iocb->ki_filp);
+	u32 dio_align = ext4_dio_alignment(inode);
 
-	if (IS_ENCRYPTED(inode)) {
-		if (!fscrypt_dio_supported(inode))
-			return false;
-		if (!IS_ALIGNED(iocb->ki_pos | iov_iter_alignment(iter),
-				i_blocksize(inode)))
-			return false;
-	}
-	if (fsverity_active(inode))
+	if (dio_align == 0)
 		return false;
-	if (ext4_should_journal_data(inode))
-		return false;
-	if (ext4_has_inline_data(inode))
-		return false;
-	return true;
+
+	if (dio_align == 1)
+		return true;
+
+	return IS_ALIGNED(iocb->ki_pos | iov_iter_alignment(iter), dio_align);
 }
 
 static ssize_t ext4_dio_read_iter(struct kiocb *iocb, struct iov_iter *to)
@@ -68,7 +78,7 @@ static ssize_t ext4_dio_read_iter(struct kiocb *iocb, struct iov_iter *to)
 		inode_lock_shared(inode);
 	}
 
-	if (!ext4_dio_supported(iocb, to)) {
+	if (!ext4_should_use_dio(iocb, to)) {
 		inode_unlock_shared(inode);
 		/*
 		 * Fallback to buffered I/O if the operation being performed on
@@ -516,7 +526,7 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	}
 
 	/* Fallback to buffered I/O if the inode does not support direct I/O. */
-	if (!ext4_dio_supported(iocb, from)) {
+	if (!ext4_should_use_dio(iocb, from)) {
 		if (ilock_shared)
 			inode_unlock_shared(inode);
 		else
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 601214453c3aec..364774230d87ac 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5550,6 +5550,22 @@ int ext4_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
 	return error;
 }
 
+u32 ext4_dio_alignment(struct inode *inode)
+{
+	if (fsverity_active(inode))
+		return 0;
+	if (ext4_should_journal_data(inode))
+		return 0;
+	if (ext4_has_inline_data(inode))
+		return 0;
+	if (IS_ENCRYPTED(inode)) {
+		if (!fscrypt_dio_supported(inode))
+			return 0;
+		return i_blocksize(inode);
+	}
+	return 1; /* use the iomap defaults */
+}
+
 int ext4_getattr(struct user_namespace *mnt_userns, const struct path *path,
 		 struct kstat *stat, u32 request_mask, unsigned int query_flags)
 {
@@ -5565,6 +5581,27 @@ int ext4_getattr(struct user_namespace *mnt_userns, const struct path *path,
 		stat->btime.tv_nsec = ei->i_crtime.tv_nsec;
 	}
 
+	/*
+	 * Return the DIO alignment restrictions if requested.  We only return
+	 * this information when requested, since on encrypted files it might
+	 * take a fair bit of work to get if the file wasn't opened recently.
+	 */
+	if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) {
+		u32 dio_align = ext4_dio_alignment(inode);
+
+		stat->result_mask |= STATX_DIOALIGN;
+		if (dio_align == 1) {
+			struct block_device *bdev = inode->i_sb->s_bdev;
+
+			/* iomap defaults */
+			stat->dio_mem_align = bdev_dma_alignment(bdev) + 1;
+			stat->dio_offset_align = bdev_logical_block_size(bdev);
+		} else {
+			stat->dio_mem_align = dio_align;
+			stat->dio_offset_align = dio_align;
+		}
+	}
+
 	flags = ei->i_flags & EXT4_FL_USER_VISIBLE;
 	if (flags & EXT4_APPEND_FL)
 		stat->attributes |= STATX_ATTR_APPEND;
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 5/8] f2fs: move f2fs_force_buffered_io() into file.c
  2022-08-27  6:58 [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
                   ` (3 preceding siblings ...)
  2022-08-27  6:58 ` [PATCH v5 4/8] ext4: support STATX_DIOALIGN Eric Biggers
@ 2022-08-27  6:58 ` 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
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Eric Biggers @ 2022-08-27  6:58 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, linux-f2fs-devel, linux-xfs, linux-api,
	linux-fscrypt, linux-block, linux-kernel, Keith Busch

From: Eric Biggers <ebiggers@google.com>

f2fs_force_buffered_io() is only used in file.c, so move it into there.
No behavior change.  This makes it easier to review later patches.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/f2fs/f2fs.h | 40 ----------------------------------------
 fs/f2fs/file.c | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 0759da1919f4ad..aea816a133a8f1 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -4471,17 +4471,6 @@ static inline void f2fs_i_compr_blocks_update(struct inode *inode,
 	f2fs_mark_inode_dirty_sync(inode, true);
 }
 
-static inline int block_unaligned_IO(struct inode *inode,
-				struct kiocb *iocb, struct iov_iter *iter)
-{
-	unsigned int i_blkbits = READ_ONCE(inode->i_blkbits);
-	unsigned int blocksize_mask = (1 << i_blkbits) - 1;
-	loff_t offset = iocb->ki_pos;
-	unsigned long align = offset | iov_iter_alignment(iter);
-
-	return align & blocksize_mask;
-}
-
 static inline bool f2fs_allow_multi_device_dio(struct f2fs_sb_info *sbi,
 								int flag)
 {
@@ -4492,35 +4481,6 @@ static inline bool f2fs_allow_multi_device_dio(struct f2fs_sb_info *sbi,
 	return sbi->aligned_blksize;
 }
 
-static inline bool f2fs_force_buffered_io(struct inode *inode,
-				struct kiocb *iocb, struct iov_iter *iter)
-{
-	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
-	int rw = iov_iter_rw(iter);
-
-	if (!fscrypt_dio_supported(inode))
-		return true;
-	if (fsverity_active(inode))
-		return true;
-	if (f2fs_compressed_file(inode))
-		return true;
-
-	/* disallow direct IO if any of devices has unaligned blksize */
-	if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize)
-		return true;
-
-	if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
-		if (block_unaligned_IO(inode, iocb, iter))
-			return true;
-		if (F2FS_IO_ALIGNED(sbi))
-			return true;
-	}
-	if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED))
-		return true;
-
-	return false;
-}
-
 static inline bool f2fs_need_verity(const struct inode *inode, pgoff_t idx)
 {
 	return fsverity_active(inode) &&
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index ce4905a073b3c4..8a9455bf956f16 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -808,6 +808,46 @@ int f2fs_truncate(struct inode *inode)
 	return 0;
 }
 
+static int block_unaligned_IO(struct inode *inode, struct kiocb *iocb,
+			      struct iov_iter *iter)
+{
+	unsigned int i_blkbits = READ_ONCE(inode->i_blkbits);
+	unsigned int blocksize_mask = (1 << i_blkbits) - 1;
+	loff_t offset = iocb->ki_pos;
+	unsigned long align = offset | iov_iter_alignment(iter);
+
+	return align & blocksize_mask;
+}
+
+static bool f2fs_force_buffered_io(struct inode *inode,
+				   struct kiocb *iocb, struct iov_iter *iter)
+{
+	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+	int rw = iov_iter_rw(iter);
+
+	if (!fscrypt_dio_supported(inode))
+		return true;
+	if (fsverity_active(inode))
+		return true;
+	if (f2fs_compressed_file(inode))
+		return true;
+
+	/* disallow direct IO if any of devices has unaligned blksize */
+	if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize)
+		return true;
+
+	if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
+		if (block_unaligned_IO(inode, iocb, iter))
+			return true;
+		if (F2FS_IO_ALIGNED(sbi))
+			return true;
+	}
+	if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED))
+		return true;
+
+	return false;
+}
+
 int f2fs_getattr(struct user_namespace *mnt_userns, const struct path *path,
 		 struct kstat *stat, u32 request_mask, unsigned int query_flags)
 {
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 6/8] f2fs: simplify f2fs_force_buffered_io()
  2022-08-27  6:58 [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
                   ` (4 preceding siblings ...)
  2022-08-27  6:58 ` [PATCH v5 5/8] f2fs: move f2fs_force_buffered_io() into file.c Eric Biggers
@ 2022-08-27  6:58 ` Eric Biggers
  2022-08-29 17:36   ` Jaegeuk Kim
  2022-08-27  6:58 ` [PATCH v5 7/8] f2fs: support STATX_DIOALIGN Eric Biggers
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Eric Biggers @ 2022-08-27  6:58 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, linux-f2fs-devel, linux-xfs, linux-api,
	linux-fscrypt, linux-block, linux-kernel, Keith Busch

From: Eric Biggers <ebiggers@google.com>

f2fs only allows direct I/O that is aligned to the filesystem block
size.  Given that fact, simplify f2fs_force_buffered_io() by removing
the redundant call to block_unaligned_IO().

This makes it easier to reuse this code for STATX_DIOALIGN.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/f2fs/file.c | 27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 8a9455bf956f16..8e11311db21060 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -808,22 +808,9 @@ int f2fs_truncate(struct inode *inode)
 	return 0;
 }
 
-static int block_unaligned_IO(struct inode *inode, struct kiocb *iocb,
-			      struct iov_iter *iter)
-{
-	unsigned int i_blkbits = READ_ONCE(inode->i_blkbits);
-	unsigned int blocksize_mask = (1 << i_blkbits) - 1;
-	loff_t offset = iocb->ki_pos;
-	unsigned long align = offset | iov_iter_alignment(iter);
-
-	return align & blocksize_mask;
-}
-
-static bool f2fs_force_buffered_io(struct inode *inode,
-				   struct kiocb *iocb, struct iov_iter *iter)
+static bool f2fs_force_buffered_io(struct inode *inode, int rw)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
-	int rw = iov_iter_rw(iter);
 
 	if (!fscrypt_dio_supported(inode))
 		return true;
@@ -836,13 +823,9 @@ static bool f2fs_force_buffered_io(struct inode *inode,
 	if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize)
 		return true;
 
-	if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
-		if (block_unaligned_IO(inode, iocb, iter))
-			return true;
-		if (F2FS_IO_ALIGNED(sbi))
-			return true;
-	}
-	if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED))
+	if (f2fs_lfs_mode(sbi) && rw == WRITE && F2FS_IO_ALIGNED(sbi))
+		return true;
+	if (is_sbi_flag_set(sbi, SBI_CP_DISABLED))
 		return true;
 
 	return false;
@@ -4222,7 +4205,7 @@ static bool f2fs_should_use_dio(struct inode *inode, struct kiocb *iocb,
 	if (!(iocb->ki_flags & IOCB_DIRECT))
 		return false;
 
-	if (f2fs_force_buffered_io(inode, iocb, iter))
+	if (f2fs_force_buffered_io(inode, iov_iter_rw(iter)))
 		return false;
 
 	/*
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 7/8] f2fs: support STATX_DIOALIGN
  2022-08-27  6:58 [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
                   ` (5 preceding siblings ...)
  2022-08-27  6:58 ` [PATCH v5 6/8] f2fs: simplify f2fs_force_buffered_io() Eric Biggers
@ 2022-08-27  6:58 ` Eric Biggers
  2022-08-29 17:43   ` Jaegeuk Kim
  2022-08-27  6:58 ` [PATCH v5 8/8] xfs: " Eric Biggers
  2022-09-06 22:08 ` [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
  8 siblings, 1 reply; 23+ messages in thread
From: Eric Biggers @ 2022-08-27  6:58 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, linux-f2fs-devel, linux-xfs, linux-api,
	linux-fscrypt, linux-block, linux-kernel, Keith Busch

From: Eric Biggers <ebiggers@google.com>

Add support for STATX_DIOALIGN to f2fs, so that direct I/O alignment
restrictions are exposed to userspace in a generic way.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/f2fs/file.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 8e11311db21060..79177050732803 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -847,6 +847,24 @@ int f2fs_getattr(struct user_namespace *mnt_userns, const struct path *path,
 		stat->btime.tv_nsec = fi->i_crtime.tv_nsec;
 	}
 
+	/*
+	 * Return the DIO alignment restrictions if requested.  We only return
+	 * this information when requested, since on encrypted files it might
+	 * take a fair bit of work to get if the file wasn't opened recently.
+	 *
+	 * f2fs sometimes supports DIO reads but not DIO writes.  STATX_DIOALIGN
+	 * cannot represent that, so in that case we report no DIO support.
+	 */
+	if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) {
+		unsigned int bsize = i_blocksize(inode);
+
+		stat->result_mask |= STATX_DIOALIGN;
+		if (!f2fs_force_buffered_io(inode, WRITE)) {
+			stat->dio_mem_align = bsize;
+			stat->dio_offset_align = bsize;
+		}
+	}
+
 	flags = fi->i_flags;
 	if (flags & F2FS_COMPR_FL)
 		stat->attributes |= STATX_ATTR_COMPRESSED;
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 8/8] xfs: support STATX_DIOALIGN
  2022-08-27  6:58 [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
                   ` (6 preceding siblings ...)
  2022-08-27  6:58 ` [PATCH v5 7/8] f2fs: support STATX_DIOALIGN Eric Biggers
@ 2022-08-27  6:58 ` 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
  8 siblings, 2 replies; 23+ messages in thread
From: Eric Biggers @ 2022-08-27  6:58 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, linux-f2fs-devel, linux-xfs, linux-api,
	linux-fscrypt, linux-block, linux-kernel, Keith Busch

From: Eric Biggers <ebiggers@google.com>

Add support for STATX_DIOALIGN to xfs, so that direct I/O alignment
restrictions are exposed to userspace in a generic way.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/xfs/xfs_iops.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 45518b8c613c9a..f51c60d7e2054a 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -604,6 +604,16 @@ xfs_vn_getattr(
 		stat->blksize = BLKDEV_IOSIZE;
 		stat->rdev = inode->i_rdev;
 		break;
+	case S_IFREG:
+		if (request_mask & STATX_DIOALIGN) {
+			struct xfs_buftarg	*target = xfs_inode_buftarg(ip);
+			struct block_device	*bdev = target->bt_bdev;
+
+			stat->result_mask |= STATX_DIOALIGN;
+			stat->dio_mem_align = bdev_dma_alignment(bdev) + 1;
+			stat->dio_offset_align = bdev_logical_block_size(bdev);
+		}
+		fallthrough;
 	default:
 		stat->blksize = xfs_stat_blksize(ip);
 		stat->rdev = 0;
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 8/8] xfs: support STATX_DIOALIGN
  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
  1 sibling, 0 replies; 23+ messages in thread
From: Darrick J. Wong @ 2022-08-27 15:34 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-fsdevel, linux-ext4, linux-f2fs-devel, linux-xfs,
	linux-api, linux-fscrypt, linux-block, linux-kernel, Keith Busch

On Fri, Aug 26, 2022 at 11:58:51PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Add support for STATX_DIOALIGN to xfs, so that direct I/O alignment
> restrictions are exposed to userspace in a generic way.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Looks good to me; I particularly like the adjustment to report the
device's DMA alignment.  Someone should probably fix DIONINFO, or
perhaps turn it into a getattr wrapper and hoist it?  IMHO none of those
suggestions are necessary to land this patch, though.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_iops.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 45518b8c613c9a..f51c60d7e2054a 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -604,6 +604,16 @@ xfs_vn_getattr(
>  		stat->blksize = BLKDEV_IOSIZE;
>  		stat->rdev = inode->i_rdev;
>  		break;
> +	case S_IFREG:
> +		if (request_mask & STATX_DIOALIGN) {
> +			struct xfs_buftarg	*target = xfs_inode_buftarg(ip);
> +			struct block_device	*bdev = target->bt_bdev;
> +
> +			stat->result_mask |= STATX_DIOALIGN;
> +			stat->dio_mem_align = bdev_dma_alignment(bdev) + 1;
> +			stat->dio_offset_align = bdev_logical_block_size(bdev);
> +		}
> +		fallthrough;
>  	default:
>  		stat->blksize = xfs_stat_blksize(ip);
>  		stat->rdev = 0;
> -- 
> 2.37.2
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 6/8] f2fs: simplify f2fs_force_buffered_io()
  2022-08-27  6:58 ` [PATCH v5 6/8] f2fs: simplify f2fs_force_buffered_io() Eric Biggers
@ 2022-08-29 17:36   ` Jaegeuk Kim
  0 siblings, 0 replies; 23+ messages in thread
From: Jaegeuk Kim @ 2022-08-29 17:36 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-fsdevel, linux-ext4, linux-f2fs-devel, linux-xfs,
	linux-api, linux-fscrypt, linux-block, linux-kernel, Keith Busch

On 08/26, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> f2fs only allows direct I/O that is aligned to the filesystem block
> size.  Given that fact, simplify f2fs_force_buffered_io() by removing
> the redundant call to block_unaligned_IO().
> 
> This makes it easier to reuse this code for STATX_DIOALIGN.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>

> ---
>  fs/f2fs/file.c | 27 +++++----------------------
>  1 file changed, 5 insertions(+), 22 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 8a9455bf956f16..8e11311db21060 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -808,22 +808,9 @@ int f2fs_truncate(struct inode *inode)
>  	return 0;
>  }
>  
> -static int block_unaligned_IO(struct inode *inode, struct kiocb *iocb,
> -			      struct iov_iter *iter)
> -{
> -	unsigned int i_blkbits = READ_ONCE(inode->i_blkbits);
> -	unsigned int blocksize_mask = (1 << i_blkbits) - 1;
> -	loff_t offset = iocb->ki_pos;
> -	unsigned long align = offset | iov_iter_alignment(iter);
> -
> -	return align & blocksize_mask;
> -}
> -
> -static bool f2fs_force_buffered_io(struct inode *inode,
> -				   struct kiocb *iocb, struct iov_iter *iter)
> +static bool f2fs_force_buffered_io(struct inode *inode, int rw)
>  {
>  	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> -	int rw = iov_iter_rw(iter);
>  
>  	if (!fscrypt_dio_supported(inode))
>  		return true;
> @@ -836,13 +823,9 @@ static bool f2fs_force_buffered_io(struct inode *inode,
>  	if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize)
>  		return true;
>  
> -	if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
> -		if (block_unaligned_IO(inode, iocb, iter))
> -			return true;
> -		if (F2FS_IO_ALIGNED(sbi))
> -			return true;
> -	}
> -	if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED))
> +	if (f2fs_lfs_mode(sbi) && rw == WRITE && F2FS_IO_ALIGNED(sbi))
> +		return true;
> +	if (is_sbi_flag_set(sbi, SBI_CP_DISABLED))
>  		return true;
>  
>  	return false;
> @@ -4222,7 +4205,7 @@ static bool f2fs_should_use_dio(struct inode *inode, struct kiocb *iocb,
>  	if (!(iocb->ki_flags & IOCB_DIRECT))
>  		return false;
>  
> -	if (f2fs_force_buffered_io(inode, iocb, iter))
> +	if (f2fs_force_buffered_io(inode, iov_iter_rw(iter)))
>  		return false;
>  
>  	/*
> -- 
> 2.37.2

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 5/8] f2fs: move f2fs_force_buffered_io() into file.c
  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
  0 siblings, 0 replies; 23+ messages in thread
From: Jaegeuk Kim @ 2022-08-29 17:37 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-fsdevel, linux-ext4, linux-f2fs-devel, linux-xfs,
	linux-api, linux-fscrypt, linux-block, linux-kernel, Keith Busch

On 08/26, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> f2fs_force_buffered_io() is only used in file.c, so move it into there.
> No behavior change.  This makes it easier to review later patches.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>

> ---
>  fs/f2fs/f2fs.h | 40 ----------------------------------------
>  fs/f2fs/file.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 40 insertions(+), 40 deletions(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 0759da1919f4ad..aea816a133a8f1 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -4471,17 +4471,6 @@ static inline void f2fs_i_compr_blocks_update(struct inode *inode,
>  	f2fs_mark_inode_dirty_sync(inode, true);
>  }
>  
> -static inline int block_unaligned_IO(struct inode *inode,
> -				struct kiocb *iocb, struct iov_iter *iter)
> -{
> -	unsigned int i_blkbits = READ_ONCE(inode->i_blkbits);
> -	unsigned int blocksize_mask = (1 << i_blkbits) - 1;
> -	loff_t offset = iocb->ki_pos;
> -	unsigned long align = offset | iov_iter_alignment(iter);
> -
> -	return align & blocksize_mask;
> -}
> -
>  static inline bool f2fs_allow_multi_device_dio(struct f2fs_sb_info *sbi,
>  								int flag)
>  {
> @@ -4492,35 +4481,6 @@ static inline bool f2fs_allow_multi_device_dio(struct f2fs_sb_info *sbi,
>  	return sbi->aligned_blksize;
>  }
>  
> -static inline bool f2fs_force_buffered_io(struct inode *inode,
> -				struct kiocb *iocb, struct iov_iter *iter)
> -{
> -	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> -	int rw = iov_iter_rw(iter);
> -
> -	if (!fscrypt_dio_supported(inode))
> -		return true;
> -	if (fsverity_active(inode))
> -		return true;
> -	if (f2fs_compressed_file(inode))
> -		return true;
> -
> -	/* disallow direct IO if any of devices has unaligned blksize */
> -	if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize)
> -		return true;
> -
> -	if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
> -		if (block_unaligned_IO(inode, iocb, iter))
> -			return true;
> -		if (F2FS_IO_ALIGNED(sbi))
> -			return true;
> -	}
> -	if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED))
> -		return true;
> -
> -	return false;
> -}
> -
>  static inline bool f2fs_need_verity(const struct inode *inode, pgoff_t idx)
>  {
>  	return fsverity_active(inode) &&
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index ce4905a073b3c4..8a9455bf956f16 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -808,6 +808,46 @@ int f2fs_truncate(struct inode *inode)
>  	return 0;
>  }
>  
> +static int block_unaligned_IO(struct inode *inode, struct kiocb *iocb,
> +			      struct iov_iter *iter)
> +{
> +	unsigned int i_blkbits = READ_ONCE(inode->i_blkbits);
> +	unsigned int blocksize_mask = (1 << i_blkbits) - 1;
> +	loff_t offset = iocb->ki_pos;
> +	unsigned long align = offset | iov_iter_alignment(iter);
> +
> +	return align & blocksize_mask;
> +}
> +
> +static bool f2fs_force_buffered_io(struct inode *inode,
> +				   struct kiocb *iocb, struct iov_iter *iter)
> +{
> +	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> +	int rw = iov_iter_rw(iter);
> +
> +	if (!fscrypt_dio_supported(inode))
> +		return true;
> +	if (fsverity_active(inode))
> +		return true;
> +	if (f2fs_compressed_file(inode))
> +		return true;
> +
> +	/* disallow direct IO if any of devices has unaligned blksize */
> +	if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize)
> +		return true;
> +
> +	if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
> +		if (block_unaligned_IO(inode, iocb, iter))
> +			return true;
> +		if (F2FS_IO_ALIGNED(sbi))
> +			return true;
> +	}
> +	if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED))
> +		return true;
> +
> +	return false;
> +}
> +
>  int f2fs_getattr(struct user_namespace *mnt_userns, const struct path *path,
>  		 struct kstat *stat, u32 request_mask, unsigned int query_flags)
>  {
> -- 
> 2.37.2

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 7/8] f2fs: support STATX_DIOALIGN
  2022-08-27  6:58 ` [PATCH v5 7/8] f2fs: support STATX_DIOALIGN Eric Biggers
@ 2022-08-29 17:43   ` Jaegeuk Kim
  0 siblings, 0 replies; 23+ messages in thread
From: Jaegeuk Kim @ 2022-08-29 17:43 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-fsdevel, linux-ext4, linux-f2fs-devel, linux-xfs,
	linux-api, linux-fscrypt, linux-block, linux-kernel, Keith Busch

On 08/26, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Add support for STATX_DIOALIGN to f2fs, so that direct I/O alignment
> restrictions are exposed to userspace in a generic way.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>

> ---
>  fs/f2fs/file.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 8e11311db21060..79177050732803 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -847,6 +847,24 @@ int f2fs_getattr(struct user_namespace *mnt_userns, const struct path *path,
>  		stat->btime.tv_nsec = fi->i_crtime.tv_nsec;
>  	}
>  
> +	/*
> +	 * Return the DIO alignment restrictions if requested.  We only return
> +	 * this information when requested, since on encrypted files it might
> +	 * take a fair bit of work to get if the file wasn't opened recently.
> +	 *
> +	 * f2fs sometimes supports DIO reads but not DIO writes.  STATX_DIOALIGN
> +	 * cannot represent that, so in that case we report no DIO support.
> +	 */
> +	if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) {
> +		unsigned int bsize = i_blocksize(inode);
> +
> +		stat->result_mask |= STATX_DIOALIGN;
> +		if (!f2fs_force_buffered_io(inode, WRITE)) {
> +			stat->dio_mem_align = bsize;
> +			stat->dio_offset_align = bsize;
> +		}
> +	}
> +
>  	flags = fi->i_flags;
>  	if (flags & F2FS_COMPR_FL)
>  		stat->attributes |= STATX_ATTR_COMPRESSED;
> -- 
> 2.37.2

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 2/8] vfs: support STATX_DIOALIGN on block devices
  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
  1 sibling, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2022-09-06  8:10 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-fsdevel, linux-ext4, linux-f2fs-devel, linux-xfs,
	linux-api, linux-fscrypt, linux-block, linux-kernel, Keith Busch

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 8/8] xfs: support STATX_DIOALIGN
  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
  1 sibling, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2022-09-06  8:11 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-fsdevel, linux-ext4, linux-f2fs-devel, linux-xfs,
	linux-api, linux-fscrypt, linux-block, linux-kernel, Keith Busch

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 0/8] make statx() return DIO alignment information
  2022-08-27  6:58 [PATCH v5 0/8] make statx() return DIO alignment information Eric Biggers
                   ` (7 preceding siblings ...)
  2022-08-27  6:58 ` [PATCH v5 8/8] xfs: " Eric Biggers
@ 2022-09-06 22:08 ` Eric Biggers
  2022-09-12  0:54   ` Eric Biggers
  8 siblings, 1 reply; 23+ messages in thread
From: Eric Biggers @ 2022-09-06 22:08 UTC (permalink / raw)
  To: Alexander Viro
  Cc: linux-fsdevel, linux-ext4, linux-f2fs-devel, linux-xfs,
	linux-api, linux-fscrypt, linux-block, linux-kernel, Keith Busch

On Fri, Aug 26, 2022 at 11:58:43PM -0700, Eric Biggers wrote:
> This patchset makes the statx() system call return direct I/O (DIO)
> alignment information.  This allows userspace to easily determine
> whether a file supports DIO, and if so with what alignment restrictions.

Al, any thoughts on this patchset, and do you plan to apply it for 6.1?  Ideally
this would go through the VFS tree.  If not, I suppose I'll need to have it
added to linux-next and send the pull request myself.

- Eric

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 2/8] vfs: support STATX_DIOALIGN on block devices
  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
  1 sibling, 0 replies; 23+ messages in thread
From: Christian Brauner @ 2022-09-07  9:09 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-fsdevel, linux-ext4, linux-f2fs-devel, linux-xfs,
	linux-api, linux-fscrypt, linux-block, linux-kernel, Keith Busch

On Fri, Aug 26, 2022 at 11:58:45PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Add support for STATX_DIOALIGN to block devices, so that direct I/O
> alignment restrictions are exposed to userspace in a generic way.
> 
> Note that this breaks the tradition of stat operating only on the block
> device node, not the block device itself.  However, it was felt that
> doing this is preferable, in order to make the interface useful and
> avoid needing separate interfaces for regular files and block devices.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---

Looks good to me,
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 1/8] statx: add direct I/O alignment information
  2022-08-27  6:58 ` [PATCH v5 1/8] statx: add direct I/O " Eric Biggers
@ 2022-09-07  9:10   ` Christian Brauner
  0 siblings, 0 replies; 23+ messages in thread
From: Christian Brauner @ 2022-09-07  9:10 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-fsdevel, linux-ext4, linux-f2fs-devel, linux-xfs,
	linux-api, linux-fscrypt, linux-block, linux-kernel, Keith Busch,
	Christoph Hellwig, Darrick J. Wong, Martin K. Petersen

On Fri, Aug 26, 2022 at 11:58:44PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.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
> (https://lore.kernel.org/linux-fsdevel/20220120071215.123274-1-ebiggers@kernel.org/T/#u),
> 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 <hch@lst.de>
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---

Looks good to me,
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 0/8] make statx() return DIO alignment information
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Eric Biggers @ 2022-09-12  0:54 UTC (permalink / raw)
  To: Stephen Rothwell, linux-next
  Cc: linux-block, linux-api, linux-kernel, linux-f2fs-devel,
	linux-xfs, Keith Busch, linux-fscrypt, linux-fsdevel, linux-ext4,
	Alexander Viro

On Tue, Sep 06, 2022 at 03:08:51PM -0700, Eric Biggers wrote:
> On Fri, Aug 26, 2022 at 11:58:43PM -0700, Eric Biggers wrote:
> > This patchset makes the statx() system call return direct I/O (DIO)
> > alignment information.  This allows userspace to easily determine
> > whether a file supports DIO, and if so with what alignment restrictions.
> 
> Al, any thoughts on this patchset, and do you plan to apply it for 6.1?  Ideally
> this would go through the VFS tree.  If not, I suppose I'll need to have it
> added to linux-next and send the pull request myself.
> 
> - Eric

Seems that it's up to me, then.

Stephen, can you add my git branch for this patchset to linux-next?

URL: https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
Branch: statx-dioalign

This is targeting the 6.1 merge window with a pull request to Linus.

Thanks!

- Eric

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 0/8] make statx() return DIO alignment information
  2022-09-12  0:54   ` Eric Biggers
@ 2022-09-12 20:30     ` Stephen Rothwell
  2022-10-18  4:55       ` Stephen Rothwell
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Rothwell @ 2022-09-12 20:30 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Stephen Rothwell, linux-next, linux-block, linux-api,
	linux-kernel, linux-f2fs-devel, linux-xfs, Keith Busch,
	linux-fscrypt, linux-fsdevel, linux-ext4, Alexander Viro

[-- Attachment #1: Type: text/plain, Size: 1890 bytes --]

Hi Eric,

On Sun, 11 Sep 2022 19:54:12 -0500 Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Tue, Sep 06, 2022 at 03:08:51PM -0700, Eric Biggers wrote:
> > On Fri, Aug 26, 2022 at 11:58:43PM -0700, Eric Biggers wrote:  
> > > This patchset makes the statx() system call return direct I/O (DIO)
> > > alignment information.  This allows userspace to easily determine
> > > whether a file supports DIO, and if so with what alignment restrictions.  
> > 
> > Al, any thoughts on this patchset, and do you plan to apply it for 6.1?  Ideally
> > this would go through the VFS tree.  If not, I suppose I'll need to have it
> > added to linux-next and send the pull request myself.
> > 
> > - Eric  
> 
> Seems that it's up to me, then.
> 
> Stephen, can you add my git branch for this patchset to linux-next?
> 
> URL: https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
> Branch: statx-dioalign
> 
> This is targeting the 6.1 merge window with a pull request to Linus.

Added from today.

Thanks for adding your subsystem tree as a participant of linux-next.  As
you may know, this is not a judgement of your code.  The purpose of
linux-next is for integration testing and to lower the impact of
conflicts between subsystems in the next merge window. 

You will need to ensure that the patches/commits in your tree/series have
been:
     * submitted under GPL v2 (or later) and include the Contributor's
        Signed-off-by,
     * posted to the relevant mailing list,
     * reviewed by you (or another maintainer of your subsystem tree),
     * successfully unit tested, and 
     * destined for the current or next Linux merge window.

Basically, this should be just what you would send to Linus (or ask him
to fetch).  It is allowed to be rebased if you deem it necessary.

-- 
Cheers,
Stephen Rothwell 
sfr@canb.auug.org.au

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 0/8] make statx() return DIO alignment information
  2022-09-12 20:30     ` Stephen Rothwell
@ 2022-10-18  4:55       ` Stephen Rothwell
  2022-10-18  7:07         ` Eric Biggers
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Rothwell @ 2022-10-18  4:55 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-next, linux-block, linux-api, linux-kernel,
	linux-f2fs-devel, linux-xfs, Keith Busch, linux-fscrypt,
	linux-fsdevel, linux-ext4, Alexander Viro

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

Hi Eric,

On Tue, 13 Sep 2022 06:30:25 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> On Sun, 11 Sep 2022 19:54:12 -0500 Eric Biggers <ebiggers@kernel.org> wrote:
> >
> > Stephen, can you add my git branch for this patchset to linux-next?
> > 
> > URL: https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
> > Branch: statx-dioalign
> > 
> > This is targeting the 6.1 merge window with a pull request to Linus.  
> 
> Added from today.

I notice that this branch has been removed.  Are you finished with it
(i.e. should I remove it from linux-next)?

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 0/8] make statx() return DIO alignment information
  2022-10-18  4:55       ` Stephen Rothwell
@ 2022-10-18  7:07         ` Eric Biggers
  2022-10-18 20:08           ` Stephen Rothwell
  0 siblings, 1 reply; 23+ messages in thread
From: Eric Biggers @ 2022-10-18  7:07 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-next, linux-block, linux-api, linux-kernel,
	linux-f2fs-devel, linux-xfs, Keith Busch, linux-fscrypt,
	linux-fsdevel, linux-ext4, Alexander Viro

On Tue, Oct 18, 2022 at 03:55:24PM +1100, Stephen Rothwell wrote:
> Hi Eric,
> 
> On Tue, 13 Sep 2022 06:30:25 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > 
> > On Sun, 11 Sep 2022 19:54:12 -0500 Eric Biggers <ebiggers@kernel.org> wrote:
> > >
> > > Stephen, can you add my git branch for this patchset to linux-next?
> > > 
> > > URL: https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
> > > Branch: statx-dioalign
> > > 
> > > This is targeting the 6.1 merge window with a pull request to Linus.  
> > 
> > Added from today.
> 
> I notice that this branch has been removed.  Are you finished with it
> (i.e. should I remove it from linux-next)?
> 

Yes, I think so.  This patchset has been merged upstream.  Any more patches
related to STATX_DIOALIGN should go in through the VFS or filesystem-specific
trees.

- Eric

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 0/8] make statx() return DIO alignment information
  2022-10-18  7:07         ` Eric Biggers
@ 2022-10-18 20:08           ` Stephen Rothwell
  0 siblings, 0 replies; 23+ messages in thread
From: Stephen Rothwell @ 2022-10-18 20:08 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-next, linux-block, linux-api, linux-kernel,
	linux-f2fs-devel, linux-xfs, Keith Busch, linux-fscrypt,
	linux-fsdevel, linux-ext4, Alexander Viro

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]

Hi Eric,

On Tue, 18 Oct 2022 00:07:57 -0700 Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Tue, Oct 18, 2022 at 03:55:24PM +1100, Stephen Rothwell wrote:
> > 
> > I notice that this branch has been removed.  Are you finished with it
> > (i.e. should I remove it from linux-next)?
> >   
> 
> Yes, I think so.  This patchset has been merged upstream.  Any more patches
> related to STATX_DIOALIGN should go in through the VFS or filesystem-specific
> trees.

OK, I have removed it.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-10-18 20:08 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).