mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
ext4: Do not fallback to buffered-io for DIO atomic write
atomic writes is currently only supported for single fsblock and only for direct-io. We should not return -ENOTBLK for atomic writes since we want the atomic write request to either complete fully or fail otherwise. Hence, we should never fallback to buffered-io in case of DIO atomic write requests. Let's also catch if this ever happens by adding some WARN_ON_ONCE before buffered-io handling for direct-io atomic writes. More details of the discussion [1]. While at it let's add an inline helper ext4_want_directio_fallback() which simplifies the logic checks and inherently fixes condition on when to return -ENOTBLK which otherwise was always returning true for any write or directio in ext4_iomap_end(). It was ok since ext4 only supports direct-io via iomap. [1]: https://lore.kernel.org/linux-xfs/cover.1729825985.git.ritesh.list@gmail.com/T/#m9dbecc11bed713ed0d7a486432c56b105b555f04 Suggested-by: Darrick J. Wong <djwong@kernel.org> # inline helper Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Jan Kara <jack@suse.cz>
This commit is contained in:
committed by
Darrick J. Wong
parent
b7987a7d69
commit
299537e9df
@@ -599,6 +599,13 @@ out:
|
||||
ssize_t err;
|
||||
loff_t endbyte;
|
||||
|
||||
/*
|
||||
* There is no support for atomic writes on buffered-io yet,
|
||||
* we should never fallback to buffered-io for DIO atomic
|
||||
* writes.
|
||||
*/
|
||||
WARN_ON_ONCE(iocb->ki_flags & IOCB_ATOMIC);
|
||||
|
||||
offset = iocb->ki_pos;
|
||||
err = ext4_buffered_write_iter(iocb, from);
|
||||
if (err < 0)
|
||||
|
||||
Reference in New Issue
Block a user