diff options
author | Stefan Roesch <shr@fb.com> | 2022-06-23 10:51:50 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-07-24 18:39:31 -0600 |
commit | 8017553980d0bbfef3e66c583363828565afd6da (patch) | |
tree | c02bf0bc996e1ba246d94070b937f727109ac9a0 /fs/read_write.c | |
parent | 18e419f6e80a6d3c8aaab94abd55c3b41741d8df (diff) | |
download | linux-stable-8017553980d0bbfef3e66c583363828565afd6da.tar.gz linux-stable-8017553980d0bbfef3e66c583363828565afd6da.tar.bz2 linux-stable-8017553980d0bbfef3e66c583363828565afd6da.zip |
fs: add a FMODE_BUF_WASYNC flags for f_mode
This introduces the flag FMODE_BUF_WASYNC. If devices support async
buffered writes, this flag can be set. It also modifies the check in
generic_write_checks to take async buffered writes into consideration.
Signed-off-by: Stefan Roesch <shr@fb.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20220623175157.1715274-8-shr@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index e0777eefd846..319d88825d1c 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1660,7 +1660,9 @@ int generic_write_checks_count(struct kiocb *iocb, loff_t *count) if (iocb->ki_flags & IOCB_APPEND) iocb->ki_pos = i_size_read(inode); - if ((iocb->ki_flags & IOCB_NOWAIT) && !(iocb->ki_flags & IOCB_DIRECT)) + if ((iocb->ki_flags & IOCB_NOWAIT) && + !((iocb->ki_flags & IOCB_DIRECT) || + (file->f_mode & FMODE_BUF_WASYNC))) return -EINVAL; return generic_write_check_limits(iocb->ki_filp, iocb->ki_pos, count); |