From: Eric Blake <eblake@redhat.com>
To: libguestfs@redhat.com
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, nbd@other.debian.org
Subject: Re: [Qemu-devel] [Libguestfs] [nbdkit PATCH 3/3] plugins: Add .can_fast_zero hook
Date: Fri, 23 Aug 2019 16:16:18 -0500 [thread overview]
Message-ID: <0f743b37-6308-24d0-eae0-5f939af9dae2@redhat.com> (raw)
In-Reply-To: <20190823144054.27420-4-eblake@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 1938 bytes --]
On 8/23/19 9:40 AM, Eric Blake wrote:
> Allow plugins to affect the handling of the new NBD_CMD_FLAG_FAST_ZERO
> flag, then update affected plugins. In particular, in-memory plugins
> are always fast; the full plugin is better served by omitting .zero
> and relying on .pwrite fallback; nbd takes advantage of libnbd
> extensions proposed in parallel to pass through support; and
> v2 language bindings expose the choice to their scripts.
>
> +++ b/server/plugins.c
> @@ -404,11 +404,25 @@ plugin_can_zero (struct backend *b, struct connection *conn)
> static int
> plugin_can_fast_zero (struct backend *b, struct connection *conn)
> {
> + struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
> + int r;
> +
> assert (connection_get_handle (conn, 0));
>
> debug ("can_fast_zero");
>
> - return 0; /* Upcoming patch will actually add support. */
> + if (p->plugin.can_fast_zero)
> + return p->plugin.can_fast_zero (connection_get_handle (conn, 0));
> + /* Advertise support for fast zeroes if no .zero or .can_zero is
> + * false: in those cases, we fail fast instead of using .pwrite.
> + * This also works when v1 plugin has only ._zero_old.
> + */
> + if (p->plugin.zero == NULL)
> + return 1;
> + r = plugin_can_zero (b, conn);
> + if (r == -1)
> + return -1;
> + return !r;
> }
>
Needs this squashed in for libnbd to pass rather than skip its new
'can-fast-zero-flag' test:
diff --git i/server/plugins.c w/server/plugins.c
index 84329cf4..695a77ab 100644
--- i/server/plugins.c
+++ w/server/plugins.c
@@ -208,6 +208,7 @@ plugin_dump_fields (struct backend *b)
HAS (can_cache);
HAS (cache);
HAS (thread_model);
+ HAS (can_fast_zero);
#undef HAS
/* Custom fields. */
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-08-23 21:18 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 14:30 [Qemu-devel] cross-project patches: Add NBD Fast Zero support Eric Blake
2019-08-23 14:34 ` [Qemu-devel] [PATCH 0/1] NBD protocol change to add fast zero support Eric Blake
2019-08-23 14:34 ` [Qemu-devel] [PATCH 1/1] protocol: Add NBD_CMD_FLAG_FAST_ZERO Eric Blake
2019-08-23 18:48 ` Wouter Verhelst
2019-08-23 18:58 ` Eric Blake
2019-08-24 6:44 ` Wouter Verhelst
2019-08-28 9:57 ` Vladimir Sementsov-Ogievskiy
2019-08-28 13:04 ` Eric Blake
2019-08-28 13:45 ` Vladimir Sementsov-Ogievskiy
2019-09-03 20:53 ` [Qemu-devel] [Libguestfs] [PATCH 0/1] NBD protocol change to add fast zero support Eric Blake
2019-08-23 14:37 ` [Qemu-devel] [PATCH 0/5] Add NBD fast zero support to qemu client and server Eric Blake
2019-08-23 14:37 ` [Qemu-devel] [PATCH 1/5] nbd: Improve per-export flag handling in server Eric Blake
2019-08-30 18:00 ` Vladimir Sementsov-Ogievskiy
2019-08-30 23:10 ` Eric Blake
2019-08-30 23:32 ` Eric Blake
2019-09-03 16:39 ` Eric Blake
2019-09-04 17:08 ` Vladimir Sementsov-Ogievskiy
2019-08-23 14:37 ` [Qemu-devel] [PATCH 2/5] nbd: Prepare for NBD_CMD_FLAG_FAST_ZERO Eric Blake
2019-08-30 18:07 ` Vladimir Sementsov-Ogievskiy
2019-08-30 23:37 ` Eric Blake
2019-08-31 8:11 ` Vladimir Sementsov-Ogievskiy
2019-09-03 18:49 ` Eric Blake
2019-08-31 8:20 ` Vladimir Sementsov-Ogievskiy
2019-08-23 14:37 ` [Qemu-devel] [PATCH 3/5] nbd: Implement client use of NBD FAST_ZERO Eric Blake
2019-08-30 18:11 ` Vladimir Sementsov-Ogievskiy
2019-08-23 14:37 ` [Qemu-devel] [PATCH 4/5] nbd: Implement server " Eric Blake
2019-08-30 18:40 ` Vladimir Sementsov-Ogievskiy
2019-08-23 14:37 ` [Qemu-devel] [PATCH 5/5] nbd: Tolerate more errors to structured reply request Eric Blake
2019-08-23 16:41 ` Eric Blake
2019-08-28 13:55 ` [Qemu-devel] [PATCH 0/5] Add NBD fast zero support to qemu client and server Vladimir Sementsov-Ogievskiy
2019-08-28 14:05 ` Eric Blake
2019-08-23 14:38 ` [Qemu-devel] [libnbd PATCH 0/1] libnbd support for new fast zero Eric Blake
2019-08-23 14:38 ` [Qemu-devel] [libnbd PATCH 1/1] api: Add support for FAST_ZERO flag Eric Blake
2019-08-27 12:25 ` [Qemu-devel] [Libguestfs] " Richard W.M. Jones
2019-08-23 14:40 ` [Qemu-devel] [nbdkit PATCH 0/3] nbdkit support for new NBD fast zero Eric Blake
2019-08-23 14:40 ` [Qemu-devel] [nbdkit PATCH 1/3] server: Add internal support for NBDKIT_FLAG_FAST_ZERO Eric Blake
2019-08-23 14:40 ` [Qemu-devel] [nbdkit PATCH 2/3] filters: Add .can_fast_zero hook Eric Blake
2019-08-23 14:40 ` [Qemu-devel] [nbdkit PATCH 3/3] plugins: " Eric Blake
2019-08-23 21:16 ` Eric Blake [this message]
2019-08-27 15:43 ` [Qemu-devel] [Libguestfs] " Richard W.M. Jones
2019-08-23 15:05 ` [Qemu-devel] cross-project patches: Add NBD Fast Zero support Vladimir Sementsov-Ogievskiy
2019-08-27 12:14 ` [Qemu-devel] [Libguestfs] " Richard W.M. Jones
2019-08-27 13:23 ` Eric Blake
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=0f743b37-6308-24d0-eae0-5f939af9dae2@redhat.com \
--to=eblake@redhat.com \
--cc=libguestfs@redhat.com \
--cc=nbd@other.debian.org \
--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).