linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: fuse: Switch to using async direct IO in fuse_direct_read/write_iter
@ 2018-10-27 16:48 Martin Raiber
  2019-01-24  8:52 ` Miklos Szeredi
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Raiber @ 2018-10-27 16:48 UTC (permalink / raw)
  To: linux-fsdevel, Miklos Szeredi

Switch to using the async directo IO code path in fuse_direct_read_iter
and fuse_direct_write_iter. This is especially important in connection
with loop devices with direct IO enabled as loop assumes async direct io
is actually async

---
 fs/fuse/file.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 32d0b883e74f..c2f5491aced9 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1426,6 +1426,14 @@ static ssize_t __fuse_direct_read(struct fuse_io_priv *io,
 static ssize_t fuse_direct_read_iter(struct kiocb *iocb, struct iov_iter *to)
 {
 	struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(iocb);
+	if(!is_sync_kiocb(iocb) && iocb->ki_flags & IOCB_DIRECT) {
+		struct file *file = iocb->ki_filp;
+		struct inode *inode = file_inode(file);
+
+		if (is_bad_inode(inode))
+			return -EIO;
+		return inode->i_data.a_ops->direct_IO(iocb, to);
+	}
 	return __fuse_direct_read(&io, to, &iocb->ki_pos);
 }
 
@@ -1441,6 +1449,11 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	/* Don't allow parallel writes to the same file */
 	inode_lock(inode);
 	res = generic_write_checks(iocb, from);
+	if(res>0 && !is_sync_kiocb(iocb) && iocb->ki_flags & IOCB_DIRECT)
+	{
+		inode_unlock(inode);
+		return inode->i_data.a_ops->direct_IO(iocb, from);
+	}
 	if (res > 0)
 		res = fuse_direct_io(&io, from, &iocb->ki_pos, FUSE_DIO_WRITE);
 	fuse_invalidate_attr(inode);
-- 
2.11.0.windows.1

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

* Re: [PATCH] fs: fuse: Switch to using async direct IO in fuse_direct_read/write_iter
  2018-10-27 16:48 [PATCH] fs: fuse: Switch to using async direct IO in fuse_direct_read/write_iter Martin Raiber
@ 2019-01-24  8:52 ` Miklos Szeredi
  2019-01-24 12:48   ` Martin Raiber
  0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2019-01-24  8:52 UTC (permalink / raw)
  To: Martin Raiber; +Cc: linux-fsdevel

On Sat, Oct 27, 2018 at 6:48 PM Martin Raiber <martin@urbackup.org> wrote:
>
> Switch to using the async directo IO code path in fuse_direct_read_iter
> and fuse_direct_write_iter. This is especially important in connection
> with loop devices with direct IO enabled as loop assumes async direct io
> is actually async

Missing Signed-off-by tag.  Can I add it for you?

Thanks,
Miklos

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

* Re: [PATCH] fs: fuse: Switch to using async direct IO in fuse_direct_read/write_iter
  2019-01-24  8:52 ` Miklos Szeredi
@ 2019-01-24 12:48   ` Martin Raiber
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Raiber @ 2019-01-24 12:48 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel

On 24.01.2019 09:52 Miklos Szeredi wrote:
> On Sat, Oct 27, 2018 at 6:48 PM Martin Raiber <martin@urbackup.org> wrote:
>> Switch to using the async directo IO code path in fuse_direct_read_iter
>> and fuse_direct_write_iter. This is especially important in connection
>> with loop devices with direct IO enabled as loop assumes async direct io
>> is actually async
> Missing Signed-off-by tag.  Can I add it for you?
>
> Thanks,
> Miklos

Sure, thanks!


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

end of thread, other threads:[~2019-01-24 12:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-27 16:48 [PATCH] fs: fuse: Switch to using async direct IO in fuse_direct_read/write_iter Martin Raiber
2019-01-24  8:52 ` Miklos Szeredi
2019-01-24 12:48   ` Martin Raiber

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