From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 3/5] raw_bsd: Don't advertise flags not supported by protocol layer
Date: Mon, 20 Jun 2016 17:39:27 -0600 [thread overview]
Message-ID: <1466465969-25315-4-git-send-email-eblake@redhat.com> (raw)
In-Reply-To: <1466465969-25315-1-git-send-email-eblake@redhat.com>
The raw format layer supports all flags via passthrough - but
it only makes sense to pass through flags that the lower layer
actually supports.
Thanks to the previous patch, the raw format layer now attempts
to fragment writes at the max_transfer limit it inherits from
the NBD protocol layer, recently set to 32m. An attempt to do
'w -f 0 40m' to an NBD server that lacks FUA thus changed from
flushing once (after NBD fragmented a single 40m write itself)
to instead flushing twice (the format layer sees BDRV_REQ_FUA
in supported_write_flags, so it sends the flag on to both
fragments, and then the block layer emulates FUA by flushing
for both the 32m and 8m fragments at the protocol layer).
This patch fixes the performance regression (now that the
format layer no longer advertises a flag not present at the
protocol layer, the flush to emulate FUA is deferred to the
last fragment).
Note that 'w -f -z 0 40m' does not currently exhibit the same
problem, because there, the fragmentation does not occur until
at the NBD layer (the raw layer has .bdrv_co_pwrite_zeroes, and
the NBD layer doesn't advertise max_pwrite_zeroes to constrain
things at the raw layer) - but that problem is latent and would
have the same problem with too many flushes without this patch
once the NBD layer implements support for using the new
NBD_CMD_WRITE_ZEROES and sets max_pwrite_zeroes to the same 32m
limit as recommended by the NBD protocol.
Signed-off-by: Eric Blake <eblake@redhat.com>
---
block/raw_bsd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/raw_bsd.c b/block/raw_bsd.c
index 351ed2a..47a8352 100644
--- a/block/raw_bsd.c
+++ b/block/raw_bsd.c
@@ -197,8 +197,10 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
bs->sg = bs->file->bs->sg;
- bs->supported_write_flags = BDRV_REQ_FUA;
- bs->supported_zero_flags = BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP;
+ bs->supported_write_flags = BDRV_REQ_FUA &
+ bs->file->bs->supported_write_flags;
+ bs->supported_zero_flags = (BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
+ bs->file->bs->supported_zero_flags;
if (bs->probed && !bdrv_is_read_only(bs)) {
fprintf(stderr,
--
2.5.5
next prev parent reply other threads:[~2016-06-20 23:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 23:39 [Qemu-devel] [PATCH 0/5] Auto-fragment large transactions at the block layer Eric Blake
2016-06-20 23:39 ` [Qemu-devel] [PATCH 1/5] block: Fragment reads to max transfer length Eric Blake
2016-07-08 10:56 ` Kevin Wolf
2016-07-08 14:31 ` Eric Blake
2016-06-20 23:39 ` [Qemu-devel] [PATCH 2/5] block: Fragment writes " Eric Blake
2016-06-20 23:39 ` Eric Blake [this message]
2016-07-08 11:05 ` [Qemu-devel] [PATCH 3/5] raw_bsd: Don't advertise flags not supported by protocol layer Kevin Wolf
2016-07-08 14:32 ` Eric Blake
2016-06-20 23:39 ` [Qemu-devel] [PATCH 4/5] nbd: Rely on block layer to break up large requests Eric Blake
2016-06-20 23:39 ` [Qemu-devel] [PATCH 5/5] nbd: Drop unused offset parameter Eric Blake
2016-07-08 11:11 ` Kevin Wolf
2016-06-21 3:19 ` [Qemu-devel] [PATCH 6/5] iscsi: Rely on block layer to break up large requests Eric Blake
2016-06-21 4:17 ` [Qemu-devel] [PATCH 0/5] Auto-fragment large transactions at the block layer Eric Blake
2016-06-21 10:23 ` Stefan Hajnoczi
2016-06-21 10:43 ` Kevin Wolf
2016-06-22 11:41 ` Stefan Hajnoczi
2016-06-21 22:05 ` Eric Blake
2016-06-22 11:41 ` Stefan Hajnoczi
2016-06-22 5:54 ` Fam Zheng
2016-07-06 2:04 ` Eric Blake
2016-07-08 11:15 ` Kevin Wolf
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=1466465969-25315-4-git-send-email-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@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).