qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 72ca80: block/block-common: add zoned device


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 72ca80: block/block-common: add zoned device structs
Date: Mon, 15 May 2023 13:55:05 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 72ca800ec5eca1a36a741ce3e878cf675672dc9c
      
https://github.com/qemu/qemu/commit/72ca800ec5eca1a36a741ce3e878cf675672dc9c
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M include/block/block-common.h

  Log Message:
  -----------
  block/block-common: add zoned device structs

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508045533.175575-2-faithilikerun@gmail.com
Message-id: 20230324090605.28361-2-faithilikerun@gmail.com
[Adjust commit message prefix as suggested by Philippe Mathieu-Daudé
<philmd@linaro.org>.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: a735b56e49be6f227f3f33be837a74c069441a48
      
https://github.com/qemu/qemu/commit/a735b56e49be6f227f3f33be837a74c069441a48
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block/file-posix.c
    M include/block/block_int-common.h

  Log Message:
  -----------
  block/file-posix: introduce helper functions for sysfs attributes

Use get_sysfs_str_val() to get the string value of device
zoned model. Then get_sysfs_zoned_model() can convert it to
BlockZoneModel type of QEMU.

Use get_sysfs_long_val() to get the long value of zoned device
information.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508045533.175575-3-faithilikerun@gmail.com
Message-id: 20230324090605.28361-3-faithilikerun@gmail.com
[Adjust commit message prefix as suggested by Philippe Mathieu-Daudé
<philmd@linaro.org>.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 6d43eaa39647507563017590b090b2e2b10aed2d
      
https://github.com/qemu/qemu/commit/6d43eaa39647507563017590b090b2e2b10aed2d
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block/block-backend.c
    M block/file-posix.c
    M block/io.c
    M include/block/block-io.h
    M include/block/block_int-common.h
    M include/block/raw-aio.h
    M include/sysemu/block-backend-io.h
    M meson.build
    M qemu-io-cmds.c

  Log Message:
  -----------
  block/block-backend: add block layer APIs resembling Linux ZonedBlockDevice 
ioctls

Add zoned device option to host_device BlockDriver. It will be presented only
for zoned host block devices. By adding zone management operations to the
host_block_device BlockDriver, users can use the new block layer APIs
including Report Zone and four zone management operations
(open, close, finish, reset, reset_all).

Qemu-io uses the new APIs to perform zoned storage commands of the device:
zone_report(zrp), zone_open(zo), zone_close(zc), zone_reset(zrs),
zone_finish(zf).

For example, to test zone_report, use following command:
$ ./build/qemu-io --image-opts -n driver=host_device, filename=/dev/nullb0
-c "zrp offset nr_zones"

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508045533.175575-4-faithilikerun@gmail.com
Message-id: 20230324090605.28361-4-faithilikerun@gmail.com
[Adjust commit message prefix as suggested by Philippe Mathieu-Daudé
<philmd@linaro.org> and remove spurious ret = -errno in
raw_co_zone_mgmt().
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 50c4bcd496d536e6b2693fb6258a9f447c5e33ae
      
https://github.com/qemu/qemu/commit/50c4bcd496d536e6b2693fb6258a9f447c5e33ae
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block/raw-format.c

  Log Message:
  -----------
  block/raw-format: add zone operations to pass through requests

raw-format driver usually sits on top of file-posix driver. It needs to
pass through requests of zone commands.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508045533.175575-5-faithilikerun@gmail.com
Message-id: 20230324090605.28361-5-faithilikerun@gmail.com
[Adjust commit message prefix as suggested by Philippe Mathieu-Daudé
<philmd@linaro.org>.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 774c726ceb2a3aa039dc20f0b51c9d36a2c6760d
      
https://github.com/qemu/qemu/commit/774c726ceb2a3aa039dc20f0b51c9d36a2c6760d
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block.c
    M block/file-posix.c
    M block/raw-format.c
    M include/block/block_int-common.h

  Log Message:
  -----------
  block: add zoned BlockDriver check to block layer

Putting zoned/non-zoned BlockDrivers on top of each other is not
allowed.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508045533.175575-6-faithilikerun@gmail.com
Message-id: 20230324090605.28361-6-faithilikerun@gmail.com
[Adjust commit message prefix as suggested by Philippe Mathieu-Daudé
<philmd@linaro.org> and clarify that the check is about zoned
BlockDrivers.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 8a6aa0bbe5770b8957f7dd7b1598b98ad5566674
      
https://github.com/qemu/qemu/commit/8a6aa0bbe5770b8957f7dd7b1598b98ad5566674
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    A tests/qemu-iotests/tests/zoned
    A tests/qemu-iotests/tests/zoned.out

  Log Message:
  -----------
  iotests: test new zone operations

The new block layer APIs of zoned block devices can be tested by:
$ tests/qemu-iotests/check zoned
Run each zone operation on a newly created null_blk device
and see whether it outputs the same zone information.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508045533.175575-7-faithilikerun@gmail.com
Message-id: 20230324090605.28361-7-faithilikerun@gmail.com
[Adjust commit message prefix as suggested by Philippe Mathieu-Daudé
<philmd@linaro.org>.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 142e307e79908ec58588b38d46ba63928f80ec36
      
https://github.com/qemu/qemu/commit/142e307e79908ec58588b38d46ba63928f80ec36
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block/file-posix.c
    M block/trace-events

  Log Message:
  -----------
  block: add some trace events for new block layer APIs

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508045533.175575-8-faithilikerun@gmail.com
Message-id: 20230324090605.28361-8-faithilikerun@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 90fd9746689e865525ddb18cfec925f56159c740
      
https://github.com/qemu/qemu/commit/90fd9746689e865525ddb18cfec925f56159c740
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M docs/devel/index-api.rst
    A docs/devel/zoned-storage.rst
    M docs/system/qemu-block-drivers.rst.inc

  Log Message:
  -----------
  docs/zoned-storage: add zoned device documentation

Add the documentation about the zoned device support to virtio-blk
emulation.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508045533.175575-9-faithilikerun@gmail.com
Message-id: 20230324090605.28361-9-faithilikerun@gmail.com
[Add index-api.rst to fix "zoned-storage.rst:document isn't included in
any toctree" error and fix pre-formatted code syntax.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: a3c41f06d5a84bc2263e871b1e9fa4daba7edf0f
      
https://github.com/qemu/qemu/commit/a3c41f06d5a84bc2263e871b1e9fa4daba7edf0f
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block/file-posix.c
    M include/block/block-common.h
    M include/block/block_int-common.h

  Log Message:
  -----------
  file-posix: add tracking of the zone write pointers

Since Linux doesn't have a user API to issue zone append operations to
zoned devices from user space, the file-posix driver is modified to add
zone append emulation using regular writes. To do this, the file-posix
driver tracks the wp location of all zones of the device. It uses an
array of uint64_t. The most significant bit of each wp location indicates
if the zone type is conventional zones.

The zones wp can be changed due to the following operations issued:
- zone reset: change the wp to the start offset of that zone
- zone finish: change to the end location of that zone
- write to a zone
- zone append

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Message-id: 20230508051510.177850-2-faithilikerun@gmail.com
[Fix errno propagation from handle_aiocb_zone_mgmt()
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 4751d09adcc3dd76b4124f5c408055ee0940b3ee
      
https://github.com/qemu/qemu/commit/4751d09adcc3dd76b4124f5c408055ee0940b3ee
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block/block-backend.c
    M block/file-posix.c
    M block/io.c
    M block/io_uring.c
    M block/linux-aio.c
    M block/raw-format.c
    M include/block/block-io.h
    M include/block/block_int-common.h
    M include/block/raw-aio.h
    M include/sysemu/block-backend-io.h

  Log Message:
  -----------
  block: introduce zone append write for zoned devices

A zone append command is a write operation that specifies the first
logical block of a zone as the write position. When writing to a zoned
block device using zone append, the byte offset of the call may point at
any position within the zone to which the data is being appended. Upon
completion the device will respond with the position where the data has
been written in the zone.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508051510.177850-3-faithilikerun@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: fe4fe70d27db31e4aa139387cdf66c23cace7fd3
      
https://github.com/qemu/qemu/commit/fe4fe70d27db31e4aa139387cdf66c23cace7fd3
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M qemu-io-cmds.c
    M tests/qemu-iotests/tests/zoned
    M tests/qemu-iotests/tests/zoned.out

  Log Message:
  -----------
  qemu-iotests: test zone append operation

The patch tests zone append writes by reporting the zone wp after
the completion of the call. "zap -p" option can print the sector
offset value after completion, which should be the start sector
where the append write begins.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508051510.177850-4-faithilikerun@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 6c811e19bb61213cf62018dc137036603af71ad0
      
https://github.com/qemu/qemu/commit/6c811e19bb61213cf62018dc137036603af71ad0
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block/file-posix.c
    M block/trace-events

  Log Message:
  -----------
  block: add some trace events for zone append

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508051510.177850-5-faithilikerun@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 4f7366506a96c862c796d4ea1913110d9c341e7d
      
https://github.com/qemu/qemu/commit/4f7366506a96c862c796d4ea1913110d9c341e7d
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M hw/block/virtio-blk-common.c
    M hw/block/virtio-blk.c
    M hw/virtio/virtio-qmp.c

  Log Message:
  -----------
  virtio-blk: add zoned storage emulation for zoned devices

This patch extends virtio-blk emulation to handle zoned device commands
by calling the new block layer APIs to perform zoned device I/O on
behalf of the guest. It supports Report Zone, four zone oparations (open,
close, finish, reset), and Append Zone.

The VIRTIO_BLK_F_ZONED feature bit will only be set if the host does
support zoned block devices. Regular block devices(conventional zones)
will not be set.

The guest os can use blktests, fio to test those commands on zoned devices.
Furthermore, using zonefs to test zone append write is also supported.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Message-id: 20230508051916.178322-2-faithilikerun@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 52eb76f4b1ac040208275665b03da1fbee99c539
      
https://github.com/qemu/qemu/commit/52eb76f4b1ac040208275665b03da1fbee99c539
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block/qapi-sysemu.c
    M block/qapi.c
    M hw/block/virtio-blk.c
    M include/block/accounting.h
    M qapi/block-core.json
    M qapi/block.json
    M tests/qemu-iotests/227.out

  Log Message:
  -----------
  block: add accounting for zone append operation

Taking account of the new zone append write operation for zoned devices,
BLOCK_ACCT_ZONE_APPEND enum is introduced as other I/O request type (read,
write, flush).

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Message-id: 20230508051916.178322-3-faithilikerun@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 4e92acf74d7cc396a8b4673e38861512fd29b94c
      
https://github.com/qemu/qemu/commit/4e92acf74d7cc396a8b4673e38861512fd29b94c
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M hw/block/trace-events
    M hw/block/virtio-blk.c

  Log Message:
  -----------
  virtio-blk: add some trace events for zoned emulation

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20230508051916.178322-4-faithilikerun@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 01562fee5f3ad4506d57dbcf4b1903b565eceec7
      
https://github.com/qemu/qemu/commit/01562fee5f3ad4506d57dbcf4b1903b565eceec7
  Author: Sam Li <faithilikerun@gmail.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M docs/devel/zoned-storage.rst

  Log Message:
  -----------
  docs/zoned-storage:add zoned emulation use case

Add the documentation about the example of using virtio-blk driver
to pass the zoned block devices through to the guest.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Message-id: 20230508051916.178322-5-faithilikerun@gmail.com
[Fix pre-formatted code syntax
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: ab4c44d657aeca7e1da6d6dcb1741c8e7d357b8b
      
https://github.com/qemu/qemu/commit/ab4c44d657aeca7e1da6d6dcb1741c8e7d357b8b
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M block.c
    M block/block-backend.c
    M block/file-posix.c
    M block/io.c
    M block/io_uring.c
    M block/linux-aio.c
    M block/qapi-sysemu.c
    M block/qapi.c
    M block/raw-format.c
    M block/trace-events
    M docs/devel/index-api.rst
    A docs/devel/zoned-storage.rst
    M docs/system/qemu-block-drivers.rst.inc
    M hw/block/trace-events
    M hw/block/virtio-blk-common.c
    M hw/block/virtio-blk.c
    M hw/virtio/virtio-qmp.c
    M include/block/accounting.h
    M include/block/block-common.h
    M include/block/block-io.h
    M include/block/block_int-common.h
    M include/block/raw-aio.h
    M include/sysemu/block-backend-io.h
    M meson.build
    M qapi/block-core.json
    M qapi/block.json
    M qemu-io-cmds.c
    M tests/qemu-iotests/227.out
    A tests/qemu-iotests/tests/zoned
    A tests/qemu-iotests/tests/zoned.out

  Log Message:
  -----------
  Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into 
staging

Pull request

This pull request contain's Sam Li's zoned storage support in the QEMU block
layer and virtio-blk emulation.

v2:
- Sam fixed the CI failures. CI passes for me now. [Richard]

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmRiWCgACgkQnKSrs4Gr
# c8h/7gf+MMm2cGEaf376t8HMwTc6wbXVfbmAlZrge2EXPZfFvEaxj7HClcEraOgV
# yJsGWeU6mOw4r68ICJ/4KhrY1cdv+VZym/LsMLMcFUTXFHnyX4pyU3am31FPOI4K
# +wrDYJOJhc4DkAESWGgEWiMKpuO/uUEgBmHdW+qPFCl77Yl/eP6H5uNP6nGFn55p
# QpS/l8iha7PDkc81EsrjA+e/YI0ubfNSP7+zZElhQ98354CQ0MCfmZ6h9bT+o2bu
# R7SBUj80e+2X0a1b9s/2Jz/x8l4TEsl8kr48/Q1usq3GVVkbjEgqsk6wTN13Q/4g
# CeIR7E61ZeYzmpb4tLFRIqK2Jw+NEQ==
# =Q8xW
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 15 May 2023 09:04:56 AM PDT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]

* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
  docs/zoned-storage:add zoned emulation use case
  virtio-blk: add some trace events for zoned emulation
  block: add accounting for zone append operation
  virtio-blk: add zoned storage emulation for zoned devices
  block: add some trace events for zone append
  qemu-iotests: test zone append operation
  block: introduce zone append write for zoned devices
  file-posix: add tracking of the zone write pointers
  docs/zoned-storage: add zoned device documentation
  block: add some trace events for new block layer APIs
  iotests: test new zone operations
  block: add zoned BlockDriver check to block layer
  block/raw-format: add zone operations to pass through requests
  block/block-backend: add block layer APIs resembling Linux ZonedBlockDevice 
ioctls
  block/file-posix: introduce helper functions for sysfs attributes
  block/block-common: add zoned device structs

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/c2765531a455...ab4c44d657ae



reply via email to

[Prev in Thread] Current Thread [Next in Thread]