From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eric Blake <eblake@redhat.com>, qemu-stable@nongnu.org
Subject: [Qemu-devel] [PULL 2/3] nbd: Allow unmap and fua during write zeroes
Date: Tue, 22 Nov 2016 23:27:55 +0100 [thread overview]
Message-ID: <1479853676-35995-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1479853676-35995-1-git-send-email-pbonzini@redhat.com>
From: Eric Blake <eblake@redhat.com>
Commit fa778fff wired up support to send the NBD_CMD_WRITE_ZEROES,
but forgot to inform the block layer that FUA unmapping of zeroes is
supported. Without BDRV_REQ_MAY_UNMAP listed as a supported flag,
the block layer will always insist on the NBD layer passing
NBD_CMD_FLAG_NO_HOLE, resulting in the server always allocating
things even when it was desired to let the server punch holes.
Similarly, failing to set BDRV_REQ_FUA means that the client may
send unnecessary NBD_CMD_FLUSH when it could have instead used the
NBD_CMD_FLAG_FUA bit.
CC: qemu-stable@nongnu.org
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1479413642-22463-2-git-send-email-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block/nbd-client.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/nbd-client.c b/block/nbd-client.c
index 2a302de..3779c6c 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -415,6 +415,10 @@ int nbd_client_init(BlockDriverState *bs,
}
if (client->nbdflags & NBD_FLAG_SEND_FUA) {
bs->supported_write_flags = BDRV_REQ_FUA;
+ bs->supported_zero_flags |= BDRV_REQ_FUA;
+ }
+ if (client->nbdflags & NBD_FLAG_SEND_WRITE_ZEROES) {
+ bs->supported_zero_flags |= BDRV_REQ_MAY_UNMAP;
}
qemu_co_mutex_init(&client->send_mutex);
--
1.8.3.1
next prev parent reply other threads:[~2016-11-22 22:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 22:27 [Qemu-devel] [PULL 0/3] Misc fixes for QEMU 2.8.0-rc1 Paolo Bonzini
2016-11-22 22:27 ` [Qemu-devel] [PULL 1/3] cpu_ldst.h: use correct guest address parameter Paolo Bonzini
2016-11-22 22:27 ` Paolo Bonzini [this message]
2016-11-22 22:27 ` [Qemu-devel] [PULL 3/3] scsi/esp: do not raise an interrupt when reading the FIFO register Paolo Bonzini
2016-11-23 11:44 ` [Qemu-devel] [PULL 0/3] Misc fixes for QEMU 2.8.0-rc1 Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479853676-35995-3-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).