Am 18.04.2023 um 08:05 hat [email protected] geschrieben:
> From: zhoushl <[email protected]>
> 
> Signed-off-by: zhoushl <[email protected]>
> 
>  block/file-posix.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 5760cf22d1..fe9568947c 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -1399,6 +1399,12 @@ static int handle_aiocb_flush(void *opaque)
>          return -s->page_cache_inconsistent;
>      }
>  
> +#ifdef CONFIG_LINUX_AIO
> +    if (s->use_linux_aio && (s->open_flags & O_DIRECT)) {
> +        return 0;
> +    }
> +#endif
> +
>      ret = qemu_fdatasync(aiocb->aio_fildes);
>      if (ret == -1) {
>          trace_file_flush_fdatasync_failed(errno);

As you didn't care to write a commit message that explains why you think
you don't need flushes in this specific case, I can't say much more than
that it is wrong. O_DIRECT bypasses the kernel page cache, but not any
lower level caches such as a volatile disk cache. So you still need to
flush before you can be sure that data is stable on disk.

Kevin


Reply via email to