mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
block: introduce zone append write for zoned devices
A zone append command is a write operation that specifies the first logical block of a zone as the write position. When writing to a zoned block device using zone append, the byte offset of the call may point at any position within the zone to which the data is being appended. Upon completion the device will respond with the position where the data has been written in the zone. Signed-off-by: Sam Li <faithilikerun@gmail.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20230508051510.177850-3-faithilikerun@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
a3c41f06d5
commit
4751d09adc
10 changed files with 173 additions and 8 deletions
|
@ -122,6 +122,10 @@ int coroutine_fn GRAPH_RDLOCK bdrv_co_zone_report(BlockDriverState *bs,
|
|||
int coroutine_fn GRAPH_RDLOCK bdrv_co_zone_mgmt(BlockDriverState *bs,
|
||||
BlockZoneOp op,
|
||||
int64_t offset, int64_t len);
|
||||
int coroutine_fn GRAPH_RDLOCK bdrv_co_zone_append(BlockDriverState *bs,
|
||||
int64_t *offset,
|
||||
QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags);
|
||||
|
||||
bool bdrv_can_write_zeroes_with_unmap(BlockDriverState *bs);
|
||||
int bdrv_block_status(BlockDriverState *bs, int64_t offset,
|
||||
|
|
|
@ -723,6 +723,9 @@ struct BlockDriver {
|
|||
BlockZoneDescriptor *zones);
|
||||
int coroutine_fn (*bdrv_co_zone_mgmt)(BlockDriverState *bs, BlockZoneOp op,
|
||||
int64_t offset, int64_t len);
|
||||
int coroutine_fn (*bdrv_co_zone_append)(BlockDriverState *bs,
|
||||
int64_t *offset, QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags);
|
||||
|
||||
/* removable device specific */
|
||||
bool coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_is_inserted)(
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define QEMU_AIO_TRUNCATE 0x0080
|
||||
#define QEMU_AIO_ZONE_REPORT 0x0100
|
||||
#define QEMU_AIO_ZONE_MGMT 0x0200
|
||||
#define QEMU_AIO_ZONE_APPEND 0x0400
|
||||
#define QEMU_AIO_TYPE_MASK \
|
||||
(QEMU_AIO_READ | \
|
||||
QEMU_AIO_WRITE | \
|
||||
|
@ -40,7 +41,8 @@
|
|||
QEMU_AIO_COPY_RANGE | \
|
||||
QEMU_AIO_TRUNCATE | \
|
||||
QEMU_AIO_ZONE_REPORT | \
|
||||
QEMU_AIO_ZONE_MGMT)
|
||||
QEMU_AIO_ZONE_MGMT | \
|
||||
QEMU_AIO_ZONE_APPEND)
|
||||
|
||||
/* AIO flags */
|
||||
#define QEMU_AIO_MISALIGNED 0x1000
|
||||
|
|
|
@ -53,6 +53,9 @@ BlockAIOCB *blk_aio_zone_report(BlockBackend *blk, int64_t offset,
|
|||
BlockAIOCB *blk_aio_zone_mgmt(BlockBackend *blk, BlockZoneOp op,
|
||||
int64_t offset, int64_t len,
|
||||
BlockCompletionFunc *cb, void *opaque);
|
||||
BlockAIOCB *blk_aio_zone_append(BlockBackend *blk, int64_t *offset,
|
||||
QEMUIOVector *qiov, BdrvRequestFlags flags,
|
||||
BlockCompletionFunc *cb, void *opaque);
|
||||
BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes,
|
||||
BlockCompletionFunc *cb, void *opaque);
|
||||
void blk_aio_cancel_async(BlockAIOCB *acb);
|
||||
|
@ -208,6 +211,12 @@ int coroutine_fn blk_co_zone_mgmt(BlockBackend *blk, BlockZoneOp op,
|
|||
int64_t offset, int64_t len);
|
||||
int co_wrapper_mixed blk_zone_mgmt(BlockBackend *blk, BlockZoneOp op,
|
||||
int64_t offset, int64_t len);
|
||||
int coroutine_fn blk_co_zone_append(BlockBackend *blk, int64_t *offset,
|
||||
QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags);
|
||||
int co_wrapper_mixed blk_zone_append(BlockBackend *blk, int64_t *offset,
|
||||
QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags);
|
||||
|
||||
int co_wrapper_mixed blk_pdiscard(BlockBackend *blk, int64_t offset,
|
||||
int64_t bytes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue