Skip to content

Commit cc23d53

Browse files
yangyun50Miklos Szeredi
authored and
Miklos Szeredi
committed
fuse: remove useless IOCB_DIRECT in fuse_direct_read/write_iter
Commit 23c94e1 ("fuse: Switch to using async direct IO for FOPEN_DIRECT_IO") gave the async direct IO code path in the fuse_direct_read_iter() and fuse_direct_write_iter(). But since these two functions are only called under FOPEN_DIRECT_IO is set, it seems that we can also use the async direct IO even the flag IOCB_DIRECT is not set to enjoy the async direct IO method. Also move the definition of fuse_io_priv to where it is used in fuse_ direct_write_iter. Signed-off-by: yangyun <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 2b3933b commit cc23d53

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/fuse/file.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ static ssize_t fuse_direct_read_iter(struct kiocb *iocb, struct iov_iter *to)
16501650
{
16511651
ssize_t res;
16521652

1653-
if (!is_sync_kiocb(iocb) && iocb->ki_flags & IOCB_DIRECT) {
1653+
if (!is_sync_kiocb(iocb)) {
16541654
res = fuse_direct_IO(iocb, to);
16551655
} else {
16561656
struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(iocb);
@@ -1664,17 +1664,18 @@ static ssize_t fuse_direct_read_iter(struct kiocb *iocb, struct iov_iter *to)
16641664
static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from)
16651665
{
16661666
struct inode *inode = file_inode(iocb->ki_filp);
1667-
struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(iocb);
16681667
ssize_t res;
16691668
bool exclusive;
16701669

16711670
fuse_dio_lock(iocb, from, &exclusive);
16721671
res = generic_write_checks(iocb, from);
16731672
if (res > 0) {
16741673
task_io_account_write(res);
1675-
if (!is_sync_kiocb(iocb) && iocb->ki_flags & IOCB_DIRECT) {
1674+
if (!is_sync_kiocb(iocb)) {
16761675
res = fuse_direct_IO(iocb, from);
16771676
} else {
1677+
struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(iocb);
1678+
16781679
res = fuse_direct_io(&io, from, &iocb->ki_pos,
16791680
FUSE_DIO_WRITE);
16801681
fuse_write_update_attr(inode, iocb->ki_pos, res);

0 commit comments

Comments
 (0)