mbox series

[v5,00/10] virtio-blk: add DISCARD and WRITE_ZEROES features

Message ID 20190218140301.197408-1-sgarzare@redhat.com (mailing list archive)
Headers show
Series virtio-blk: add DISCARD and WRITE_ZEROES features | expand

Message

Stefano Garzarella Feb. 18, 2019, 2:02 p.m. UTC
This series adds the support of DISCARD and WRITE_ZEROES commands
and extends the virtio-blk-test to test these new commands.

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(-)

Comments

no-reply@patchew.org Feb. 18, 2019, 3:05 p.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20190218140301.197408-1-sgarzare@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190218140301.197408-1-sgarzare@redhat.com
Subject: [Qemu-devel] [PATCH v5 00/10] virtio-blk: add DISCARD and WRITE_ZEROES features
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
   1e36232994..1c5d9d8f11  master     -> master
 * [new tag]               patchew/20190218140301.197408-1-sgarzare@redhat.com -> patchew/20190218140301.197408-1-sgarzare@redhat.com
 * [new tag]               patchew/20190218140607.31998-1-armbru@redhat.com -> patchew/20190218140607.31998-1-armbru@redhat.com
Switched to a new branch 'test'
4e387bff7b tests/virtio-blk: add test for DISCARD command
9dbf66647f tests/virtio-blk: add test for WRITE_ZEROES command
1e74575a2e tests/virtio-blk: add virtio_blk_fix_dwz_hdr() function
0677a06531 tests/virtio-blk: change assert on data_size in virtio_blk_request()
f2d45c1a14 virtio-blk: add DISCARD and WRITE_ZEROES features
7cc46c25d2 virtio-blk: set config size depending on the features enabled
26f46a5550 virtio-net: make VirtIOFeature usable for other virtio devices
23b07b39fb virtio-blk: add "discard" and "write-zeroes" properties
9d6734a0fe virtio-blk: add host_features field in VirtIOBlock
97427f4d38 virtio-blk: add acct_failed param to virtio_blk_handle_rw_error()

=== OUTPUT BEGIN ===
1/10 Checking commit 97427f4d38a6 (virtio-blk: add acct_failed param to virtio_blk_handle_rw_error())
2/10 Checking commit 9d6734a0fed5 (virtio-blk: add host_features field in VirtIOBlock)
3/10 Checking commit 23b07b39fb93 (virtio-blk: add "discard" and "write-zeroes" properties)
4/10 Checking commit 26f46a5550f8 (virtio-net: make VirtIOFeature usable for other virtio devices)
5/10 Checking commit 7cc46c25d2e3 (virtio-blk: set config size depending on the features enabled)
6/10 Checking commit f2d45c1a148c (virtio-blk: add DISCARD and WRITE_ZEROES features)
7/10 Checking commit 0677a0653115 (tests/virtio-blk: change assert on data_size in virtio_blk_request())
8/10 Checking commit 1e74575a2e89 (tests/virtio-blk: add virtio_blk_fix_dwz_hdr() function)
ERROR: do not initialise globals to 0 or NULL
#24: FILE: tests/virtio-blk-test.c:52:
+const bool host_is_big_endian = false;

total: 1 errors, 0 warnings, 41 lines checked

Patch 8/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

9/10 Checking commit 9dbf66647f0b (tests/virtio-blk: add test for WRITE_ZEROES command)
10/10 Checking commit 4e387bff7bb9 (tests/virtio-blk: add test for DISCARD command)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190218140301.197408-1-sgarzare@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Stefan Hajnoczi Feb. 20, 2019, 4:30 p.m. UTC | #2
On Mon, Feb 18, 2019 at 03:02:51PM +0100, Stefano Garzarella wrote:
> This series adds the support of DISCARD and WRITE_ZEROES commands
> and extends the virtio-blk-test to test these new commands.
> 
> 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)

Looks good.  Please fix the patchew failure and resend.

Stefan
Stefano Garzarella Feb. 20, 2019, 9:05 p.m. UTC | #3
Il giorno mer 20 feb 2019 alle 17:31 Stefan Hajnoczi <stefanha@gmail.com>
ha scritto:

> On Mon, Feb 18, 2019 at 03:02:51PM +0100, Stefano Garzarella wrote:
> > This series adds the support of DISCARD and WRITE_ZEROES commands
> > and extends the virtio-blk-test to test these new commands.
> >
> > 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)
>
> Looks good.  Please fix the patchew failure and resend.


Thanks for the review!
I’ll send the new version with the fix.

Cheers,
Stefano