diff options
author | Chirantan Ekbote <chirantan@chromium.org> | 2020-03-09 18:46:55 +0900 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-16 15:12:52 +0000 |
commit | 752f9c28703e447ab5b127cbac94493a7539eb36 (patch) | |
tree | 4dc306620ede4c0aa563e0ce73ad94c378c8fd15 /devices | |
parent | cba39f2fefc7dd1f38ffdae8451e530f16c06038 (diff) | |
download | crosvm-752f9c28703e447ab5b127cbac94493a7539eb36.tar crosvm-752f9c28703e447ab5b127cbac94493a7539eb36.tar.gz crosvm-752f9c28703e447ab5b127cbac94493a7539eb36.tar.bz2 crosvm-752f9c28703e447ab5b127cbac94493a7539eb36.tar.lz crosvm-752f9c28703e447ab5b127cbac94493a7539eb36.tar.xz crosvm-752f9c28703e447ab5b127cbac94493a7539eb36.tar.zst crosvm-752f9c28703e447ab5b127cbac94493a7539eb36.zip |
devices: Ignore O_DIRECT in 9p and fs devices
Specifying O_DIRECT in the 9p device doesn't actually work correctly and leads to an error. O_DIRECT handling in the fs device works correctly but also makes it look much worse in disk I/O benchmarks because the block device gets the benefit of the host cache while the fs device depends on the performance of the actual storage device. BUG=none TEST=`tast run vm.Fio.*` Change-Id: I738e4032081e331ef956c9d4c33616607e403d86 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2093967 Commit-Queue: Chirantan Ekbote <chirantan@chromium.org> Tested-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'devices')
-rw-r--r-- | devices/src/virtio/fs/passthrough.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/devices/src/virtio/fs/passthrough.rs b/devices/src/virtio/fs/passthrough.rs index bdc1c6f..d23009b 100644 --- a/devices/src/virtio/fs/passthrough.rs +++ b/devices/src/virtio/fs/passthrough.rs @@ -395,7 +395,7 @@ impl PassthroughFs { libc::openat( self.proc.as_raw_fd(), pathname.as_ptr(), - (flags | libc::O_CLOEXEC) & (!libc::O_NOFOLLOW), + (flags | libc::O_CLOEXEC) & !(libc::O_NOFOLLOW | libc::O_DIRECT), ) }; if fd < 0 { @@ -965,7 +965,8 @@ impl FileSystem for PassthroughFs { libc::openat( data.file.as_raw_fd(), name.as_ptr(), - flags as i32 | libc::O_CREAT | libc::O_CLOEXEC | libc::O_NOFOLLOW, + (flags as i32 | libc::O_CREAT | libc::O_CLOEXEC | libc::O_NOFOLLOW) + & !libc::O_DIRECT, mode & !(umask & 0o777), ) }; |