[PATCH 1/2][SRU][Disco] UBUNTU: SAUCE: shiftfs: add O_DIRECT support
Christian Brauner
christian at brauner.io
Fri Jul 19 15:50:46 UTC 2019
BugLink: https://bugs.launchpad.net/bugs/1837223
This enabled O_DIRECT support for shiftfs if the underlay supports it.
Currently shiftfs does not handle O_DIRECT if the underlay supports it.
This is blocking dqlite - an essential part of LXD - from profiting from
the performance benefits of O_DIRECT on suitable filesystems when used
with async io such as aio or io_uring.
Overlayfs cannot support this directly since the upper filesystem in
overlay can be any filesystem. So if the upper filesystem does not
support O_DIRECT but the lower filesystem does you're out of luck.
Shiftfs does not suffer from the same problem since there is not concept
of an upper filesystem in the same way that overlayfs has it.
Essentially, shiftfs is a transparent shim relaying everything to the
underlay while overlayfs' upper layer is not (completely).
Cc: Seth Forshee <seth.forshee at canonical.com>
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
fs/shiftfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/shiftfs.c b/fs/shiftfs.c
index 49f6714e9f95..addaa6e21e57 100644
--- a/fs/shiftfs.c
+++ b/fs/shiftfs.c
@@ -1126,6 +1126,9 @@ static int shiftfs_open(struct inode *inode, struct file *file)
}
file->private_data = file_info;
+ /* For O_DIRECT dentry_open() checks f_mapping->a_ops->direct_IO. */
+ file->f_mapping = realfile->f_mapping;
+
file_info->realfile = realfile;
return 0;
}
--
2.22.0
More information about the kernel-team
mailing list