Skip to content

virtio-blk: add DISCARD and WRITE_ZEROES features

Stefano Garzarella qemu-devel 6 versions – Applied

Status from this message: Thanks, applied to my block tree:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest10 patches 1 replyApplied
  2. v510 patches 6 repliesSuperseded
  3. v46 patches 4 repliesApplied
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v36 patches6 repliesSuperseded
v25 patches26 repliesSuperseded
v1 RFC2 patches21 repliesSuperseded

Changes in v6 from the cover letter

- fixed patchew failure on patch 8 (do not initialise globals to 0 or NULL)
- added R-b tags by Stefan

Patches in v6 Applied

#Subject and filesSizeRepliesApplied
1/10virtio-blk: add acct_failed param to virtio_blk_handle_rw_error()hw/block/virtio-blk.c+6 -40 replies
2/10virtio-blk: add host_features field in VirtIOBlockhw/block/virtio-blk.c include/hw/virtio/virtio-blk.h+10 -90 replies
3/10virtio-blk: add "discard" and "write-zeroes" propertieshw/block/virtio-blk.c hw/core/machine.c+6 -00 replies
4/10virtio-net: make VirtIOFeature usable for other virtio deviceshw/net/virtio-net.c hw/virtio/virtio.c include/hw/virtio/virtio.h+37 -240 replies
5/10virtio-blk: set config size depending on the features enabledhw/block/virtio-blk.c include/hw/virtio/virtio-blk.h+26 -60 replies
6/10virtio-blk: add DISCARD and WRITE_ZEROES featureshw/block/virtio-blk.c include/hw/virtio/virtio-blk.h+186 -00 replies
7/10tests/virtio-blk: change assert on data_size in virtio_blk_request()tests/virtio-blk-test.c+14 -10 replies
8/10tests/virtio-blk: add virtio_blk_fix_dwz_hdr() functiontests/virtio-blk-test.c+17 -60 replies
9/10tests/virtio-blk: add test for WRITE_ZEROES commandtests/virtio-blk-test.c+62 -00 replies
10/10tests/virtio-blk: add test for DISCARD commandtests/virtio-blk-test.c+27 -00 replies

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchMichael S. TsirkinStefan HajnocziThomas Huth
1/10R-b R-b
2/10R-b R-b
3/10R-b R-b
4/10R-b
5/10R-b
6/10R-b R-b
7/10R-b R-b R-b
8/10R-b
9/10R-b R-b A-b
10/10R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v6 thread

Cover letter [Qemu-devel] [PATCH v6 00/10] virtio-blk: add DISCARD and WRITE_ZEROES features

This series adds the support of DISCARD and WRITE_ZEROES commands and extends the virtio-blk-test to test these new commands.

v6:
- fixed patchew failure on patch 8 (do not initialise globals to 0 or NULL)
- added R-b tags by Stefan

v5:
- rebased on master
- handled the config size for DISCARD and WRITE_ZEROES features as in virtio-net (patches 4 and 5) [Michael, Stefan]
- fixed an endianness issues on the WRITE_ZEROES test (patches 8 and 9)
- added a test for DISCARD command to only test the status returned by the request (patch 10)
- others patches are unchanged (patches 1, 2, 3, 6, 7)

v4:
- fixed error with mingw compiler in patch 4
gcc and clang want %lu, but mingw wants %llu for BDRV_REQUEST_MAX_SECTORS. Since is less than INT_MAX, I casted it to integer and I used %d in the format string of error_setg. (mingw now is happy)

v3:
- rebased on master (I removed Based-on tag since the new virtio headers from linux v5.0-rc1 are merged)
- added patch 2 to add host_features field (as in virtio-net) [Michael]
- fixed patch 3 (previously 2/5) using the new host_features field
- fixed patch 4 (previously 3/5) following the Stefan's comments:
- fixed name of functions and fields
- used vdev and s pointers
- removed "wz-may-unmap" property
- split "dwz-max-sectors" in two properties

v2:
- added patch 1 to use virtio_blk_handle_rw_error() with discard operation
- added patch 2 to make those new features machine-type dependent (thanks David)
- fixed patch 3 (previously patch 1/2) adding more checks, block_acct_start() for WRITE_ZEROES requests, and configurable parameters to initialize the limits (max_sectors, wzeroes_may_unmap). (thanks Stefan)
I moved in a new function the code to handle a single segment, in order to simplify the support of multiple segments in the future.
- added patch 4 to change the assert on data_size following the discussion with Thomas, Changpeng, Michael, and Stefan (thanks all)
- fixed patch 5 (previously patch 2/2) using local dwz_hdr variable instead of dynamic allocation (thanks Thomas)

Thanks,
Stefano

Stefano Garzarella (10):
virtio-blk: add acct_failed param to virtio_blk_handle_rw_error()
virtio-blk: add host_features field in VirtIOBlock
virtio-blk: add "discard" and "write-zeroes" properties
virtio-net: make VirtIOFeature usable for other virtio devices
virtio-blk: set config size depending on the features enabled
virtio-blk: add DISCARD and WRITE_ZEROES features tests/virtio-blk: change assert on data_size in virtio_blk_request() tests/virtio-blk: add virtio_blk_fix_dwz_hdr() function tests/virtio-blk: add test for WRITE_ZEROES command tests/virtio-blk: add test for DISCARD command

 hw/block/virtio-blk.c          | 245 ++++++++++++++++++++++++++++++---
 hw/core/machine.c              |   2 +
 hw/net/virtio-net.c            |  31 +----
 hw/virtio/virtio.c             |  15 ++
 include/hw/virtio/virtio-blk.h |   6 +-
 include/hw/virtio/virtio.h     |  15 ++
 tests/virtio-blk-test.c        | 127 ++++++++++++++++-
 7 files changed, 391 insertions(+), 50 deletions(-)
Signature · 1 line
2.20.1