[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 8/9] nbd: Implement client use of NBD FAST_ZERO
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PULL 8/9] nbd: Implement client use of NBD FAST_ZERO |
Date: |
Thu, 5 Sep 2019 13:21:31 -0500 |
The client side is fairly straightforward: if the server advertised
fast zero support, then we can map that to BDRV_REQ_NO_FALLBACK
support. A server that advertises FAST_ZERO but not WRITE_ZEROES
is technically broken, but we can ignore that situation as it does
not change our behavior.
Signed-off-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
block/nbd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/block/nbd.c b/block/nbd.c
index c4c91a158602..813c40d8f067 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1044,6 +1044,10 @@ static int nbd_client_co_pwrite_zeroes(BlockDriverState
*bs, int64_t offset,
if (!(flags & BDRV_REQ_MAY_UNMAP)) {
request.flags |= NBD_CMD_FLAG_NO_HOLE;
}
+ if (flags & BDRV_REQ_NO_FALLBACK) {
+ assert(s->info.flags & NBD_FLAG_SEND_FAST_ZERO);
+ request.flags |= NBD_CMD_FLAG_FAST_ZERO;
+ }
if (!bytes) {
return 0;
@@ -1239,6 +1243,9 @@ static int nbd_client_connect(BlockDriverState *bs, Error
**errp)
}
if (s->info.flags & NBD_FLAG_SEND_WRITE_ZEROES) {
bs->supported_zero_flags |= BDRV_REQ_MAY_UNMAP;
+ if (s->info.flags & NBD_FLAG_SEND_FAST_ZERO) {
+ bs->supported_zero_flags |= BDRV_REQ_NO_FALLBACK;
+ }
}
s->sioc = sioc;
--
2.21.0
- [Qemu-devel] [PULL 0/9] NBD patches through 2019-09-05, Eric Blake, 2019/09/05
- [Qemu-devel] [PULL 1/9] nbd: Advertise multi-conn for shared read-only connections, Eric Blake, 2019/09/05
- [Qemu-devel] [PULL 2/9] nbd: Use g_autofree in a few places, Eric Blake, 2019/09/05
- [Qemu-devel] [PULL 3/9] nbd: Tolerate more errors to structured reply request, Eric Blake, 2019/09/05
- [Qemu-devel] [PULL 4/9] block: workaround for unaligned byte range in fallocate(), Eric Blake, 2019/09/05
- [Qemu-devel] [PULL 5/9] docs: Update preferred NBD device syntax, Eric Blake, 2019/09/05
- [Qemu-devel] [PULL 8/9] nbd: Implement client use of NBD FAST_ZERO,
Eric Blake <=
- [Qemu-devel] [PULL 7/9] nbd: Prepare for NBD_CMD_FLAG_FAST_ZERO, Eric Blake, 2019/09/05
- [Qemu-devel] [PULL 6/9] nbd: Improve per-export flag handling in server, Eric Blake, 2019/09/05
- [Qemu-devel] [PULL 9/9] nbd: Implement server use of NBD FAST_ZERO, Eric Blake, 2019/09/05
- Re: [Qemu-devel] [PULL 0/9] NBD patches through 2019-09-05, Eric Blake, 2019/09/05