[PATCH 00/14] block: Move more functions to coroutines

Kevin Wolf posted 14 patches 1 year, 4 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
include/block/block-io.h           | 36 +++++++++----
include/block/block_int-common.h   | 26 ++++++----
include/block/block_int-io.h       |  5 +-
include/sysemu/block-backend-io.h  | 31 ++++++++---
block.c                            | 82 ++++++++++++++++++------------
block/blkdebug.c                   |  4 +-
block/blkio.c                      |  6 +--
block/blklogwrites.c               |  2 +-
block/blkreplay.c                  |  2 +-
block/blkverify.c                  |  2 +-
block/block-backend.c              | 36 ++++++-------
block/commit.c                     |  4 +-
block/copy-on-read.c               | 12 ++---
block/crypto.c                     |  6 +--
block/curl.c                       |  8 +--
block/file-posix.c                 | 48 ++++++++---------
block/file-win32.c                 | 12 ++---
block/filter-compress.c            | 10 ++--
block/gluster.c                    | 16 +++---
block/io.c                         | 76 +++++++++++++--------------
block/iscsi.c                      |  8 +--
block/mirror.c                     |  6 +--
block/nbd.c                        |  6 +--
block/nfs.c                        |  2 +-
block/null.c                       |  8 +--
block/nvme.c                       |  6 +--
block/preallocate.c                |  2 +-
block/qcow.c                       |  2 +-
block/qcow2-refcount.c             |  2 +-
block/qcow2.c                      |  6 +--
block/qed.c                        |  4 +-
block/quorum.c                     |  2 +-
block/raw-format.c                 | 14 ++---
block/rbd.c                        |  4 +-
block/replication.c                |  2 +-
block/ssh.c                        |  2 +-
block/throttle.c                   |  2 +-
block/vdi.c                        |  2 +-
block/vhdx.c                       |  2 +-
block/vmdk.c                       |  4 +-
block/vpc.c                        |  2 +-
blockdev.c                         |  8 ++-
hw/scsi/scsi-disk.c                |  5 ++
tests/unit/test-block-iothread.c   |  3 ++
scripts/block-coroutine-wrapper.py | 20 ++++++--
block/meson.build                  |  1 +
46 files changed, 316 insertions(+), 233 deletions(-)
[PATCH 00/14] block: Move more functions to coroutines
Posted by Kevin Wolf 1 year, 4 months ago
This series converts some IO_CODE() functions to coroutine_fn because
they access the graph and will need to hold the graph lock in the
future. IO_CODE() functions can be called from iothreads, so taking the
graph lock requires the function to run in coroutine context.

Pretty much all of the changes in this series were posted by Emanuele
before as part of "Protect the block layer with a rwlock: part 3". The
major difference is that in the old version, the patches did two things
at once: Converting functions to coroutine_fn, and adding the locking to
them. This series does only the coroutine conversion. The locking part
will be in another series which now comes with TSA annotations and makes
the locking related changes big enough to have separate patches.

Emanuele Giuseppe Esposito (14):
  block-coroutine-wrapper: support void functions
  block: Convert bdrv_io_plug() to co_wrapper
  block: Convert bdrv_io_unplug() to co_wrapper
  block: Rename refresh_total_sectors to bdrv_refresh_total_sectors
  block: Convert bdrv_refresh_total_sectors() to co_wrapper_mixed
  block-backend: use bdrv_getlength instead of blk_getlength
  block: use bdrv_co_refresh_total_sectors when possible
  block: Convert bdrv_get_allocated_file_size() to co_wrapper
  block: Convert bdrv_get_info() to co_wrapper_mixed
  block: Convert bdrv_is_inserted() to co_wrapper
  block: Convert bdrv_eject() to co_wrapper
  block: convert bdrv_lock_medium in co_wrapper
  block: Convert bdrv_debug_event to co_wrapper_mixed
  block: Rename newly converted BlockDriver IO coroutine functions

 include/block/block-io.h           | 36 +++++++++----
 include/block/block_int-common.h   | 26 ++++++----
 include/block/block_int-io.h       |  5 +-
 include/sysemu/block-backend-io.h  | 31 ++++++++---
 block.c                            | 82 ++++++++++++++++++------------
 block/blkdebug.c                   |  4 +-
 block/blkio.c                      |  6 +--
 block/blklogwrites.c               |  2 +-
 block/blkreplay.c                  |  2 +-
 block/blkverify.c                  |  2 +-
 block/block-backend.c              | 36 ++++++-------
 block/commit.c                     |  4 +-
 block/copy-on-read.c               | 12 ++---
 block/crypto.c                     |  6 +--
 block/curl.c                       |  8 +--
 block/file-posix.c                 | 48 ++++++++---------
 block/file-win32.c                 | 12 ++---
 block/filter-compress.c            | 10 ++--
 block/gluster.c                    | 16 +++---
 block/io.c                         | 76 +++++++++++++--------------
 block/iscsi.c                      |  8 +--
 block/mirror.c                     |  6 +--
 block/nbd.c                        |  6 +--
 block/nfs.c                        |  2 +-
 block/null.c                       |  8 +--
 block/nvme.c                       |  6 +--
 block/preallocate.c                |  2 +-
 block/qcow.c                       |  2 +-
 block/qcow2-refcount.c             |  2 +-
 block/qcow2.c                      |  6 +--
 block/qed.c                        |  4 +-
 block/quorum.c                     |  2 +-
 block/raw-format.c                 | 14 ++---
 block/rbd.c                        |  4 +-
 block/replication.c                |  2 +-
 block/ssh.c                        |  2 +-
 block/throttle.c                   |  2 +-
 block/vdi.c                        |  2 +-
 block/vhdx.c                       |  2 +-
 block/vmdk.c                       |  4 +-
 block/vpc.c                        |  2 +-
 blockdev.c                         |  8 ++-
 hw/scsi/scsi-disk.c                |  5 ++
 tests/unit/test-block-iothread.c   |  3 ++
 scripts/block-coroutine-wrapper.py | 20 ++++++--
 block/meson.build                  |  1 +
 46 files changed, 316 insertions(+), 233 deletions(-)

-- 
2.38.1
Re: [PATCH 00/14] block: Move more functions to coroutines
Posted by Emanuele Giuseppe Esposito 1 year, 4 months ago

Am 13/12/2022 um 09:53 schrieb Kevin Wolf:
> This series converts some IO_CODE() functions to coroutine_fn because
> they access the graph and will need to hold the graph lock in the
> future. IO_CODE() functions can be called from iothreads, so taking the
> graph lock requires the function to run in coroutine context.
> 
> Pretty much all of the changes in this series were posted by Emanuele
> before as part of "Protect the block layer with a rwlock: part 3". The
> major difference is that in the old version, the patches did two things
> at once: Converting functions to coroutine_fn, and adding the locking to
> them. This series does only the coroutine conversion. The locking part
> will be in another series which now comes with TSA annotations and makes
> the locking related changes big enough to have separate patches.
> 

Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>

> Emanuele Giuseppe Esposito (14):
>   block-coroutine-wrapper: support void functions
>   block: Convert bdrv_io_plug() to co_wrapper
>   block: Convert bdrv_io_unplug() to co_wrapper
>   block: Rename refresh_total_sectors to bdrv_refresh_total_sectors
>   block: Convert bdrv_refresh_total_sectors() to co_wrapper_mixed
>   block-backend: use bdrv_getlength instead of blk_getlength
>   block: use bdrv_co_refresh_total_sectors when possible
>   block: Convert bdrv_get_allocated_file_size() to co_wrapper
>   block: Convert bdrv_get_info() to co_wrapper_mixed
>   block: Convert bdrv_is_inserted() to co_wrapper
>   block: Convert bdrv_eject() to co_wrapper
>   block: convert bdrv_lock_medium in co_wrapper
>   block: Convert bdrv_debug_event to co_wrapper_mixed
>   block: Rename newly converted BlockDriver IO coroutine functions
> 
>  include/block/block-io.h           | 36 +++++++++----
>  include/block/block_int-common.h   | 26 ++++++----
>  include/block/block_int-io.h       |  5 +-
>  include/sysemu/block-backend-io.h  | 31 ++++++++---
>  block.c                            | 82 ++++++++++++++++++------------
>  block/blkdebug.c                   |  4 +-
>  block/blkio.c                      |  6 +--
>  block/blklogwrites.c               |  2 +-
>  block/blkreplay.c                  |  2 +-
>  block/blkverify.c                  |  2 +-
>  block/block-backend.c              | 36 ++++++-------
>  block/commit.c                     |  4 +-
>  block/copy-on-read.c               | 12 ++---
>  block/crypto.c                     |  6 +--
>  block/curl.c                       |  8 +--
>  block/file-posix.c                 | 48 ++++++++---------
>  block/file-win32.c                 | 12 ++---
>  block/filter-compress.c            | 10 ++--
>  block/gluster.c                    | 16 +++---
>  block/io.c                         | 76 +++++++++++++--------------
>  block/iscsi.c                      |  8 +--
>  block/mirror.c                     |  6 +--
>  block/nbd.c                        |  6 +--
>  block/nfs.c                        |  2 +-
>  block/null.c                       |  8 +--
>  block/nvme.c                       |  6 +--
>  block/preallocate.c                |  2 +-
>  block/qcow.c                       |  2 +-
>  block/qcow2-refcount.c             |  2 +-
>  block/qcow2.c                      |  6 +--
>  block/qed.c                        |  4 +-
>  block/quorum.c                     |  2 +-
>  block/raw-format.c                 | 14 ++---
>  block/rbd.c                        |  4 +-
>  block/replication.c                |  2 +-
>  block/ssh.c                        |  2 +-
>  block/throttle.c                   |  2 +-
>  block/vdi.c                        |  2 +-
>  block/vhdx.c                       |  2 +-
>  block/vmdk.c                       |  4 +-
>  block/vpc.c                        |  2 +-
>  blockdev.c                         |  8 ++-
>  hw/scsi/scsi-disk.c                |  5 ++
>  tests/unit/test-block-iothread.c   |  3 ++
>  scripts/block-coroutine-wrapper.py | 20 ++++++--
>  block/meson.build                  |  1 +
>  46 files changed, 316 insertions(+), 233 deletions(-)
>