qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Eric Blake <eblake@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
	"nbd@other.debian.org" <nbd@other.debian.org>,
	"libguestfs@redhat.com" <libguestfs@redhat.com>,
	"open list:Network Block Dev..." <qemu-block@nongnu.org>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/5] nbd: Prepare for NBD_CMD_FLAG_FAST_ZERO
Date: Fri, 30 Aug 2019 18:07:23 +0000	[thread overview]
Message-ID: <9476b1d1-47e4-ecfd-eb23-5b2fbc1410e3@virtuozzo.com> (raw)
In-Reply-To: <20190823143726.27062-3-eblake@redhat.com>

23.08.2019 17:37, Eric Blake wrote:
> Commit fe0480d6 and friends added BDRV_REQ_NO_FALLBACK as a way to
> avoid wasting time on a preliminary write-zero request that will later
> be rewritten by actual data, if it is known that the write-zero
> request will use a slow fallback; but in doing so, could not optimize
> for NBD.  The NBD specification is now considering an extension that
> will allow passing on those semantics; this patch updates the new
> protocol bits and 'qemu-nbd --list' output to recognize the bit, as
> well as the new errno value possible when using the new flag; while
> upcoming patches will improve the client to use the feature when
> present, and the server to advertise support for it.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>   docs/interop/nbd.txt | 3 ++-
>   include/block/nbd.h  | 4 ++++
>   nbd/common.c         | 5 +++++
>   nbd/server.c         | 2 ++
>   qemu-nbd.c           | 1 +
>   5 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/interop/nbd.txt b/docs/interop/nbd.txt
> index 6dfec7f47647..45118809618e 100644
> --- a/docs/interop/nbd.txt
> +++ b/docs/interop/nbd.txt
> @@ -53,4 +53,5 @@ the operation of that feature.
>   * 2.12: NBD_CMD_BLOCK_STATUS for "base:allocation"
>   * 3.0: NBD_OPT_STARTTLS with TLS Pre-Shared Keys (PSK),
>   NBD_CMD_BLOCK_STATUS for "qemu:dirty-bitmap:", NBD_CMD_CACHE
> -* 4.2: NBD_FLAG_CAN_MULTI_CONN for sharable read-only exports
> +* 4.2: NBD_FLAG_CAN_MULTI_CONN for sharable read-only exports,
> +NBD_CMD_FLAG_FAST_ZERO
> diff --git a/include/block/nbd.h b/include/block/nbd.h
> index 2c87b42dfd48..21550747cf35 100644
> --- a/include/block/nbd.h
> +++ b/include/block/nbd.h
> @@ -140,6 +140,7 @@ enum {
>       NBD_FLAG_CAN_MULTI_CONN_BIT     =  8, /* Multi-client cache consistent */
>       NBD_FLAG_SEND_RESIZE_BIT        =  9, /* Send resize */
>       NBD_FLAG_SEND_CACHE_BIT         = 10, /* Send CACHE (prefetch) */
> +    NBD_FLAG_SEND_FAST_ZERO_BIT     = 11, /* FAST_ZERO flag for WRITE_ZEROES */
>   };
> 
>   #define NBD_FLAG_HAS_FLAGS         (1 << NBD_FLAG_HAS_FLAGS_BIT)
> @@ -153,6 +154,7 @@ enum {
>   #define NBD_FLAG_CAN_MULTI_CONN    (1 << NBD_FLAG_CAN_MULTI_CONN_BIT)
>   #define NBD_FLAG_SEND_RESIZE       (1 << NBD_FLAG_SEND_RESIZE_BIT)
>   #define NBD_FLAG_SEND_CACHE        (1 << NBD_FLAG_SEND_CACHE_BIT)
> +#define NBD_FLAG_SEND_FAST_ZERO    (1 << NBD_FLAG_SEND_FAST_ZERO_BIT)
> 
>   /* New-style handshake (global) flags, sent from server to client, and
>      control what will happen during handshake phase. */
> @@ -205,6 +207,7 @@ enum {
>   #define NBD_CMD_FLAG_DF         (1 << 2) /* don't fragment structured read */
>   #define NBD_CMD_FLAG_REQ_ONE    (1 << 3) /* only one extent in BLOCK_STATUS
>                                             * reply chunk */
> +#define NBD_CMD_FLAG_FAST_ZERO  (1 << 4) /* fail if WRITE_ZEROES is not fast */
> 
>   /* Supported request types */
>   enum {
> @@ -270,6 +273,7 @@ static inline bool nbd_reply_type_is_error(int type)
>   #define NBD_EINVAL     22
>   #define NBD_ENOSPC     28
>   #define NBD_EOVERFLOW  75
> +#define NBD_ENOTSUP    95
>   #define NBD_ESHUTDOWN  108
> 
>   /* Details collected by NBD_OPT_EXPORT_NAME and NBD_OPT_GO */
> diff --git a/nbd/common.c b/nbd/common.c
> index cc8b278e541d..ddfe7d118371 100644
> --- a/nbd/common.c
> +++ b/nbd/common.c
> @@ -201,6 +201,8 @@ const char *nbd_err_lookup(int err)
>           return "ENOSPC";
>       case NBD_EOVERFLOW:
>           return "EOVERFLOW";
> +    case NBD_ENOTSUP:
> +        return "ENOTSUP";
>       case NBD_ESHUTDOWN:
>           return "ESHUTDOWN";
>       default:
> @@ -231,6 +233,9 @@ int nbd_errno_to_system_errno(int err)
>       case NBD_EOVERFLOW:
>           ret = EOVERFLOW;
>           break;
> +    case NBD_ENOTSUP:
> +        ret = ENOTSUP;
> +        break;
>       case NBD_ESHUTDOWN:
>           ret = ESHUTDOWN;
>           break;
> diff --git a/nbd/server.c b/nbd/server.c
> index b5577828aa44..981bc3cb1151 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -55,6 +55,8 @@ static int system_errno_to_nbd_errno(int err)
>           return NBD_ENOSPC;
>       case EOVERFLOW:
>           return NBD_EOVERFLOW;
> +    case ENOTSUP:
> +        return NBD_ENOTSUP;

This may provoke returning NBD_ENOTSUP in other cases, not only new one we are going to add.

>       case ESHUTDOWN:
>           return NBD_ESHUTDOWN;
>       case EINVAL:
> diff --git a/qemu-nbd.c b/qemu-nbd.c
> index 079702bb837f..dce52f564b5a 100644
> --- a/qemu-nbd.c
> +++ b/qemu-nbd.c
> @@ -294,6 +294,7 @@ static int qemu_nbd_client_list(SocketAddress *saddr, QCryptoTLSCreds *tls,
>                   [NBD_FLAG_CAN_MULTI_CONN_BIT]       = "multi",
>                   [NBD_FLAG_SEND_RESIZE_BIT]          = "resize",
>                   [NBD_FLAG_SEND_CACHE_BIT]           = "cache",
> +                [NBD_FLAG_SEND_FAST_ZERO_BIT]       = "fast-zero",
>               };
> 
>               printf("  size:  %" PRIu64 "\n", list[i].size);
> 


-- 
Best regards,
Vladimir

  reply	other threads:[~2019-08-30 18:10 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 [this message]
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     ` [Qemu-devel] [Libguestfs] " Eric Blake
2019-08-27 15:43     ` 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=9476b1d1-47e4-ecfd-eb23-5b2fbc1410e3@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=libguestfs@redhat.com \
    --cc=mreitz@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).