[Libguestfs] [libnbd PATCH v3 00/22] NBD 64-bit extensions (libnbd portion)

Eric Blake eblake at redhat.com
Thu May 25 13:00:46 UTC 2023


v2 was here:
https://listman.redhat.com/archives/libguestfs/2022-November/030292.html

For v3, there are now approved specs to code to:
https://listman.redhat.com/archives/libguestfs/2023-April/031251.html
visible on an upstream branch at
https://github.com/NetworkBlockDevice/nbd/blob/extension-ext-header/doc/proto.md
(upstream leaves extensions in a branch state until there are multiple
implementations that comply with that extension)

as well as interoperability with counterpart qemu patches:
https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg03607.html
also available at
https://repo.or.cz/qemu/ericb.git/shortlog/refs/tags/exthdr-v3

I'm still working on adding extended header support into nbdkit, which
will involve adding a v3 protocol for plugins; that work is probably
much further out.

Changes since v2:
001/22:[0002] [FC] 'block_status: Refactor array storage'
002/22:[0016] [FC] 'internal: Refactor layout of replies in sbuf'
003/22:[0002] [FC] 'protocol: Add definitions for extended headers'
004/22:[0006] [FC] 'states: Prepare to send 64-bit requests'
005/22:[0013] [FC] 'states: Prepare to receive 64-bit replies'
006/22:[0007] [FC] 'states: Break deadlock if server goofs on extended replies'
007/22:[0021] [FC] 'generator: Add struct nbd_extent in prep for 64-bit extents'
008/22:[----] [-C] 'block_status: Track 64-bit extents internally'
009/22:[0012] [FC] 'block_status: Accept 64-bit extents during block status'
010/22:[0063] [FC] 'api: Add [aio_]nbd_block_status_64'
011/22:[0006] [FC] 'api: Add several functions for controlling extended headers'
012/22:[----] [--] 'copy: Update nbdcopy to use 64-bit block status'
013/22:[0004] [FC] 'dump: Update nbddump to use 64-bit block status'
014/22:[----] [--] 'info: Expose extended-headers support through nbdinfo'
015/22:[0006] [FC] 'info: Update nbdinfo --map to use 64-bit block status'
016/22:[----] [-C] 'examples: Update copy-libev to use 64-bit block status'
017/22:[0002] [FC] 'ocaml: Add example for 64-bit extents'
018/22:[0004] [FC] 'generator: Actually request extended headers'
019/22:[0008] [FC] 'api: Add nbd_[aio_]opt_extended_headers()'
020/22:[0004] [FC] 'interop: Add test of 64-bit block status'
021/22:[0011] [FC] 'api: Add nbd_can_block_status_payload()'
022/22:[0004] [FC] 'api: Add nbd_[aio_]block_status_filter()'

The changes are mostly fallout from rebasing on top of style cleanups
that Laszlo has been working on, but also deal with some changes with
the spec compared to how it was proposed in v2 (for example, upstream
decided that for NBD_CMD_BLOCK_STATUS, the server should always use
64-bit replies, rather than making the client support both 32- and
64-bit replies).

Eric Blake (22):
  block_status: Refactor array storage
  internal: Refactor layout of replies in sbuf
  protocol: Add definitions for extended headers
  states: Prepare to send 64-bit requests
  states: Prepare to receive 64-bit replies
  states: Break deadlock if server goofs on extended replies
  generator: Add struct nbd_extent in prep for 64-bit extents
  block_status: Track 64-bit extents internally
  block_status: Accept 64-bit extents during block status
  api: Add [aio_]nbd_block_status_64
  api: Add several functions for controlling extended headers
  copy: Update nbdcopy to use 64-bit block status
  dump: Update nbddump to use 64-bit block status
  info: Expose extended-headers support through nbdinfo
  info: Update nbdinfo --map to use 64-bit block status
  examples: Update copy-libev to use 64-bit block status
  ocaml: Add example for 64-bit extents
  generator: Actually request extended headers
  api: Add nbd_[aio_]opt_extended_headers()
  interop: Add test of 64-bit block status
  api: Add nbd_can_block_status_payload()
  api: Add nbd_[aio_]block_status_filter()

 docs/libnbd.pod                               |  18 +-
 info/nbdinfo.pod                              |  21 +-
 sh/nbdsh.pod                                  |   2 +-
 lib/internal.h                                |  41 +-
 lib/nbd-protocol.h                            | 112 +++-
 generator/API.mli                             |   1 +
 generator/API.ml                              | 534 +++++++++++++++---
 generator/C.ml                                |  24 +-
 generator/GoLang.ml                           |  24 +
 generator/Makefile.am                         |   1 +
 generator/OCaml.ml                            |  23 +-
 generator/Python.ml                           |  20 +-
 generator/state_machine.ml                    |  50 +-
 generator/states-issue-command.c              |  33 +-
 .../states-newstyle-opt-extended-headers.c    | 110 ++++
 generator/states-newstyle-opt-starttls.c      |   7 +-
 .../states-newstyle-opt-structured-reply.c    |   3 +-
 generator/states-newstyle.c                   |   3 +
 generator/states-reply-simple.c               |   4 +-
 generator/states-reply-structured.c           | 253 ++++++---
 generator/states-reply.c                      |  69 ++-
 lib/aio.c                                     |   7 +-
 lib/flags.c                                   |  12 +
 lib/handle.c                                  |  25 +-
 lib/opt.c                                     |  44 ++
 lib/rw.c                                      | 250 +++++++-
 python/t/110-defaults.py                      |   1 +
 python/t/120-set-non-defaults.py              |   2 +
 python/t/465-block-status-64.py               |  56 ++
 ocaml/examples/Makefile.am                    |   1 +
 ocaml/examples/extents64.ml                   |  42 ++
 ocaml/helpers.c                               |  20 +
 ocaml/nbd-c.h                                 |   1 +
 ocaml/tests/Makefile.am                       |   1 +
 ocaml/tests/test_110_defaults.ml              |   2 +
 ocaml/tests/test_120_set_non_defaults.ml      |   3 +
 ocaml/tests/test_465_block_status_64.ml       |  58 ++
 tests/Makefile.am                             |   4 +
 tests/meta-base-allocation.c                  | 104 +++-
 tests/pwrite-extended.c                       | 112 ++++
 examples/copy-libev.c                         |  21 +-
 examples/server-flags.c                       |   7 +-
 interop/Makefile.am                           |  18 +
 interop/block-status-payload.c                | 241 ++++++++
 interop/block-status-payload.sh               |  80 +++
 interop/large-status.c                        | 186 ++++++
 interop/large-status.sh                       |  49 ++
 interop/opt-extended-headers.c                | 153 +++++
 interop/opt-extended-headers.sh               |  29 +
 .gitignore                                    |   4 +
 copy/nbd-ops.c                                |  22 +-
 dump/dump.c                                   |  27 +-
 fuzzing/libnbd-fuzz-wrapper.c                 |  20 +-
 golang/Makefile.am                            |   1 +
 golang/handle.go                              |   6 +
 golang/libnbd_110_defaults_test.go            |   8 +
 golang/libnbd_120_set_non_defaults_test.go    |  12 +
 golang/libnbd_465_block_status_64_test.go     | 119 ++++
 info/can.c                                    |  14 +
 info/info-can.sh                              |  30 +
 info/info-packets.sh                          |  17 +-
 info/main.c                                   |   7 +-
 info/map.c                                    |  65 ++-
 info/show.c                                   |   9 +-
 64 files changed, 2892 insertions(+), 351 deletions(-)
 create mode 100644 generator/states-newstyle-opt-extended-headers.c
 create mode 100644 python/t/465-block-status-64.py
 create mode 100644 ocaml/examples/extents64.ml
 create mode 100644 ocaml/tests/test_465_block_status_64.ml
 create mode 100644 tests/pwrite-extended.c
 create mode 100644 interop/block-status-payload.c
 create mode 100755 interop/block-status-payload.sh
 create mode 100644 interop/large-status.c
 create mode 100755 interop/large-status.sh
 create mode 100644 interop/opt-extended-headers.c
 create mode 100755 interop/opt-extended-headers.sh
 create mode 100644 golang/libnbd_465_block_status_64_test.go


base-commit: 17d0bc6a71bbc67f3d7707d129bec4acf7e7a382
-- 
2.40.1



More information about the Libguestfs mailing list