28.06.2019 11:43, Stefan Hajnoczi wrote: > On Tue, Jun 04, 2019 at 07:15:02PM +0300, Vladimir Sementsov-Ogievskiy wrote: >> Hi all! >> >> Here is new parameter qiov_offset for io path, to avoid >> a lot of places with same pattern of creating local_qiov or hd_qiov >> variables. >> >> These series also includes my >> "[Qemu-devel] [PATCH 0/2] block/io: refactor padding" >> with some changes [described in 01 and 03 emails] >> >> Vladimir Sementsov-Ogievskiy (12): >> util/iov: introduce qemu_iovec_init_extended >> util/iov: improve qemu_iovec_is_zero >> block/io: refactor padding >> block: define .*_part io handlers in BlockDriver >> block/io: bdrv_co_do_copy_on_readv: use and support qiov_offset >> block/io: bdrv_co_do_copy_on_readv: lazy allocation >> block/io: bdrv_aligned_preadv: use and support qiov_offset >> block/io: bdrv_aligned_pwritev: use and support qiov_offset >> block/io: introduce bdrv_co_p{read,write}v_part >> block/qcow2: refactor qcow2_co_preadv to use buffer-based io >> block/qcow2: implement .bdrv_co_preadv_part >> block/qcow2: implement .bdrv_co_pwritev(_compressed)_part >> >> block/qcow2.h | 1 + >> include/block/block_int.h | 21 ++ >> include/qemu/iov.h | 10 +- >> block/backup.c | 2 +- >> block/io.c | 532 ++++++++++++++++++++++---------------- >> block/qcow2-cluster.c | 14 +- >> block/qcow2.c | 131 +++++----- >> qemu-img.c | 4 +- >> util/iov.c | 153 +++++++++-- >> 9 files changed, 559 insertions(+), 309 deletions(-) >> >> -- >> 2.18.0 >> >> > > I don't see a significant advantage after taking into account more > complex code (e.g. additional block driver interfaces) and the risk of > introducing new bugs. A measurable performance improvement would make > this refactoring more attractive. Still: > > Acked-by: Stefan Hajnoczi <stefa...@redhat.com> >
Hmm, I understand your doubt. And I doubt that there will be some significant performance gain. What will you say if instead of adding new interfaces I just add qiov_offset parameter to old ones, and add one boolean field to BlockDriver like .supports_qiov_offset, so, generic code will use non-zero qiov_offset only for drivers supporting it? And, maybe, add corresponding asserts to all not-supporting driver handlers? -- Best regards, Vladimir