From: John Garry <john.g.garry@oracle.com>
To: Dave Chinner <david@fromorbit.com>,
Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: linux-ext4@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
Ritesh Harjani <ritesh.list@gmail.com>,
linux-kernel@vger.kernel.org,
"Darrick J . Wong" <djwong@kernel.org>,
linux-block@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org, dchinner@redhat.com
Subject: Re: [RFC 1/7] iomap: Don't fall back to buffered write if the write is atomic
Date: Fri, 1 Dec 2023 10:42:57 +0000 [thread overview]
Message-ID: <85d1b27c-f4ef-43dd-8eed-f497817ab86d@oracle.com> (raw)
In-Reply-To: <ZWj6Tt1zKUL4WPGr@dread.disaster.area>
On 30/11/2023 21:10, Dave Chinner wrote:
> On Thu, Nov 30, 2023 at 07:23:09PM +0530, Ojaswin Mujoo wrote:
>> Currently, iomap only supports atomic writes for direct IOs and there is
>> no guarantees that a buffered IO will be atomic. Hence, if the user has
>> explicitly requested the direct write to be atomic and there's a
>> failure, return -EIO instead of falling back to buffered IO.
>>
>> Signed-off-by: Ojaswin Mujoo<ojaswin@linux.ibm.com>
>> ---
>> fs/iomap/direct-io.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
>> index 6ef25e26f1a1..3e7cd9bc8f4d 100644
>> --- a/fs/iomap/direct-io.c
>> +++ b/fs/iomap/direct-io.c
>> @@ -662,7 +662,13 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
>> if (ret != -EAGAIN) {
>> trace_iomap_dio_invalidate_fail(inode, iomi.pos,
>> iomi.len);
>> - ret = -ENOTBLK;
>> + /*
>> + * if this write was supposed to be atomic,
>> + * return the err rather than trying to fall
>> + * back to buffered IO.
>> + */
>> + if (!atomic_write)
>> + ret = -ENOTBLK;
> This belongs in the caller when it receives an -ENOTBLK from
> iomap_dio_rw(). The iomap code is saying "this IO cannot be done
> with direct IO" by returning this value, and then the caller can
> make the determination of whether to run a buffered IO or not.
>
> For example, a filesystem might still be able to perform an atomic
> IO via a COW-based buffered IO slow path. Sure, ext4 can't do this,
> but the above patch would prevent filesystems that could from being
> able to implement such a fallback....
Sure, and I think that we need a better story for supporting buffered IO
for atomic writes.
Currently we have:
- man pages tell us RWF_ATOMIC is only supported for direct IO
- statx gives atomic write unit min/max, not explicitly telling us it's
for direct IO
- RWF_ATOMIC is ignored for !O_DIRECT
So I am thinking of expanding statx support to enable querying of atomic
write capabilities for buffered IO and direct IO separately.
Thanks,
John
next prev parent reply other threads:[~2023-12-01 10:43 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 13:53 [RFC 0/7] ext4: Allocator changes for atomic write support with DIO Ojaswin Mujoo
2023-11-30 13:53 ` [RFC 1/7] iomap: Don't fall back to buffered write if the write is atomic Ojaswin Mujoo
2023-11-30 21:10 ` Dave Chinner
2023-12-01 10:42 ` John Garry [this message]
2023-12-01 13:27 ` Matthew Wilcox
2023-12-01 19:06 ` John Garry
2023-12-01 22:07 ` Dave Chinner
2023-12-04 9:02 ` John Garry
2023-12-04 18:17 ` Darrick J. Wong
2023-12-04 18:34 ` John Garry
2023-12-07 12:43 ` John Garry
2023-11-30 13:53 ` [RFC 2/7] ext4: Factor out size and start prediction from ext4_mb_normalize_request() Ojaswin Mujoo
2023-11-30 13:53 ` [RFC 3/7] ext4: add aligned allocation support in mballoc Ojaswin Mujoo
2023-11-30 13:53 ` [RFC 4/7] ext4: allow inode preallocation for aligned alloc Ojaswin Mujoo
2023-11-30 13:53 ` [RFC 5/7] block: export blkdev_atomic_write_valid() and refactor api Ojaswin Mujoo
2023-12-01 10:47 ` John Garry
2023-12-11 10:57 ` Ojaswin Mujoo
2023-11-30 13:53 ` [RFC 6/7] ext4: Add aligned allocation support for atomic direct io Ojaswin Mujoo
2023-11-30 13:53 ` [RFC 7/7] ext4: Support atomic write for statx Ojaswin Mujoo
2023-12-04 10:36 ` [RFC 0/7] ext4: Allocator changes for atomic write support with DIO John Garry
2023-12-04 13:38 ` Ojaswin Mujoo
2023-12-04 14:44 ` John Garry
2023-12-11 10:54 ` Ojaswin Mujoo
2023-12-12 7:46 ` John Garry
2023-12-12 13:10 ` Christoph Hellwig
2023-12-12 15:16 ` Theodore Ts'o
2023-12-12 15:19 ` Christoph Hellwig
2023-12-12 16:10 ` John Garry
2023-12-13 5:59 ` Ojaswin Mujoo
2023-12-13 9:17 ` John Garry
2023-12-13 6:42 ` Ojaswin Mujoo
2023-12-13 9:20 ` John Garry
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=85d1b27c-f4ef-43dd-8eed-f497817ab86d@oracle.com \
--to=john.g.garry@oracle.com \
--cc=david@fromorbit.com \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).