* jiangyiwen (jiangyiwen@huawei.com) wrote:
On 2019/1/10 23:57, Vivek Goyal wrote:
On Thu, Dec 27, 2018 at 10:57:21AM +0800, jiangyiwen wrote:
[..]
what do I mean by "I filter O_DIRECT flag in libfuse-daemon"?
I modify passthrough_ll.c code and ignore O_DIRECT flag when opening file, then it return success. The codes as follows: diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c index 3e37dbd..9edb5bb 100644 --- a/example/passthrough_ll.c +++ b/example/passthrough_ll.c @@ -1234,7 +1234,7 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi) fi->flags &= ~O_APPEND;
sprintf(buf, "/proc/self/fd/%i", lo_fd(req, ino)); - fd = open(buf, fi->flags & ~O_NOFOLLOW); + fd = open(buf, fi->flags & ~(O_NOFOLLOW | O_DIRECT)); if (fd == -1) return (void) fuse_reply_err(req, errno);
Hi Yiwen,
Ok, this issue is now fixed. We still do not ignore O_DIRECT flag on host. I think if file is opened with O_DIRECT in guest, then it makes sense to open with O_DIRECT on host as well.
We were getting -EINVAL (-22) due to misaligned buffers. We were creating extra data copy in libfuse daemon and that copy created misalignment.
David Gilbert has now fixed it. He has got rid of that extra copy and that means if guest hands over aligned buffers, I/O should succeed. This should also result in some speed up on write path as one extra copy has been avoided.
These fixes are still internal. David might push these externally soon.
Thanks Vivek
.
Hi Vivek,
Great, I am glad to test it if this patch is pushed.
Hi Yiwen, That's now pushed to the 'dev' branch, here: https://gitlab.com/virtio-fs/libfuse/commits/dev it's only lightly tested and has a few rough edges, but seems to work! Dave
Thanks, Yiwen.
-- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK