[Qemu-devel] [PATCH] file-posix: Fix has_write_zeroes after NO_FALLBACK

Kevin Wolf posted 1 patch 6 years, 2 months ago
Test FreeBSD passed
Test docker-mingw@fedora passed
Test asan passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test s390x failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190816095528.16224-1-kwolf@redhat.com
Maintainers: Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
block/file-posix.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[Qemu-devel] [PATCH] file-posix: Fix has_write_zeroes after NO_FALLBACK
Posted by Kevin Wolf 6 years, 2 months ago
If QEMU_AIO_NO_FALLBACK is given, we always return failure and don't
even try to use the BLKZEROOUT ioctl. In this failure case, we shouldn't
disable has_write_zeroes because we didn't learn anything about the
ioctl. The next request might not set QEMU_AIO_NO_FALLBACK and we can
still use the ioctl then.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/file-posix.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index b8b4dad553..e927f9d3c3 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1555,12 +1555,12 @@ static ssize_t handle_aiocb_write_zeroes_block(RawPosixAIOData *aiocb)
         } while (errno == EINTR);
 
         ret = translate_err(-errno);
+        if (ret == -ENOTSUP) {
+            s->has_write_zeroes = false;
+        }
     }
 #endif
 
-    if (ret == -ENOTSUP) {
-        s->has_write_zeroes = false;
-    }
     return ret;
 }
 
-- 
2.20.1


Re: [Qemu-devel] [PATCH] file-posix: Fix has_write_zeroes after NO_FALLBACK
Posted by Eric Blake 6 years, 2 months ago
On 8/16/19 4:55 AM, Kevin Wolf wrote:
> If QEMU_AIO_NO_FALLBACK is given, we always return failure and don't
> even try to use the BLKZEROOUT ioctl. In this failure case, we shouldn't
> disable has_write_zeroes because we didn't learn anything about the
> ioctl. The next request might not set QEMU_AIO_NO_FALLBACK and we can
> still use the ioctl then.
> 
> Reported-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/file-posix.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>
Fixes: 738301e1175

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org