On Sat, Apr 11, 2020 at 04:35:44AM -0400, Catherine Ho wrote: > @@ -1702,10 +1703,11 @@ static void update_open_flags(int writeback, struct fuse_file_info *fi) > > /* > * O_DIRECT in guest should not necessarily mean bypassing page > - * cache on host as well. If somebody needs that behavior, it > - * probably should be a configuration knob in daemon. > + * cache on host as well. If cache=none, keep the flag unchanged > */ > - fi->flags &= ~O_DIRECT; > + if (cache_mode != CACHE_NONE) { > + fi->flags &= ~O_DIRECT; > + } > } > Thanks for the patch! I have CCed the virtio-fs mailing list so more people see it. Please add a new command-line option to control O_DIRECT behavior. There are two cases: 1. O_DIRECT bypasses the guest page cache but not the host page cache. This makes sense when the DAX feature is enabled. 2. O_DIRECT bypasses both the guest and host page cache. This make sense for non-DAX and for I/O performance benchmarking. Today only #1 is supported. Your patch makes the behavior dependent on the cache mode option, but the cache mode doesn't necessarily determine how O_DIRECT should be handled. For example, in the DAX case the guest page cache is bypassed and cache=none can be used, but we do want to use the host page cache. You can add a new option so that O_DIRECT handling is configurable for all cases. Stefan