mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
block: define .*_part io handlers in BlockDriver
Add handlers supporting qiov_offset parameter: bdrv_co_preadv_part bdrv_co_pwritev_part bdrv_co_pwritev_compressed_part This is used to reduce need of defining local_qiovs and hd_qiovs in all corners of block layer code. The following patches will increase usage of this new API part by part. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20190604161514.262241-5-vsementsov@virtuozzo.com Message-Id: <20190604161514.262241-5-vsementsov@virtuozzo.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
7a3f542fbd
commit
ac850bf099
4 changed files with 95 additions and 22 deletions
|
@ -210,6 +210,9 @@ struct BlockDriver {
|
|||
*/
|
||||
int coroutine_fn (*bdrv_co_preadv)(BlockDriverState *bs,
|
||||
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags);
|
||||
int coroutine_fn (*bdrv_co_preadv_part)(BlockDriverState *bs,
|
||||
uint64_t offset, uint64_t bytes,
|
||||
QEMUIOVector *qiov, size_t qiov_offset, int flags);
|
||||
int coroutine_fn (*bdrv_co_writev)(BlockDriverState *bs,
|
||||
int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, int flags);
|
||||
/**
|
||||
|
@ -229,6 +232,9 @@ struct BlockDriver {
|
|||
*/
|
||||
int coroutine_fn (*bdrv_co_pwritev)(BlockDriverState *bs,
|
||||
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags);
|
||||
int coroutine_fn (*bdrv_co_pwritev_part)(BlockDriverState *bs,
|
||||
uint64_t offset, uint64_t bytes,
|
||||
QEMUIOVector *qiov, size_t qiov_offset, int flags);
|
||||
|
||||
/*
|
||||
* Efficiently zero a region of the disk image. Typically an image format
|
||||
|
@ -339,6 +345,9 @@ struct BlockDriver {
|
|||
|
||||
int coroutine_fn (*bdrv_co_pwritev_compressed)(BlockDriverState *bs,
|
||||
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov);
|
||||
int coroutine_fn (*bdrv_co_pwritev_compressed_part)(BlockDriverState *bs,
|
||||
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov,
|
||||
size_t qiov_offset);
|
||||
|
||||
int (*bdrv_snapshot_create)(BlockDriverState *bs,
|
||||
QEMUSnapshotInfo *sn_info);
|
||||
|
@ -570,6 +579,12 @@ struct BlockDriver {
|
|||
const char *const *strong_runtime_opts;
|
||||
};
|
||||
|
||||
static inline bool block_driver_can_compress(BlockDriver *drv)
|
||||
{
|
||||
return drv->bdrv_co_pwritev_compressed ||
|
||||
drv->bdrv_co_pwritev_compressed_part;
|
||||
}
|
||||
|
||||
typedef struct BlockLimits {
|
||||
/* Alignment requirement, in bytes, for offset/length of I/O
|
||||
* requests. Must be a power of 2 less than INT_MAX; defaults to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue