Split BlockBackend off BDS with an axe
Subsystems (3)
PATCH 11/23 block: Rename BlockDriverAIOCB* to BlockAIOCB*
In reply to Markus ArmbrusterI'll use BlockDriverAIOCB with block backends shortly, and the name is going to fit badly there. It's a block layer thing anyway, not just a block driver thing.
--- block-migration.c | 2 +- block.c | 151 ++++++++++++++++++++++---------------------- block/archipelago.c | 30 ++++----- block/backup.c | 2 +- block/blkdebug.c | 22 +++---- block/blkverify.c | 20 +++--- block/commit.c | 2 +- block/curl.c | 8 +-- block/iscsi.c | 8 +-- block/linux-aio.c | 8 +-- block/mirror.c | 6 +- block/qed-gencb.c | 4 +- block/qed-table.c | 10 +-- block/qed.c | 46 +++++++------- block/qed.h | 12 ++-- block/quorum.c | 38 +++++------ block/raw-aio.h | 8 +-- block/raw-posix.c | 32 +++++----- block/raw-win32.c | 16 ++--- block/raw_bsd.c | 8 +-- block/rbd.c | 58 ++++++++--------- block/sheepdog.c | 4 +- block/stream.c | 2 +- block/win32-aio.c | 8 +-- blockjob.c | 4 +- dma-helpers.c | 24 +++---- hw/block/nvme.h | 2 +- hw/ide/ahci.c | 2 +- hw/ide/ahci.h | 2 +- hw/ide/core.c | 12 ++-- hw/ide/internal.h | 12 ++-- hw/ide/macio.c | 2 +- hw/ide/pci.c | 2 +- hw/ide/pci.h | 2 +- hw/ppc/mac.h | 2 +- hw/scsi/scsi-generic.c | 2 +- include/block/aio.h | 12 ++-- include/block/block.h | 36 +++++------ include/block/block_int.h | 30 ++++----- include/block/blockjob.h | 4 +- include/block/thread-pool.h | 4 +- include/hw/scsi/scsi.h | 2 +- include/monitor/monitor.h | 4 +- include/sysemu/dma.h | 26 ++++---- monitor.c | 6 +- tests/test-thread-pool.c | 2 +- thread-pool.c | 8 +-- 47 files changed, 353 insertions(+), 354 deletions(-)
block-migration.c +1 -1
@@ -72,7 +72,7 @@ typedef struct BlkMigBlock {int nr_sectors;struct iovec iov;QEMUIOVector qiov; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;/* Protected by block migration lock. */ int ret;
block.c +75 -76
347 lines not on this page · raw message
block/archipelago.c +15 -15
@@ -87,7 +87,7 @@ typedef enum { } ARCHIPCmd; typedef struct ArchipelagoAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; struct BDRVArchipelagoState *s; QEMUIOVector *qiov;
@@ -724,7 +724,7 @@ static int qemu_archipelago_create(const char *filename,return ret; } -static void qemu_archipelago_aio_cancel (BlockDriverAIOCB *blockacb) +static void qemu_archipelago_aio_cancel (BlockAIOCB *blockacb) {ArchipelagoAIOCB *aio_cb = (ArchipelagoAIOCB *) blockacb; aio_cb->cancelled = true;
@@ -869,13 +869,13 @@ err_exit:return ret; } -static BlockDriverAIOCB *qemu_archipelago_aio_rw (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque, -int op) +static BlockAIOCB *qemu_archipelago_aio_rw (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque, +int op) {ArchipelagoAIOCB *aio_cb;BDRVArchipelagoState *s = bs->opaque;
@@ -908,17 +908,17 @@ err_exit:return NULL ; } -static BlockDriverAIOCB *qemu_archipelago_aio_readv (BlockDriverState *bs, +static BlockAIOCB *qemu_archipelago_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return qemu_archipelago_aio_rw (bs, sector_num, qiov, nb_sectors, cb, opaque,ARCHIP_OP_READ ); } -static BlockDriverAIOCB *qemu_archipelago_aio_writev (BlockDriverState *bs, +static BlockAIOCB *qemu_archipelago_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return qemu_archipelago_aio_rw (bs, sector_num, qiov, nb_sectors, cb, opaque,ARCHIP_OP_WRITE );
@@ -1008,8 +1008,8 @@ static QemuOptsList qemu_archipelago_create_opts = { } }; -static BlockDriverAIOCB *qemu_archipelago_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +static BlockAIOCB *qemu_archipelago_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque) {return qemu_archipelago_aio_rw (bs,0 ,NULL ,0 , cb, opaque,ARCHIP_OP_FLUSH );
block/backup.c +1 -1
@@ -353,7 +353,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, void *opaque, + BlockCompletionFunc *cb, void *opaque, Error **errp) { int64_t len;
block/blkdebug.c +11 -11
@@ -41,7 +41,7 @@ typedef struct BDRVBlkdebugState { } BDRVBlkdebugState;typedef struct BlkdebugAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;QEMUBH *bh;int ret; }BlkdebugAIOCB ;
@@ -52,7 +52,7 @@ typedef struct BlkdebugSuspendedReq {QLIST_ENTRY (BlkdebugSuspendedReq) next; } BlkdebugSuspendedReq; -static void blkdebug_aio_cancel (BlockDriverAIOCB *blockacb); +static void blkdebug_aio_cancel (BlockAIOCB *blockacb);static const AIOCBInfo blkdebug_aiocb_info = { .aiocb_size =sizeof (BlkdebugAIOCB),
@@ -450,7 +450,7 @@ static void error_callback_bh(void *opaque)qemu_aio_release (acb); } -static void blkdebug_aio_cancel (BlockDriverAIOCB *blockacb) +static void blkdebug_aio_cancel (BlockAIOCB *blockacb) {BlkdebugAIOCB *acb =container_of (blockacb, BlkdebugAIOCB, common);if (acb->bh) {
@@ -460,8 +460,8 @@ static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb)qemu_aio_release (acb); } -static BlockDriverAIOCB *inject_error (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque,BlkdebugRule *rule) +static BlockAIOCB *inject_error (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque,BlkdebugRule *rule) {BDRVBlkdebugState *s = bs->opaque;int error = rule->options.inject.error;
@@ -486,9 +486,9 @@ static BlockDriverAIOCB *inject_error(BlockDriverState *bs,return &acb->common; } -static BlockDriverAIOCB *blkdebug_aio_readv (BlockDriverState *bs, +static BlockAIOCB *blkdebug_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVBlkdebugState *s = bs->opaque;BlkdebugRule *rule =NULL ;
@@ -508,9 +508,9 @@ static BlockDriverAIOCB *blkdebug_aio_readv(BlockDriverState *bs,return bdrv_aio_readv (bs->file, sector_num, qiov, nb_sectors, cb, opaque); } -static BlockDriverAIOCB *blkdebug_aio_writev (BlockDriverState *bs, +static BlockAIOCB *blkdebug_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVBlkdebugState *s = bs->opaque;BlkdebugRule *rule =NULL ;
@@ -530,8 +530,8 @@ static BlockDriverAIOCB *blkdebug_aio_writev(BlockDriverState *bs,return bdrv_aio_writev (bs->file, sector_num, qiov, nb_sectors, cb, opaque); } -static BlockDriverAIOCB *blkdebug_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +static BlockAIOCB *blkdebug_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque) {BDRVBlkdebugState *s = bs->opaque;BlkdebugRule *rule =NULL ;
block/blkverify.c +10 -10
@@ -19,7 +19,7 @@ typedef struct {typedef struct BlkverifyAIOCB BlkverifyAIOCB ;struct BlkverifyAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;QEMUBH *bh;/* Request metadata */
@@ -38,7 +38,7 @@ struct BlkverifyAIOCB {void (*verify)(BlkverifyAIOCB *acb); }; -static void blkverify_aio_cancel (BlockDriverAIOCB *blockacb) +static void blkverify_aio_cancel (BlockAIOCB *blockacb) {BlkverifyAIOCB *acb = (BlkverifyAIOCB *)blockacb;AioContext *aio_context =bdrv_get_aio_context (blockacb->bs);
@@ -180,7 +180,7 @@ static int64_t blkverify_getlength(BlockDriverState *bs)static BlkverifyAIOCB *blkverify_aio_get (BlockDriverState *bs,bool is_write,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque) {BlkverifyAIOCB *acb =qemu_aio_get (&blkverify_aiocb_info, bs, cb, opaque);
@@ -248,9 +248,9 @@ static void blkverify_verify_readv(BlkverifyAIOCB *acb) } } -static BlockDriverAIOCB *blkverify_aio_readv (BlockDriverState *bs, +static BlockAIOCB *blkverify_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, false, sector_num, qiov,
@@ -268,9 +268,9 @@ static BlockDriverAIOCB *blkverify_aio_readv(BlockDriverState *bs,return &acb->common; } -static BlockDriverAIOCB *blkverify_aio_writev (BlockDriverState *bs, +static BlockAIOCB *blkverify_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov,
@@ -283,9 +283,9 @@ static BlockDriverAIOCB *blkverify_aio_writev(BlockDriverState *bs,return &acb->common; } -static BlockDriverAIOCB *blkverify_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *blkverify_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb, +void *opaque) {BDRVBlkverifyState *s = bs->opaque;
block/commit.c +1 -1
@@ -182,7 +182,7 @@ static const BlockJobDriver commit_job_driver = {void commit_start (BlockDriverState *bs,BlockDriverState *base,BlockDriverState *top,int64_t speed, -BlockdevOnError on_error,BlockDriverCompletionFunc *cb, +BlockdevOnError on_error,BlockCompletionFunc *cb,void *opaque,const char *backing_file_str,Error **errp) {CommitBlockJob *s;
block/curl.c +4 -4
@@ -78,7 +78,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,struct BDRVCURLState ; typedef struct CURLAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; QEMUIOVector *qiov;
@@ -613,7 +613,7 @@ out_noclean:return -EINVAL ; } -static void curl_aio_cancel (BlockDriverAIOCB *blockacb) +static void curl_aio_cancel (BlockAIOCB *blockacb) {// Do we have to implement canceling? Seems to work without... }
@@ -686,9 +686,9 @@ static void curl_readv_bh_cb(void *p)curl_multi_socket_action (s->multi,CURL_SOCKET_TIMEOUT ,0 , &running); } -static BlockDriverAIOCB *curl_aio_readv (BlockDriverState *bs, +static BlockAIOCB *curl_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {CURLAIOCB *acb;
block/iscsi.c +4 -4
@@ -81,7 +81,7 @@ typedef struct IscsiTask { } IscsiTask; typedef struct IscsiAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUIOVector *qiov; QEMUBH *bh; IscsiLun *iscsilun;
@@ -231,7 +231,7 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, }static void -iscsi_aio_cancel (BlockDriverAIOCB *blockacb) +iscsi_aio_cancel (BlockAIOCB *blockacb) {IscsiAIOCB *acb = (IscsiAIOCB *)blockacb;IscsiLun *iscsilun = acb->iscsilun;
@@ -669,9 +669,9 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status,iscsi_schedule_bh (acb); } -static BlockDriverAIOCB *iscsi_aio_ioctl (BlockDriverState *bs, +static BlockAIOCB *iscsi_aio_ioctl (BlockDriverState *bs,unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {IscsiLun *iscsilun = bs->opaque;struct iscsi_context *iscsi = iscsilun->iscsi;
block/linux-aio.c +4 -4
@@ -28,7 +28,7 @@#define MAX_QUEUED_IO 128struct qemu_laiocb { -BlockDriverAIOCB common; +BlockAIOCB common;struct qemu_laio_state *ctx;struct iocb iocb;ssize_t ret;
@@ -147,7 +147,7 @@ static void qemu_laio_completion_cb(EventNotifier *e) } } -static void laio_cancel (BlockDriverAIOCB *blockacb) +static void laio_cancel (BlockAIOCB *blockacb) {struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;struct io_event event;
@@ -257,9 +257,9 @@ int laio_io_unplug(BlockDriverState *bs, void *aio_ctx, bool unplug)return ret; } -BlockDriverAIOCB *laio_submit (BlockDriverState *bs,void *aio_ctx,int fd, +BlockAIOCB *laio_submit (BlockDriverState *bs,void *aio_ctx,int fd,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {struct qemu_laio_state *s = aio_ctx;struct qemu_laiocb *laiocb;
block/mirror.c +3 -3
@@ -613,7 +613,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,int64_t buf_size, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, bool is_none_mode, BlockDriverState *base)
@@ -673,7 +673,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, int64_t granularity, int64_t buf_size, MirrorSyncMode mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp) { bool is_none_mode;
@@ -690,7 +690,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target,void commit_active_start (BlockDriverState *bs,BlockDriverState *base,int64_t speed,BlockdevOnError on_error, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque,Error **errp) {int64_t length, base_length;
block/qed-gencb.c +2 -2
@@ -13,7 +13,7 @@#include "qed.h" -void *gencb_alloc (size_t len,BlockDriverCompletionFunc *cb,void *opaque) +void *gencb_alloc (size_t len,BlockCompletionFunc *cb,void *opaque) {GenericCB *gencb =g_malloc (len); gencb->cb = cb;
@@ -24,7 +24,7 @@ void *gencb_alloc(size_t len, BlockDriverCompletionFunc *cb, void *opaque)void gencb_complete (void *opaque,int ret) {GenericCB *gencb = opaque; -BlockDriverCompletionFunc *cb = gencb->cb; +BlockCompletionFunc *cb = gencb->cb;void *user_opaque = gencb->opaque;g_free (gencb);
block/qed-table.c +5 -5
@@ -49,7 +49,7 @@ out: }static void qed_read_table (BDRVQEDState *s,uint64_t offset,QEDTable *table, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {QEDReadTableCB *read_table_cb =gencb_alloc (sizeof (*read_table_cb), cb, opaque);
@@ -119,7 +119,7 @@ out:*/ static void qed_write_table (BDRVQEDState *s,uint64_t offset,QEDTable *table,unsigned int index,unsigned int n,bool flush, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {QEDWriteTableCB *write_table_cb;unsigned int sector_mask =BDRV_SECTOR_SIZE /sizeof (uint64_t ) -1 ;
@@ -180,7 +180,7 @@ int qed_read_l1_table_sync(BDRVQEDState *s) }void qed_write_l1_table (BDRVQEDState *s,unsigned int index,unsigned int n, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BLKDBG_EVENT (s->bs->file,BLKDBG_L1_UPDATE ); qed_write_table(s, s->header.l1_table_offset,
@@ -235,7 +235,7 @@ static void qed_read_l2_table_cb(void *opaque, int ret) }void qed_read_l2_table (BDRVQEDState *s,QEDRequest *request,uint64_t offset, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {QEDReadL2TableCB *read_l2_table_cb;
@@ -275,7 +275,7 @@ int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offsetvoid qed_write_l2_table (BDRVQEDState *s,QEDRequest *request,unsigned int index,unsigned int n,bool flush, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BLKDBG_EVENT (s->bs->file,BLKDBG_L2_UPDATE ); qed_write_table(s, request->l2_table->offset,
block/qed.c +23 -23
110 lines not on this page · raw message
block/qed.h +6 -6
@@ -128,7 +128,7 @@ enum { }; typedef struct QEDAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; int bh_ret; /* final return status for completion bh */ QSIMPLEQ_ENTRY(QEDAIOCB) next; /* next request */
@@ -203,11 +203,11 @@ typedef void QEDFindClusterFunc(void *opaque, int ret, uint64_t offset, size_t l* Generic callback for chaining async callbacks */ typedef struct { -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;void *opaque; }GenericCB ; -void *gencb_alloc (size_t len,BlockDriverCompletionFunc *cb,void *opaque); +void *gencb_alloc (size_t len,BlockCompletionFunc *cb,void *opaque);void gencb_complete (void *opaque,int ret);/**
@@ -230,16 +230,16 @@ void qed_commit_l2_cache_entry(L2TableCache *l2_cache, CachedL2Table *l2_table);*/ int qed_read_l1_table_sync (BDRVQEDState *s);void qed_write_l1_table (BDRVQEDState *s,unsigned int index,unsigned int n, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);int qed_write_l1_table_sync (BDRVQEDState *s,unsigned int index,unsigned int n);int qed_read_l2_table_sync (BDRVQEDState *s,QEDRequest *request,uint64_t offset);void qed_read_l2_table (BDRVQEDState *s,QEDRequest *request,uint64_t offset, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);void qed_write_l2_table (BDRVQEDState *s,QEDRequest *request,unsigned int index,unsigned int n,bool flush, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);int qed_write_l2_table_sync (BDRVQEDState *s,QEDRequest *request,unsigned int index,unsigned int n,bool flush);
block/quorum.c +19 -19
@@ -92,7 +92,7 @@ typedef struct QuorumAIOCB QuorumAIOCB;* $children_count QuorumChildRequest. */ typedef struct QuorumChildRequest { - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; QEMUIOVector qiov; uint8_t *buf; int ret;
@@ -105,7 +105,7 @@ typedef struct QuorumChildRequest {* used to do operations on each children and track overall progress. */ struct QuorumAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;/* Request metadata */ uint64_t sector_num;
@@ -130,7 +130,7 @@ struct QuorumAIOCB {static bool quorum_vote (QuorumAIOCB *acb); -static void quorum_aio_cancel (BlockDriverAIOCB *blockacb) +static void quorum_aio_cancel (BlockAIOCB *blockacb) {QuorumAIOCB *acb =container_of (blockacb, QuorumAIOCB, common);BDRVQuorumState *s = acb->common.bs->opaque;
@@ -187,7 +187,7 @@ static QuorumAIOCB *quorum_aio_get(BDRVQuorumState *s,QEMUIOVector *qiov, uint64_t sector_num, int nb_sectors, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque) { QuorumAIOCB *acb = qemu_aio_get(&quorum_aiocb_info, bs, cb, opaque);
@@ -265,7 +265,7 @@ static void quorum_rewrite_aio_cb(void *opaque, int ret)quorum_aio_finalize (acb); } -static BlockDriverAIOCB *read_fifo_child (QuorumAIOCB *acb); +static BlockAIOCB *read_fifo_child (QuorumAIOCB *acb);static void quorum_copy_qiov (QEMUIOVector *dest,QEMUIOVector *source) {
@@ -641,7 +641,7 @@ free_exit:return rewrite; } -static BlockDriverAIOCB *read_quorum_children (QuorumAIOCB *acb) +static BlockAIOCB *read_quorum_children (QuorumAIOCB *acb) {BDRVQuorumState *s = acb->common.bs->opaque;int i;
@@ -660,7 +660,7 @@ static BlockDriverAIOCB *read_quorum_children(QuorumAIOCB *acb)return &acb->common; } -static BlockDriverAIOCB *read_fifo_child (QuorumAIOCB *acb) +static BlockAIOCB *read_fifo_child (QuorumAIOCB *acb) {BDRVQuorumState *s = acb->common.bs->opaque;
@@ -676,12 +676,12 @@ static BlockDriverAIOCB *read_fifo_child(QuorumAIOCB *acb)return &acb->common; } -static BlockDriverAIOCB *quorum_aio_readv (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *quorum_aio_readv (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque) {BDRVQuorumState *s = bs->opaque; QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num,
@@ -697,12 +697,12 @@ static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs,return read_fifo_child (acb); } -static BlockDriverAIOCB *quorum_aio_writev (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *quorum_aio_writev (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque) {BDRVQuorumState *s = bs->opaque; QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num, nb_sectors,
block/raw-aio.h +4 -4
@@ -35,9 +35,9 @@#ifdef CONFIG_LINUX_AIO void *laio_init (void );void laio_cleanup (void *s); -BlockDriverAIOCB *laio_submit (BlockDriverState *bs,void *aio_ctx,int fd, +BlockAIOCB *laio_submit (BlockDriverState *bs,void *aio_ctx,int fd,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type); +BlockCompletionFunc *cb,void *opaque,int type);void laio_detach_aio_context (void *s,AioContext *old_context);void laio_attach_aio_context (void *s,AioContext *new_context);void laio_io_plug (BlockDriverState *bs,void *aio_ctx);
@@ -49,10 +49,10 @@ typedef struct QEMUWin32AIOState QEMUWin32AIOState;QEMUWin32AIOState *win32_aio_init (void );void win32_aio_cleanup (QEMUWin32AIOState *aio);int win32_aio_attach (QEMUWin32AIOState *aio,HANDLE hfile); -BlockDriverAIOCB *win32_aio_submit (BlockDriverState *bs, +BlockAIOCB *win32_aio_submit (BlockDriverState *bs,QEMUWin32AIOState *aio,HANDLE hfile,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type); +BlockCompletionFunc *cb,void *opaque,int type);void win32_aio_detach_aio_context (QEMUWin32AIOState *aio,AioContext *old_context); void win32_aio_attach_aio_context(QEMUWin32AIOState *aio,
block/raw-posix.c +16 -16
@@ -1040,9 +1040,9 @@ static int paio_submit_co(BlockDriverState *bs, int fd,return thread_pool_submit_co (pool, aio_worker, acb); } -static BlockDriverAIOCB *paio_submit (BlockDriverState *bs,int fd, +static BlockAIOCB *paio_submit (BlockDriverState *bs,int fd,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {RawPosixAIOData *acb =g_slice_new (RawPosixAIOData);ThreadPool *pool;
@@ -1065,9 +1065,9 @@ static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd,return thread_pool_submit_aio (pool, aio_worker, acb, cb, opaque); } -static BlockDriverAIOCB *raw_aio_submit (BlockDriverState *bs, +static BlockAIOCB *raw_aio_submit (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {BDRVRawState *s = bs->opaque;
@@ -1124,24 +1124,24 @@ static void raw_aio_flush_io_queue(BlockDriverState *bs)#endif } -static BlockDriverAIOCB *raw_aio_readv (BlockDriverState *bs, +static BlockAIOCB *raw_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return raw_aio_submit (bs, sector_num, qiov, nb_sectors, cb, opaque,QEMU_AIO_READ ); } -static BlockDriverAIOCB *raw_aio_writev (BlockDriverState *bs, +static BlockAIOCB *raw_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return raw_aio_submit (bs, sector_num, qiov, nb_sectors, cb, opaque,QEMU_AIO_WRITE ); } -static BlockDriverAIOCB *raw_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +static BlockAIOCB *raw_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;
@@ -1536,9 +1536,9 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs,return ret; } -static coroutine_fn BlockDriverAIOCB *raw_aio_discard(BlockDriverState *bs, +static coroutine_fn BlockAIOCB *raw_aio_discard(BlockDriverState *bs,int64_t sector_num,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;
@@ -1871,9 +1871,9 @@ static int hdev_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)return ioctl (s->fd, req, buf); } -static BlockDriverAIOCB *hdev_aio_ioctl (BlockDriverState *bs, +static BlockAIOCB *hdev_aio_ioctl (BlockDriverState *bs,unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;RawPosixAIOData *acb;
@@ -1912,9 +1912,9 @@ static int fd_open(BlockDriverState *bs)#endif /* !linux && !FreeBSD */ -static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs, +static coroutine_fn BlockAIOCB *hdev_aio_discard(BlockDriverState *bs,int64_t sector_num,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;
block/raw-win32.c +8 -8
@@ -138,9 +138,9 @@ static int aio_worker(void *arg)return ret; } -static BlockDriverAIOCB *paio_submit (BlockDriverState *bs,HANDLE hfile, +static BlockAIOCB *paio_submit (BlockDriverState *bs,HANDLE hfile,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {RawWin32AIOData *acb =g_slice_new (RawWin32AIOData);ThreadPool *pool;
@@ -369,9 +369,9 @@ fail:return ret; } -static BlockDriverAIOCB *raw_aio_readv (BlockDriverState *bs, +static BlockAIOCB *raw_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;if (s->aio) {
@@ -383,9 +383,9 @@ static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, } } -static BlockDriverAIOCB *raw_aio_writev (BlockDriverState *bs, +static BlockAIOCB *raw_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;if (s->aio) {
@@ -397,8 +397,8 @@ static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, } } -static BlockDriverAIOCB *raw_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +static BlockAIOCB *raw_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;return paio_submit (bs, s->hfile,0 ,NULL ,0 , cb, opaque,QEMU_AIO_FLUSH );
block/raw_bsd.c +4 -4
@@ -129,10 +129,10 @@ static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)return bdrv_ioctl (bs->file, req, buf); } -static BlockDriverAIOCB *raw_aio_ioctl (BlockDriverState *bs, -unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *raw_aio_ioctl (BlockDriverState *bs, +unsigned long int req,void *buf, +BlockCompletionFunc *cb, +void *opaque) {return bdrv_aio_ioctl (bs->file, req, buf, cb, opaque); }
block/rbd.c +29 -29
99 lines not on this page · raw message
block/sheepdog.c +2 -2
@@ -301,7 +301,7 @@ enum AIOCBState { };struct SheepdogAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;QEMUIOVector *qiov;
@@ -477,7 +477,7 @@ static bool sd_acb_cancelable(const SheepdogAIOCB *acb)return true; } -static void sd_aio_cancel (BlockDriverAIOCB *blockacb) +static void sd_aio_cancel (BlockAIOCB *blockacb) {SheepdogAIOCB *acb = (SheepdogAIOCB *)blockacb;BDRVSheepdogState *s = acb->common.bs->opaque;
block/stream.c +1 -1
@@ -220,7 +220,7 @@ static const BlockJobDriver stream_job_driver = {void stream_start (BlockDriverState *bs,BlockDriverState *base,const char *backing_file_str,int64_t speed,BlockdevOnError on_error, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque,Error **errp) {StreamBlockJob *s;
block/win32-aio.c +4 -4
@@ -44,7 +44,7 @@ struct QEMUWin32AIOState { }; typedef struct QEMUWin32AIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; struct QEMUWin32AIOState *ctx; int nbytes; OVERLAPPED ov;
@@ -106,7 +106,7 @@ static void win32_aio_completion_cb(EventNotifier *e) } } -static void win32_aio_cancel (BlockDriverAIOCB *blockacb) +static void win32_aio_cancel (BlockAIOCB *blockacb) {QEMUWin32AIOCB *waiocb = (QEMUWin32AIOCB *)blockacb;
@@ -124,10 +124,10 @@ static const AIOCBInfo win32_aiocb_info = { .cancel = win32_aio_cancel, }; -BlockDriverAIOCB *win32_aio_submit (BlockDriverState *bs, +BlockAIOCB *win32_aio_submit (BlockDriverState *bs,QEMUWin32AIOState *aio,HANDLE hfile,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {struct QEMUWin32AIOCB *waiocb;uint64_t offset = sector_num *512 ;
blockjob.c +2 -2
@@ -36,7 +36,7 @@#include "qapi-event.h" void *block_job_create (const BlockJobDriver *driver,BlockDriverState *bs, -int64_t speed,BlockDriverCompletionFunc *cb, +int64_t speed,BlockCompletionFunc *cb,void *opaque,Error **errp) {BlockJob *job;
@@ -155,7 +155,7 @@ void block_job_iostatus_reset(BlockJob *job)struct BlockCancelData {BlockJob *job; -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;void *opaque;bool cancelled;int ret;
dma-helpers.c +12 -12
@@ -67,9 +67,9 @@ void qemu_sglist_destroy(QEMUSGList *qsg) } typedef struct { - BlockDriverAIOCB common; + BlockAIOCB common; BlockDriverState *bs; - BlockDriverAIOCB *acb; + BlockAIOCB *acb; QEMUSGList *sg; uint64_t sector_num; DMADirection dir;
@@ -179,14 +179,14 @@ static void dma_bdrv_cb(void *opaque, int ret)assert (dbs->acb); } -static void dma_aio_cancel (BlockDriverAIOCB *acb) +static void dma_aio_cancel (BlockAIOCB *acb) {DMAAIOCB *dbs =container_of (acb,DMAAIOCB , common);trace_dma_aio_cancel (dbs);if (dbs->acb) { -BlockDriverAIOCB *acb = dbs->acb; +BlockAIOCB *acb = dbs->acb; dbs->acb =NULL ; dbs->in_cancel = true;bdrv_aio_cancel (acb);
@@ -201,9 +201,9 @@ static const AIOCBInfo dma_aiocb_info = { .cancel = dma_aio_cancel, }; -BlockDriverAIOCB *dma_bdrv_io ( +BlockAIOCB *dma_bdrv_io (BlockDriverState *bs,QEMUSGList *sg,uint64_t sector_num, -DMAIOFunc *io_func,BlockDriverCompletionFunc *cb, +DMAIOFunc *io_func,BlockCompletionFunc *cb,void *opaque,DMADirection dir) {DMAAIOCB *dbs =qemu_aio_get (&dma_aiocb_info, bs, cb, opaque);
@@ -226,17 +226,17 @@ BlockDriverAIOCB *dma_bdrv_io( } -BlockDriverAIOCB *dma_bdrv_read (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector, -void (*cb)(void *opaque,int ret),void *opaque) +BlockAIOCB *dma_bdrv_read (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector, +void (*cb)(void *opaque,int ret),void *opaque) {return dma_bdrv_io (bs, sg, sector, bdrv_aio_readv, cb, opaque,DMA_DIRECTION_FROM_DEVICE ); } -BlockDriverAIOCB *dma_bdrv_write (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector, -void (*cb)(void *opaque,int ret),void *opaque) +BlockAIOCB *dma_bdrv_write (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector, +void (*cb)(void *opaque,int ret),void *opaque) {return dma_bdrv_io (bs, sg, sector, bdrv_aio_writev, cb, opaque,DMA_DIRECTION_TO_DEVICE );
hw/block/nvme.h +1 -1
@@ -636,7 +636,7 @@ typedef struct NvmeAsyncEvent { typedef struct NvmeRequest { struct NvmeSQueue *sq; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; uint16_t status; NvmeCqe cqe; BlockAcctCookie acct;
hw/ide/ahci.c +1 -1
@@ -1104,7 +1104,7 @@ out: }static void ahci_start_dma (IDEDMA *dma,IDEState *s, -BlockDriverCompletionFunc *dma_cb) +BlockCompletionFunc *dma_cb) {#ifdef DEBUG_AHCI AHCIDevice *ad =DO_UPCAST (AHCIDevice, dma, dma);
hw/ide/ahci.h +1 -1
@@ -241,7 +241,7 @@ typedef struct AHCIDevice AHCIDevice; typedef struct NCQTransferState { AHCIDevice *drive; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; QEMUSGList sglist; BlockAcctCookie acct; uint16_t sector_count;
hw/ide/core.c +6 -6
@@ -360,15 +360,15 @@ static void ide_set_signature(IDEState *s) }typedef struct TrimAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;QEMUBH *bh;int ret;QEMUIOVector *qiov; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;int i, j; }TrimAIOCB ; -static void trim_aio_cancel (BlockDriverAIOCB *acb) +static void trim_aio_cancel (BlockAIOCB *acb) {TrimAIOCB *iocb =container_of (acb, TrimAIOCB, common);
@@ -440,9 +440,9 @@ static void ide_issue_trim_cb(void *opaque, int ret) } } -BlockDriverAIOCB *ide_issue_trim (BlockDriverState *bs, +BlockAIOCB *ide_issue_trim (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {TrimAIOCB *iocb;
@@ -784,7 +784,7 @@ static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)ide_start_dma (s, ide_dma_cb); } -void ide_start_dma (IDEState *s,BlockDriverCompletionFunc *cb) +void ide_start_dma (IDEState *s,BlockCompletionFunc *cb) {if (s->bus->dma->ops->start_dma) { s->bus->dma->ops->start_dma (s->bus->dma, s, cb);
hw/ide/internal.h +6 -6
@@ -319,7 +319,7 @@ typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind;typedef void EndTransferFunc (IDEState *); -typedef void DMAStartFunc (IDEDMA *,IDEState *,BlockDriverCompletionFunc *); +typedef void DMAStartFunc (IDEDMA *,IDEState *,BlockCompletionFunc *);typedef void DMAVoidFunc (IDEDMA *);typedef int DMAIntFunc (IDEDMA *,int );typedef void DMAStopFunc (IDEDMA *,bool );
@@ -389,7 +389,7 @@ struct IDEState {int cd_sector_size;int atapi_dma;/* true if dma is requested for the packet cmd */ BlockAcctCookie acct; -BlockDriverAIOCB *pio_aiocb; +BlockAIOCB *pio_aiocb;struct iovec iov;QEMUIOVector qiov;/* ATA DMA state */
@@ -442,7 +442,7 @@ struct IDEDMA {const struct IDEDMAOps *ops;struct iovec iov;QEMUIOVector qiov; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb; };struct IDEBus {
@@ -521,7 +521,7 @@ void ide_bus_reset(IDEBus *bus);int64_t ide_get_sector (IDEState *s);void ide_set_sector (IDEState *s,int64_t sector_num); -void ide_start_dma (IDEState *s,BlockDriverCompletionFunc *cb); +void ide_start_dma (IDEState *s,BlockCompletionFunc *cb);void ide_dma_error (IDEState *s);void ide_atapi_cmd_ok (IDEState *s);
@@ -555,9 +555,9 @@ void ide_transfer_start(IDEState *s, uint8_t *buf, int size, EndTransferFunc *end_transfer_func);void ide_transfer_stop (IDEState *s);void ide_set_inactive (IDEState *s,bool more); -BlockDriverAIOCB *ide_issue_trim (BlockDriverState *bs, +BlockAIOCB *ide_issue_trim (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);/* hw/ide/atapi.c */ void ide_atapi_cmd (IDEState *s);
hw/ide/macio.c +1 -1
@@ -555,7 +555,7 @@ static void ide_nop_restart(void *opaque, int x, RunState y) }static void ide_dbdma_start (IDEDMA *dma,IDEState *s, -BlockDriverCompletionFunc *cb) +BlockCompletionFunc *cb) {MACIOIDEState *m =container_of (dma, MACIOIDEState, dma);
hw/ide/pci.c +1 -1
@@ -38,7 +38,7 @@ IDE_RETRY_READ | IDE_RETRY_FLUSH)static void bmdma_start_dma (IDEDMA *dma,IDEState *s, -BlockDriverCompletionFunc *dma_cb) +BlockCompletionFunc *dma_cb) {BMDMAState *bm =DO_UPCAST (BMDMAState, dma, dma);
hw/ide/pci.h +1 -1
@@ -23,7 +23,7 @@ typedef struct BMDMAState {uint32_t cur_prd_addr;uint32_t cur_prd_len;uint8_t unit; -BlockDriverCompletionFunc *dma_cb; +BlockCompletionFunc *dma_cb;int64_t sector_num;uint32_t nsector;MemoryRegion addr_ioport;
hw/ppc/mac.h +1 -1
@@ -131,7 +131,7 @@ typedef struct MACIOIDEState {MemoryRegion mem;IDEBus bus; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;IDEDMA dma;void *dbdma;bool dma_active;
hw/scsi/scsi-generic.c +1 -1
@@ -157,7 +157,7 @@ static void scsi_cancel_io(SCSIRequest *req)static int execute_command (BlockDriverState *bdrv,SCSIGenericReq *r,int direction, -BlockDriverCompletionFunc *complete) +BlockCompletionFunc *complete) { r->io_header.interface_id ='S' ; r->io_header.dxfer_direction = direction;
include/block/aio.h +6 -6
@@ -22,23 +22,23 @@#include "qemu/rfifolock.h" #include "qemu/timer.h" -typedef struct BlockDriverAIOCB BlockDriverAIOCB ; -typedef void BlockDriverCompletionFunc (void *opaque,int ret); +typedef struct BlockAIOCB BlockAIOCB ; +typedef void BlockCompletionFunc (void *opaque,int ret);typedef struct AIOCBInfo { -void (*cancel)(BlockDriverAIOCB *acb); +void (*cancel)(BlockAIOCB *acb);size_t aiocb_size; }AIOCBInfo ; -struct BlockDriverAIOCB { +struct BlockAIOCB {const AIOCBInfo *aiocb_info;BlockDriverState *bs; -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;void *opaque; };void *qemu_aio_get (const AIOCBInfo *aiocb_info,BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);void qemu_aio_release (void *p);typedef struct AioHandler AioHandler ;
include/block/block.h +18 -18
@@ -246,9 +246,9 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors);int bdrv_write_zeroes (BlockDriverState *bs,int64_t sector_num,int nb_sectors,BdrvRequestFlags flags); -BlockDriverAIOCB *bdrv_aio_write_zeroes (BlockDriverState *bs,int64_t sector_num, -int nb_sectors,BdrvRequestFlags flags, -BlockDriverCompletionFunc *cb,void *opaque); +BlockAIOCB *bdrv_aio_write_zeroes (BlockDriverState *bs,int64_t sector_num, +int nb_sectors,BdrvRequestFlags flags, +BlockCompletionFunc *cb,void *opaque);int bdrv_make_zero (BlockDriverState *bs,BdrvRequestFlags flags);int bdrv_pread (BlockDriverState *bs,int64_t offset,void *buf,int count);
@@ -324,18 +324,18 @@ BlockDriverState *check_to_replace_node(const char *node_name, Error **errp);/* async block I/O */ typedef void BlockDriverDirtyHandler (BlockDriverState *bs,int64_t sector,int sector_num); -BlockDriverAIOCB *bdrv_aio_readv (BlockDriverState *bs,int64_t sector_num, -QEMUIOVector *iov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *bdrv_aio_writev (BlockDriverState *bs,int64_t sector_num, -QEMUIOVector *iov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *bdrv_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *bdrv_aio_discard (BlockDriverState *bs, -int64_t sector_num,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); -void bdrv_aio_cancel (BlockDriverAIOCB *acb); +BlockAIOCB *bdrv_aio_readv (BlockDriverState *bs,int64_t sector_num, +QEMUIOVector *iov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *bdrv_aio_writev (BlockDriverState *bs,int64_t sector_num, +QEMUIOVector *iov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *bdrv_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *bdrv_aio_discard (BlockDriverState *bs, +int64_t sector_num,int nb_sectors, +BlockCompletionFunc *cb,void *opaque); +void bdrv_aio_cancel (BlockAIOCB *acb); typedef struct BlockRequest { /* Fields to be filled by multiwrite caller */
@@ -343,7 +343,7 @@ typedef struct BlockRequest {int nb_sectors;int flags;QEMUIOVector *qiov; -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;void *opaque;/* Filled by multiwrite implementation */
@@ -355,9 +355,9 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs,/* sg packet commands */ int bdrv_ioctl (BlockDriverState *bs,unsigned long int req,void *buf); -BlockDriverAIOCB *bdrv_aio_ioctl (BlockDriverState *bs, +BlockAIOCB *bdrv_aio_ioctl (BlockDriverState *bs,unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);/* Invalidate any cached metadata used by image formats */ void bdrv_invalidate_cache (BlockDriverState *bs,Error **errp);
include/block/block_int.h +15 -15
@@ -127,17 +127,17 @@ struct BlockDriver {void (*bdrv_refresh_filename)(BlockDriverState *bs);/* aio */ -BlockDriverAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs, +BlockAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); - BlockDriverAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque); -BlockDriverAIOCB *(*bdrv_aio_discard)(BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque); + BlockAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque); +BlockAIOCB *(*bdrv_aio_discard)(BlockDriverState *bs,int64_t sector_num,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque); int coroutine_fn (*bdrv_co_readv)(BlockDriverState *bs,int64_t sector_num,int nb_sectors,QEMUIOVector *qiov);
@@ -217,9 +217,9 @@ struct BlockDriver {/* to control generic scsi devices */ int (*bdrv_ioctl)(BlockDriverState *bs,unsigned long int req,void *buf); -BlockDriverAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs, +BlockAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs,unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);/* List of options for creating images, terminated by name == NULL */ QemuOptsList *create_opts;
@@ -501,7 +501,7 @@ int is_windows_drive(const char *filename);*/ void stream_start (BlockDriverState *bs,BlockDriverState *base,const char *base_id,int64_t speed,BlockdevOnError on_error, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque,Error **errp);/**
@@ -519,7 +519,7 @@ void stream_start(BlockDriverState *bs, BlockDriverState *base,*/ void commit_start (BlockDriverState *bs,BlockDriverState *base,BlockDriverState *top,int64_t speed, -BlockdevOnError on_error,BlockDriverCompletionFunc *cb, +BlockdevOnError on_error,BlockCompletionFunc *cb,void *opaque,const char *backing_file_str,Error **errp);/** * commit_active_start:
@@ -535,7 +535,7 @@ void commit_start(BlockDriverState *bs, BlockDriverState *base,void commit_active_start (BlockDriverState *bs,BlockDriverState *base,int64_t speed,BlockdevOnError on_error, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque,Error **errp);/* * mirror_start:
@@ -563,7 +563,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, int64_t granularity, int64_t buf_size, MirrorSyncMode mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp);/*
@@ -584,7 +584,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, void *opaque, + BlockCompletionFunc *cb, void *opaque, Error **errp);#endif /* BLOCK_INT_H */
include/block/blockjob.h +2 -2
@@ -104,7 +104,7 @@ struct BlockJob {int64_t speed;/** The completion function that will be called when the job completes. */ -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;/** Block other operations when block job is running */ Error *blocker;
@@ -132,7 +132,7 @@ struct BlockJob {* called from a wrapper that is specific to the job type. */ void *block_job_create (const BlockJobDriver *driver,BlockDriverState *bs, -int64_t speed,BlockDriverCompletionFunc *cb, +int64_t speed,BlockCompletionFunc *cb,void *opaque,Error **errp);/**
include/block/thread-pool.h +2 -2
@@ -27,9 +27,9 @@ typedef struct ThreadPool ThreadPool;ThreadPool *thread_pool_new (struct AioContext *ctx);void thread_pool_free (ThreadPool *pool); -BlockDriverAIOCB *thread_pool_submit_aio (ThreadPool *pool, +BlockAIOCB *thread_pool_submit_aio (ThreadPool *pool,ThreadPoolFunc *func,void *arg, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque); int coroutine_fn thread_pool_submit_co(ThreadPool *pool, ThreadPoolFunc *func, void *arg);void thread_pool_submit (ThreadPool *pool,ThreadPoolFunc *func,void *arg);
include/hw/scsi/scsi.h +1 -1
@@ -52,7 +52,7 @@ struct SCSIRequest {uint32_t status;size_t resid;SCSICommand cmd; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;QEMUSGList *sg;bool dma_started;uint8_t sense[SCSI_SENSE_BUF_SIZE ];
include/monitor/monitor.h +2 -2
@@ -27,10 +27,10 @@ int monitor_suspend(Monitor *mon);void monitor_resume (Monitor *mon);int monitor_read_bdrv_key_start (Monitor *mon,BlockDriverState *bs, -BlockDriverCompletionFunc *completion_cb, +BlockCompletionFunc *completion_cb,void *opaque);int monitor_read_block_device_key (Monitor *mon,const char *device, -BlockDriverCompletionFunc *completion_cb, +BlockCompletionFunc *completion_cb,void *opaque);int monitor_get_fd (Monitor *mon,const char *fdname,Error **errp);
include/sysemu/dma.h +13 -13
@@ -196,20 +196,20 @@ void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len);void qemu_sglist_destroy (QEMUSGList *qsg);#endif -typedef BlockDriverAIOCB *DMAIOFunc (BlockDriverState *bs,int64_t sector_num, -QEMUIOVector *iov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); +typedef BlockAIOCB *DMAIOFunc (BlockDriverState *bs,int64_t sector_num, +QEMUIOVector *iov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *dma_bdrv_io (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector_num, -DMAIOFunc *io_func,BlockDriverCompletionFunc *cb, -void *opaque,DMADirection dir); -BlockDriverAIOCB *dma_bdrv_read (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *dma_bdrv_write (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector, -BlockDriverCompletionFunc *cb,void *opaque); +BlockAIOCB *dma_bdrv_io (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector_num, +DMAIOFunc *io_func,BlockCompletionFunc *cb, +void *opaque,DMADirection dir); +BlockAIOCB *dma_bdrv_read (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *dma_bdrv_write (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector, +BlockCompletionFunc *cb,void *opaque);uint64_t dma_buf_read (uint8_t *ptr,int32_t len,QEMUSGList *sg);uint64_t dma_buf_write (uint8_t *ptr,int32_t len,QEMUSGList *sg);
monitor.c +3 -3
@@ -206,7 +206,7 @@ struct Monitor {ReadLineState *rs;MonitorControl *mc;CPUState *mon_cpu; -BlockDriverCompletionFunc *password_completion_cb; +BlockCompletionFunc *password_completion_cb;void *password_opaque;mon_cmd_t *cmd_table;QError *error;
@@ -5361,7 +5361,7 @@ ReadLineState *monitor_get_rs(Monitor *mon) }int monitor_read_bdrv_key_start (Monitor *mon,BlockDriverState *bs, -BlockDriverCompletionFunc *completion_cb, +BlockCompletionFunc *completion_cb,void *opaque) {int err;
@@ -5393,7 +5393,7 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, }int monitor_read_block_device_key (Monitor *mon,const char *device, -BlockDriverCompletionFunc *completion_cb, +BlockCompletionFunc *completion_cb,void *opaque) {BlockDriverState *bs;
tests/test-thread-pool.c +1 -1
@@ -10,7 +10,7 @@ static ThreadPool *pool;static int active;typedef struct { -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;int n;int ret; }WorkerTestData ;
thread-pool.c +4 -4
@@ -35,7 +35,7 @@ enum ThreadState { };struct ThreadPoolElement { -BlockDriverAIOCB common; +BlockAIOCB common;ThreadPool *pool;ThreadPoolFunc *func;void *arg;
@@ -201,7 +201,7 @@ restart: } } -static void thread_pool_cancel (BlockDriverAIOCB *acb) +static void thread_pool_cancel (BlockAIOCB *acb) {ThreadPoolElement *elem = (ThreadPoolElement *)acb;ThreadPool *pool = elem->pool;
@@ -235,9 +235,9 @@ static const AIOCBInfo thread_pool_aiocb_info = { .cancel = thread_pool_cancel, }; -BlockDriverAIOCB *thread_pool_submit_aio (ThreadPool *pool, +BlockAIOCB *thread_pool_submit_aio (ThreadPool *pool,ThreadPoolFunc *func,void *arg, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {ThreadPoolElement *req;
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 11/23] block: Rename BlockDriverAIOCB* to BlockAIOCB*
Quoted 2,209 lines · Markus Armbruster
I'll use BlockDriverAIOCB with block backends shortly, and the name is going to fit badly there. It's a block layer thing anyway, not just a block driver thing.
Signed-off-by Markus Armbruster <[email protected]>--- block-migration.c | 2 +- block.c | 151 ++++++++++++++++++++++---------------------- block/archipelago.c | 30 ++++----- block/backup.c | 2 +- block/blkdebug.c | 22 +++---- block/blkverify.c | 20 +++--- block/commit.c | 2 +- block/curl.c | 8 +-- block/iscsi.c | 8 +-- block/linux-aio.c | 8 +-- block/mirror.c | 6 +- block/qed-gencb.c | 4 +- block/qed-table.c | 10 +-- block/qed.c | 46 +++++++------- block/qed.h | 12 ++-- block/quorum.c | 38 +++++------ block/raw-aio.h | 8 +-- block/raw-posix.c | 32 +++++----- block/raw-win32.c | 16 ++--- block/raw_bsd.c | 8 +-- block/rbd.c | 58 ++++++++--------- block/sheepdog.c | 4 +- block/stream.c | 2 +- block/win32-aio.c | 8 +-- blockjob.c | 4 +- dma-helpers.c | 24 +++---- hw/block/nvme.h | 2 +- hw/ide/ahci.c | 2 +- hw/ide/ahci.h | 2 +- hw/ide/core.c | 12 ++-- hw/ide/internal.h | 12 ++-- hw/ide/macio.c | 2 +- hw/ide/pci.c | 2 +- hw/ide/pci.h | 2 +- hw/ppc/mac.h | 2 +- hw/scsi/scsi-generic.c | 2 +- include/block/aio.h | 12 ++-- include/block/block.h | 36 +++++------ include/block/block_int.h | 30 ++++----- include/block/blockjob.h | 4 +- include/block/thread-pool.h | 4 +- include/hw/scsi/scsi.h | 2 +- include/monitor/monitor.h | 4 +- include/sysemu/dma.h | 26 ++++---- monitor.c | 6 +- tests/test-thread-pool.c | 2 +- thread-pool.c | 8 +-- 47 files changed, 353 insertions(+), 354 deletions(-)block-migration.c +1
-1@@ -72,7 +72,7 @@ typedef struct BlkMigBlock {int nr_sectors;struct iovec iov;QEMUIOVector qiov; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;/* Protected by block migration lock. */ int ret;block.c +75
-76@@ -61,12 +61,12 @@ struct BdrvDirtyBitmap {#define COROUTINE_POOL_RESERVATION 64/* number of coroutines to reserve */ static void bdrv_dev_change_media_cb (BlockDriverState *bs,bool load); -static BlockDriverAIOCB *bdrv_aio_readv_em (BlockDriverState *bs, +static BlockAIOCB *bdrv_aio_readv_em (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); -static BlockDriverAIOCB *bdrv_aio_writev_em (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque); +static BlockAIOCB *bdrv_aio_writev_em (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque); static int coroutine_fn bdrv_co_readv_em(BlockDriverState *bs,int64_t sector_num,int nb_sectors,QEMUIOVector *iov);@@ -79,14 +79,14 @@ static int coroutine_fn bdrv_co_do_preadv(BlockDriverState *bs, static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs,int64_t offset,unsigned int bytes,QEMUIOVector *qiov,BdrvRequestFlags flags); -static BlockDriverAIOCB *bdrv_co_aio_rw_vector (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BdrvRequestFlags flags, -BlockDriverCompletionFunc *cb, -void *opaque, -bool is_write); +static BlockAIOCB *bdrv_co_aio_rw_vector (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BdrvRequestFlags flags, +BlockCompletionFunc *cb, +void *opaque, +bool is_write); static void coroutine_fn bdrv_co_do_rw(void *opaque); static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs,int64_t sector_num,int nb_sectors,BdrvRequestFlags flags);@@ -4383,9 +4383,9 @@ int bdrv_get_backing_file_depth(BlockDriverState *bs)/**************************************************************/ /* async I/Os */ -BlockDriverAIOCB *bdrv_aio_readv (BlockDriverState *bs,int64_t sector_num, -QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockAIOCB *bdrv_aio_readv (BlockDriverState *bs,int64_t sector_num, +QEMUIOVector *qiov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque) {trace_bdrv_aio_readv (bs, sector_num, nb_sectors, opaque);@@ -4393,9 +4393,9 @@ BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, cb, opaque, false); } -BlockDriverAIOCB *bdrv_aio_writev (BlockDriverState *bs,int64_t sector_num, -QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockAIOCB *bdrv_aio_writev (BlockDriverState *bs,int64_t sector_num, +QEMUIOVector *qiov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque) {trace_bdrv_aio_writev (bs, sector_num, nb_sectors, opaque);@@ -4403,9 +4403,9 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, cb, opaque, true); } -BlockDriverAIOCB *bdrv_aio_write_zeroes (BlockDriverState *bs, +BlockAIOCB *bdrv_aio_write_zeroes (BlockDriverState *bs,int64_t sector_num,int nb_sectors,BdrvRequestFlags flags, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {trace_bdrv_aio_write_zeroes (bs, sector_num, nb_sectors, flags, opaque);@@ -4420,7 +4420,7 @@ typedef struct MultiwriteCB {int num_requests;int num_callbacks;struct { -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;void *opaque;QEMUIOVector *free_qiov; } callbacks[];@@ -4597,7 +4597,7 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)return 0 ; } -void bdrv_aio_cancel (BlockDriverAIOCB *acb) +void bdrv_aio_cancel (BlockAIOCB *acb) { acb->aiocb_info->cancel (acb); }@@ -4605,33 +4605,32 @@ void bdrv_aio_cancel(BlockDriverAIOCB *acb)/**************************************************************/ /* async block device emulation */ -typedef struct BlockDriverAIOCBSync { -BlockDriverAIOCB common; +typedef struct BlockAIOCBSync { +BlockAIOCB common;QEMUBH *bh;int ret;/* vector translation state */ QEMUIOVector *qiov;uint8_t *bounce;int is_write; -}BlockDriverAIOCBSync ; +}BlockAIOCBSync ; -static void bdrv_aio_cancel_em (BlockDriverAIOCB *blockacb) +static void bdrv_aio_cancel_em (BlockAIOCB *blockacb) { -BlockDriverAIOCBSync *acb = -container_of (blockacb, BlockDriverAIOCBSync, common); +BlockAIOCBSync *acb =container_of (blockacb, BlockAIOCBSync, common);qemu_bh_delete (acb->bh); acb->bh =NULL ;qemu_aio_release (acb); }static const AIOCBInfo bdrv_em_aiocb_info = { - .aiocb_size =sizeof (BlockDriverAIOCBSync), + .aiocb_size =sizeof (BlockAIOCBSync), .cancel = bdrv_aio_cancel_em, };static void bdrv_aio_bh_cb (void *opaque) { -BlockDriverAIOCBSync *acb = opaque; +BlockAIOCBSync *acb = opaque;if (!acb->is_write && acb->ret >=0 ) {qemu_iovec_from_buf (acb->qiov,0 , acb->bounce, acb->qiov->size);@@ -4643,16 +4642,16 @@ static void bdrv_aio_bh_cb(void *opaque)qemu_aio_release (acb); } -static BlockDriverAIOCB *bdrv_aio_rw_vector (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque, -int is_write) +static BlockAIOCB *bdrv_aio_rw_vector (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque, +int is_write) { -BlockDriverAIOCBSync *acb; +BlockAIOCBSync *acb; acb =qemu_aio_get (&bdrv_em_aiocb_info, bs, cb, opaque); acb->is_write = is_write;@@ -4674,34 +4673,34 @@ static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs,return &acb->common; } -static BlockDriverAIOCB *bdrv_aio_readv_em (BlockDriverState *bs, +static BlockAIOCB *bdrv_aio_readv_em (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return bdrv_aio_rw_vector (bs, sector_num, qiov, nb_sectors, cb, opaque,0 ); } -static BlockDriverAIOCB *bdrv_aio_writev_em (BlockDriverState *bs, +static BlockAIOCB *bdrv_aio_writev_em (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return bdrv_aio_rw_vector (bs, sector_num, qiov, nb_sectors, cb, opaque,1 ); } -typedef struct BlockDriverAIOCBCoroutine { -BlockDriverAIOCB common; +typedef struct BlockAIOCBCoroutine { +BlockAIOCB common;BlockRequest req;bool is_write;bool *done;QEMUBH * bh; -}BlockDriverAIOCBCoroutine ; +}BlockAIOCBCoroutine ; -static void bdrv_aio_co_cancel_em (BlockDriverAIOCB *blockacb) +static void bdrv_aio_co_cancel_em (BlockAIOCB *blockacb) {AioContext *aio_context =bdrv_get_aio_context (blockacb->bs); -BlockDriverAIOCBCoroutine *acb = -container_of (blockacb, BlockDriverAIOCBCoroutine, common); +BlockAIOCBCoroutine *acb = +container_of (blockacb, BlockAIOCBCoroutine, common);bool done = false; acb->done = &done;@@ -4711,13 +4710,13 @@ static void bdrv_aio_co_cancel_em(BlockDriverAIOCB *blockacb) }static const AIOCBInfo bdrv_em_co_aiocb_info = { - .aiocb_size =sizeof (BlockDriverAIOCBCoroutine), + .aiocb_size =sizeof (BlockAIOCBCoroutine), .cancel = bdrv_aio_co_cancel_em, };static void bdrv_co_em_bh (void *opaque) { -BlockDriverAIOCBCoroutine *acb = opaque; +BlockAIOCBCoroutine *acb = opaque; acb->common.cb (acb->common.opaque, acb->req.error);@@ -4732,7 +4731,7 @@ static void bdrv_co_em_bh(void *opaque)/* Invoke bdrv_co_do_readv/bdrv_co_do_writev */ static void coroutine_fn bdrv_co_do_rw(void *opaque) { -BlockDriverAIOCBCoroutine *acb = opaque; +BlockAIOCBCoroutine *acb = opaque;BlockDriverState *bs = acb->common.bs;if (!acb->is_write) {@@ -4747,17 +4746,17 @@ static void coroutine_fn bdrv_co_do_rw(void *opaque)qemu_bh_schedule (acb->bh); } -static BlockDriverAIOCB *bdrv_co_aio_rw_vector (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BdrvRequestFlags flags, -BlockDriverCompletionFunc *cb, -void *opaque, -bool is_write) +static BlockAIOCB *bdrv_co_aio_rw_vector (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BdrvRequestFlags flags, +BlockCompletionFunc *cb, +void *opaque, +bool is_write) {Coroutine *co; -BlockDriverAIOCBCoroutine *acb; +BlockAIOCBCoroutine *acb; acb =qemu_aio_get (&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->req.sector = sector_num;@@ -4775,7 +4774,7 @@ static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, static void coroutine_fn bdrv_aio_flush_co_entry(void *opaque) { -BlockDriverAIOCBCoroutine *acb = opaque; +BlockAIOCBCoroutine *acb = opaque;BlockDriverState *bs = acb->common.bs; acb->req.error =bdrv_co_flush (bs);@@ -4783,13 +4782,13 @@ static void coroutine_fn bdrv_aio_flush_co_entry(void *opaque)qemu_bh_schedule (acb->bh); } -BlockDriverAIOCB *bdrv_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +BlockAIOCB *bdrv_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque) {trace_bdrv_aio_flush (bs, opaque);Coroutine *co; -BlockDriverAIOCBCoroutine *acb; +BlockAIOCBCoroutine *acb; acb =qemu_aio_get (&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->done =NULL ;@@ -4802,7 +4801,7 @@ BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque) { -BlockDriverAIOCBCoroutine *acb = opaque; +BlockAIOCBCoroutine *acb = opaque;BlockDriverState *bs = acb->common.bs; acb->req.error =bdrv_co_discard (bs, acb->req.sector, acb->req.nb_sectors);@@ -4810,12 +4809,12 @@ static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque)qemu_bh_schedule (acb->bh); } -BlockDriverAIOCB *bdrv_aio_discard (BlockDriverState *bs, +BlockAIOCB *bdrv_aio_discard (BlockDriverState *bs,int64_t sector_num,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {Coroutine *co; -BlockDriverAIOCBCoroutine *acb; +BlockAIOCBCoroutine *acb;trace_bdrv_aio_discard (bs, sector_num, nb_sectors, opaque);@@ -4841,9 +4840,9 @@ void bdrv_init_with_whitelist(void) }void *qemu_aio_get (const AIOCBInfo *aiocb_info,BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) { -BlockDriverAIOCB *acb; +BlockAIOCB *acb; acb =g_slice_alloc (aiocb_info->aiocb_size); acb->aiocb_info = aiocb_info;@@ -4855,7 +4854,7 @@ void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs,void qemu_aio_release (void *p) { -BlockDriverAIOCB *acb = p; +BlockAIOCB *acb = p;g_slice_free1 (acb->aiocb_info->aiocb_size, acb); }@@ -4882,7 +4881,7 @@ static int coroutine_fn bdrv_co_io_em(BlockDriverState *bs, int64_t sector_num,CoroutineIOCompletion co = { .coroutine =qemu_coroutine_self (), }; -BlockDriverAIOCB *acb; +BlockAIOCB *acb;if (is_write) { acb = bs->drv->bdrv_aio_writev(bs, sector_num, iov, nb_sectors,@@ -4948,7 +4947,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)if (bs->drv->bdrv_co_flush_to_disk) { ret = bs->drv->bdrv_co_flush_to_disk (bs); }else if (bs->drv->bdrv_aio_flush) { -BlockDriverAIOCB *acb; +BlockAIOCB *acb;CoroutineIOCompletion co = { .coroutine =qemu_coroutine_self (), };@@ -5131,7 +5130,7 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num,if (bs->drv->bdrv_co_discard) { ret = bs->drv->bdrv_co_discard (bs, sector_num, num); }else { -BlockDriverAIOCB *acb; +BlockAIOCB *acb;CoroutineIOCompletion co = { .coroutine =qemu_coroutine_self (), };@@ -5257,9 +5256,9 @@ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)return -ENOTSUP ; } -BlockDriverAIOCB *bdrv_aio_ioctl (BlockDriverState *bs, +BlockAIOCB *bdrv_aio_ioctl (BlockDriverState *bs,unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BlockDriver *drv = bs->drv;block/archipelago.c +15
-15@@ -87,7 +87,7 @@ typedef enum { } ARCHIPCmd; typedef struct ArchipelagoAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; struct BDRVArchipelagoState *s; QEMUIOVector *qiov;@@ -724,7 +724,7 @@ static int qemu_archipelago_create(const char *filename,return ret; } -static void qemu_archipelago_aio_cancel (BlockDriverAIOCB *blockacb) +static void qemu_archipelago_aio_cancel (BlockAIOCB *blockacb) {ArchipelagoAIOCB *aio_cb = (ArchipelagoAIOCB *) blockacb; aio_cb->cancelled = true;@@ -869,13 +869,13 @@ err_exit:return ret; } -static BlockDriverAIOCB *qemu_archipelago_aio_rw (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque, -int op) +static BlockAIOCB *qemu_archipelago_aio_rw (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque, +int op) {ArchipelagoAIOCB *aio_cb;BDRVArchipelagoState *s = bs->opaque;@@ -908,17 +908,17 @@ err_exit:return NULL ; } -static BlockDriverAIOCB *qemu_archipelago_aio_readv (BlockDriverState *bs, +static BlockAIOCB *qemu_archipelago_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return qemu_archipelago_aio_rw (bs, sector_num, qiov, nb_sectors, cb, opaque,ARCHIP_OP_READ ); } -static BlockDriverAIOCB *qemu_archipelago_aio_writev (BlockDriverState *bs, +static BlockAIOCB *qemu_archipelago_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return qemu_archipelago_aio_rw (bs, sector_num, qiov, nb_sectors, cb, opaque,ARCHIP_OP_WRITE );@@ -1008,8 +1008,8 @@ static QemuOptsList qemu_archipelago_create_opts = { } }; -static BlockDriverAIOCB *qemu_archipelago_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +static BlockAIOCB *qemu_archipelago_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque) {return qemu_archipelago_aio_rw (bs,0 ,NULL ,0 , cb, opaque,ARCHIP_OP_FLUSH );block/backup.c +1
-1@@ -353,7 +353,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, void *opaque, + BlockCompletionFunc *cb, void *opaque, Error **errp) { int64_t len;block/blkdebug.c +11
-11@@ -41,7 +41,7 @@ typedef struct BDRVBlkdebugState { } BDRVBlkdebugState;typedef struct BlkdebugAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;QEMUBH *bh;int ret; }BlkdebugAIOCB ;@@ -52,7 +52,7 @@ typedef struct BlkdebugSuspendedReq {QLIST_ENTRY (BlkdebugSuspendedReq) next; } BlkdebugSuspendedReq; -static void blkdebug_aio_cancel (BlockDriverAIOCB *blockacb); +static void blkdebug_aio_cancel (BlockAIOCB *blockacb);static const AIOCBInfo blkdebug_aiocb_info = { .aiocb_size =sizeof (BlkdebugAIOCB),@@ -450,7 +450,7 @@ static void error_callback_bh(void *opaque)qemu_aio_release (acb); } -static void blkdebug_aio_cancel (BlockDriverAIOCB *blockacb) +static void blkdebug_aio_cancel (BlockAIOCB *blockacb) {BlkdebugAIOCB *acb =container_of (blockacb, BlkdebugAIOCB, common);if (acb->bh) {@@ -460,8 +460,8 @@ static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb)qemu_aio_release (acb); } -static BlockDriverAIOCB *inject_error (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque,BlkdebugRule *rule) +static BlockAIOCB *inject_error (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque,BlkdebugRule *rule) {BDRVBlkdebugState *s = bs->opaque;int error = rule->options.inject.error;@@ -486,9 +486,9 @@ static BlockDriverAIOCB *inject_error(BlockDriverState *bs,return &acb->common; } -static BlockDriverAIOCB *blkdebug_aio_readv (BlockDriverState *bs, +static BlockAIOCB *blkdebug_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVBlkdebugState *s = bs->opaque;BlkdebugRule *rule =NULL ;@@ -508,9 +508,9 @@ static BlockDriverAIOCB *blkdebug_aio_readv(BlockDriverState *bs,return bdrv_aio_readv (bs->file, sector_num, qiov, nb_sectors, cb, opaque); } -static BlockDriverAIOCB *blkdebug_aio_writev (BlockDriverState *bs, +static BlockAIOCB *blkdebug_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVBlkdebugState *s = bs->opaque;BlkdebugRule *rule =NULL ;@@ -530,8 +530,8 @@ static BlockDriverAIOCB *blkdebug_aio_writev(BlockDriverState *bs,return bdrv_aio_writev (bs->file, sector_num, qiov, nb_sectors, cb, opaque); } -static BlockDriverAIOCB *blkdebug_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +static BlockAIOCB *blkdebug_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque) {BDRVBlkdebugState *s = bs->opaque;BlkdebugRule *rule =NULL ;block/blkverify.c +10
-10@@ -19,7 +19,7 @@ typedef struct {typedef struct BlkverifyAIOCB BlkverifyAIOCB ;struct BlkverifyAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;QEMUBH *bh;/* Request metadata */ @@ -38,7 +38,7 @@ struct BlkverifyAIOCB {void (*verify)(BlkverifyAIOCB *acb); }; -static void blkverify_aio_cancel (BlockDriverAIOCB *blockacb) +static void blkverify_aio_cancel (BlockAIOCB *blockacb) {BlkverifyAIOCB *acb = (BlkverifyAIOCB *)blockacb;AioContext *aio_context =bdrv_get_aio_context (blockacb->bs);@@ -180,7 +180,7 @@ static int64_t blkverify_getlength(BlockDriverState *bs)static BlkverifyAIOCB *blkverify_aio_get (BlockDriverState *bs,bool is_write,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque) {BlkverifyAIOCB *acb =qemu_aio_get (&blkverify_aiocb_info, bs, cb, opaque);@@ -248,9 +248,9 @@ static void blkverify_verify_readv(BlkverifyAIOCB *acb) } } -static BlockDriverAIOCB *blkverify_aio_readv (BlockDriverState *bs, +static BlockAIOCB *blkverify_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, false, sector_num, qiov,@@ -268,9 +268,9 @@ static BlockDriverAIOCB *blkverify_aio_readv(BlockDriverState *bs,return &acb->common; } -static BlockDriverAIOCB *blkverify_aio_writev (BlockDriverState *bs, +static BlockAIOCB *blkverify_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov,@@ -283,9 +283,9 @@ static BlockDriverAIOCB *blkverify_aio_writev(BlockDriverState *bs,return &acb->common; } -static BlockDriverAIOCB *blkverify_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *blkverify_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb, +void *opaque) {BDRVBlkverifyState *s = bs->opaque;block/commit.c +1
-1@@ -182,7 +182,7 @@ static const BlockJobDriver commit_job_driver = {void commit_start (BlockDriverState *bs,BlockDriverState *base,BlockDriverState *top,int64_t speed, -BlockdevOnError on_error,BlockDriverCompletionFunc *cb, +BlockdevOnError on_error,BlockCompletionFunc *cb,void *opaque,const char *backing_file_str,Error **errp) {CommitBlockJob *s;block/curl.c +4
-4@@ -78,7 +78,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,struct BDRVCURLState ; typedef struct CURLAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; QEMUIOVector *qiov;@@ -613,7 +613,7 @@ out_noclean:return -EINVAL ; } -static void curl_aio_cancel (BlockDriverAIOCB *blockacb) +static void curl_aio_cancel (BlockAIOCB *blockacb) {// Do we have to implement canceling? Seems to work without... }@@ -686,9 +686,9 @@ static void curl_readv_bh_cb(void *p)curl_multi_socket_action (s->multi,CURL_SOCKET_TIMEOUT ,0 , &running); } -static BlockDriverAIOCB *curl_aio_readv (BlockDriverState *bs, +static BlockAIOCB *curl_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {CURLAIOCB *acb;block/iscsi.c +4
-4@@ -81,7 +81,7 @@ typedef struct IscsiTask { } IscsiTask; typedef struct IscsiAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUIOVector *qiov; QEMUBH *bh; IscsiLun *iscsilun;@@ -231,7 +231,7 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, }static void -iscsi_aio_cancel (BlockDriverAIOCB *blockacb) +iscsi_aio_cancel (BlockAIOCB *blockacb) {IscsiAIOCB *acb = (IscsiAIOCB *)blockacb;IscsiLun *iscsilun = acb->iscsilun;@@ -669,9 +669,9 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status,iscsi_schedule_bh (acb); } -static BlockDriverAIOCB *iscsi_aio_ioctl (BlockDriverState *bs, +static BlockAIOCB *iscsi_aio_ioctl (BlockDriverState *bs,unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {IscsiLun *iscsilun = bs->opaque;struct iscsi_context *iscsi = iscsilun->iscsi;block/linux-aio.c +4
-4@@ -28,7 +28,7 @@#define MAX_QUEUED_IO 128struct qemu_laiocb { -BlockDriverAIOCB common; +BlockAIOCB common;struct qemu_laio_state *ctx;struct iocb iocb;ssize_t ret;@@ -147,7 +147,7 @@ static void qemu_laio_completion_cb(EventNotifier *e) } } -static void laio_cancel (BlockDriverAIOCB *blockacb) +static void laio_cancel (BlockAIOCB *blockacb) {struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;struct io_event event;@@ -257,9 +257,9 @@ int laio_io_unplug(BlockDriverState *bs, void *aio_ctx, bool unplug)return ret; } -BlockDriverAIOCB *laio_submit (BlockDriverState *bs,void *aio_ctx,int fd, +BlockAIOCB *laio_submit (BlockDriverState *bs,void *aio_ctx,int fd,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {struct qemu_laio_state *s = aio_ctx;struct qemu_laiocb *laiocb;block/mirror.c +3
-3@@ -613,7 +613,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,int64_t buf_size, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, bool is_none_mode, BlockDriverState *base)@@ -673,7 +673,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, int64_t granularity, int64_t buf_size, MirrorSyncMode mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp) { bool is_none_mode;@@ -690,7 +690,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target,void commit_active_start (BlockDriverState *bs,BlockDriverState *base,int64_t speed,BlockdevOnError on_error, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque,Error **errp) {int64_t length, base_length;block/qed-gencb.c +2
-2@@ -13,7 +13,7 @@#include "qed.h" -void *gencb_alloc (size_t len,BlockDriverCompletionFunc *cb,void *opaque) +void *gencb_alloc (size_t len,BlockCompletionFunc *cb,void *opaque) {GenericCB *gencb =g_malloc (len); gencb->cb = cb;@@ -24,7 +24,7 @@ void *gencb_alloc(size_t len, BlockDriverCompletionFunc *cb, void *opaque)void gencb_complete (void *opaque,int ret) {GenericCB *gencb = opaque; -BlockDriverCompletionFunc *cb = gencb->cb; +BlockCompletionFunc *cb = gencb->cb;void *user_opaque = gencb->opaque;g_free (gencb);block/qed-table.c +5
-5@@ -49,7 +49,7 @@ out: }static void qed_read_table (BDRVQEDState *s,uint64_t offset,QEDTable *table, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {QEDReadTableCB *read_table_cb =gencb_alloc (sizeof (*read_table_cb), cb, opaque);@@ -119,7 +119,7 @@ out:*/ static void qed_write_table (BDRVQEDState *s,uint64_t offset,QEDTable *table,unsigned int index,unsigned int n,bool flush, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {QEDWriteTableCB *write_table_cb;unsigned int sector_mask =BDRV_SECTOR_SIZE /sizeof (uint64_t ) -1 ;@@ -180,7 +180,7 @@ int qed_read_l1_table_sync(BDRVQEDState *s) }void qed_write_l1_table (BDRVQEDState *s,unsigned int index,unsigned int n, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BLKDBG_EVENT (s->bs->file,BLKDBG_L1_UPDATE ); qed_write_table(s, s->header.l1_table_offset,@@ -235,7 +235,7 @@ static void qed_read_l2_table_cb(void *opaque, int ret) }void qed_read_l2_table (BDRVQEDState *s,QEDRequest *request,uint64_t offset, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {QEDReadL2TableCB *read_l2_table_cb;@@ -275,7 +275,7 @@ int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offsetvoid qed_write_l2_table (BDRVQEDState *s,QEDRequest *request,unsigned int index,unsigned int n,bool flush, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BLKDBG_EVENT (s->bs->file,BLKDBG_L2_UPDATE ); qed_write_table(s, request->l2_table->offset,block/qed.c +23
-23@@ -18,7 +18,7 @@#include "qapi/qmp/qerror.h" #include "migration/migration.h" -static void qed_aio_cancel (BlockDriverAIOCB *blockacb) +static void qed_aio_cancel (BlockAIOCB *blockacb) {QEDAIOCB *acb = (QEDAIOCB *)blockacb;AioContext *aio_context =bdrv_get_aio_context (blockacb->bs);@@ -144,7 +144,7 @@ static void qed_write_header_read_cb(void *opaque, int ret)* This function only updates known header fields in-place and does not affect * extra data after the QED header. */ -static void qed_write_header (BDRVQEDState *s,BlockDriverCompletionFunc cb, +static void qed_write_header (BDRVQEDState *s,BlockCompletionFunc cb,void *opaque) {/* We must write full sectors for O_DIRECT but cannot necessarily generate @@ -772,7 +772,7 @@ static BDRVQEDState *acb_to_s(QEDAIOCB *acb)static void qed_read_backing_file (BDRVQEDState *s,uint64_t pos,QEMUIOVector *qiov,QEMUIOVector **backing_qiov, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {uint64_t backing_length =0 ;size_t size;@@ -864,7 +864,7 @@ static void qed_copy_from_backing_file_write(void *opaque, int ret)*/ static void qed_copy_from_backing_file (BDRVQEDState *s,uint64_t pos,uint64_t len,uint64_t offset, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque) {CopyFromBackingFileCB *copy_cb;@@ -915,7 +915,7 @@ static void qed_update_l2_table(BDRVQEDState *s, QEDTable *table, int index,static void qed_aio_complete_bh (void *opaque) {QEDAIOCB *acb = opaque; -BlockDriverCompletionFunc *cb = acb->common.cb; +BlockCompletionFunc *cb = acb->common.cb;void *user_opaque = acb->common.opaque;int ret = acb->bh_ret;bool *finished = acb->finished;@@ -1083,7 +1083,7 @@ static void qed_aio_write_main(void *opaque, int ret)BDRVQEDState *s =acb_to_s (acb);uint64_t offset = acb->cur_cluster +qed_offset_into_cluster (s, acb->cur_pos); -BlockDriverCompletionFunc *next_fn; +BlockCompletionFunc *next_fn;trace_qed_aio_write_main (s, acb, ret, offset, acb->cur_qiov.size);@@ -1183,7 +1183,7 @@ static void qed_aio_write_zero_cluster(void *opaque, int ret)static void qed_aio_write_alloc (QEDAIOCB *acb,size_t len) {BDRVQEDState *s =acb_to_s (acb); -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;/* Cancel timer when the first allocating request comes in */ if (QSIMPLEQ_EMPTY (&s->allocating_write_reqs)) {@@ -1384,11 +1384,11 @@ static void qed_aio_next_io(void *opaque, int ret) io_fn, acb); } -static BlockDriverAIOCB *qed_aio_setup (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque,int flags) +static BlockAIOCB *qed_aio_setup (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov,int nb_sectors, +BlockCompletionFunc *cb, +void *opaque,int flags) {QEDAIOCB *acb =qemu_aio_get (&qed_aiocb_info, bs, cb, opaque);@@ -1410,20 +1410,20 @@ static BlockDriverAIOCB *qed_aio_setup(BlockDriverState *bs,return &acb->common; } -static BlockDriverAIOCB *bdrv_qed_aio_readv (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *bdrv_qed_aio_readv (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov,int nb_sectors, +BlockCompletionFunc *cb, +void *opaque) {return qed_aio_setup (bs, sector_num, qiov, nb_sectors, cb, opaque,0 ); } -static BlockDriverAIOCB *bdrv_qed_aio_writev (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *bdrv_qed_aio_writev (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov,int nb_sectors, +BlockCompletionFunc *cb, +void *opaque) {return qed_aio_setup (bs, sector_num, qiov, nb_sectors, cb, opaque,QED_AIOCB_WRITE );@@ -1451,7 +1451,7 @@ static int coroutine_fn bdrv_qed_co_write_zeroes(BlockDriverState *bs, int nb_sectors, BdrvRequestFlags flags) { -BlockDriverAIOCB *blockacb; +BlockAIOCB *blockacb;BDRVQEDState *s = bs->opaque;QEDWriteZeroesCB cb = { .done = false };QEMUIOVector qiov;block/qed.h +6
-6@@ -128,7 +128,7 @@ enum { }; typedef struct QEDAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; int bh_ret; /* final return status for completion bh */ QSIMPLEQ_ENTRY(QEDAIOCB) next; /* next request */@@ -203,11 +203,11 @@ typedef void QEDFindClusterFunc(void *opaque, int ret, uint64_t offset, size_t l* Generic callback for chaining async callbacks */ typedef struct { -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;void *opaque; }GenericCB ; -void *gencb_alloc (size_t len,BlockDriverCompletionFunc *cb,void *opaque); +void *gencb_alloc (size_t len,BlockCompletionFunc *cb,void *opaque);void gencb_complete (void *opaque,int ret);/** @@ -230,16 +230,16 @@ void qed_commit_l2_cache_entry(L2TableCache *l2_cache, CachedL2Table *l2_table);*/ int qed_read_l1_table_sync (BDRVQEDState *s);void qed_write_l1_table (BDRVQEDState *s,unsigned int index,unsigned int n, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);int qed_write_l1_table_sync (BDRVQEDState *s,unsigned int index,unsigned int n);int qed_read_l2_table_sync (BDRVQEDState *s,QEDRequest *request,uint64_t offset);void qed_read_l2_table (BDRVQEDState *s,QEDRequest *request,uint64_t offset, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);void qed_write_l2_table (BDRVQEDState *s,QEDRequest *request,unsigned int index,unsigned int n,bool flush, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);int qed_write_l2_table_sync (BDRVQEDState *s,QEDRequest *request,unsigned int index,unsigned int n,bool flush);block/quorum.c +19
-19@@ -92,7 +92,7 @@ typedef struct QuorumAIOCB QuorumAIOCB;* $children_count QuorumChildRequest. */ typedef struct QuorumChildRequest { - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; QEMUIOVector qiov; uint8_t *buf; int ret;@@ -105,7 +105,7 @@ typedef struct QuorumChildRequest {* used to do operations on each children and track overall progress. */ struct QuorumAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;/* Request metadata */ uint64_t sector_num;@@ -130,7 +130,7 @@ struct QuorumAIOCB {static bool quorum_vote (QuorumAIOCB *acb); -static void quorum_aio_cancel (BlockDriverAIOCB *blockacb) +static void quorum_aio_cancel (BlockAIOCB *blockacb) {QuorumAIOCB *acb =container_of (blockacb, QuorumAIOCB, common);BDRVQuorumState *s = acb->common.bs->opaque;@@ -187,7 +187,7 @@ static QuorumAIOCB *quorum_aio_get(BDRVQuorumState *s,QEMUIOVector *qiov, uint64_t sector_num, int nb_sectors, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque) { QuorumAIOCB *acb = qemu_aio_get(&quorum_aiocb_info, bs, cb, opaque);@@ -265,7 +265,7 @@ static void quorum_rewrite_aio_cb(void *opaque, int ret)quorum_aio_finalize (acb); } -static BlockDriverAIOCB *read_fifo_child (QuorumAIOCB *acb); +static BlockAIOCB *read_fifo_child (QuorumAIOCB *acb);static void quorum_copy_qiov (QEMUIOVector *dest,QEMUIOVector *source) {@@ -641,7 +641,7 @@ free_exit:return rewrite; } -static BlockDriverAIOCB *read_quorum_children (QuorumAIOCB *acb) +static BlockAIOCB *read_quorum_children (QuorumAIOCB *acb) {BDRVQuorumState *s = acb->common.bs->opaque;int i;@@ -660,7 +660,7 @@ static BlockDriverAIOCB *read_quorum_children(QuorumAIOCB *acb)return &acb->common; } -static BlockDriverAIOCB *read_fifo_child (QuorumAIOCB *acb) +static BlockAIOCB *read_fifo_child (QuorumAIOCB *acb) {BDRVQuorumState *s = acb->common.bs->opaque;@@ -676,12 +676,12 @@ static BlockDriverAIOCB *read_fifo_child(QuorumAIOCB *acb)return &acb->common; } -static BlockDriverAIOCB *quorum_aio_readv (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *quorum_aio_readv (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque) {BDRVQuorumState *s = bs->opaque; QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num,@@ -697,12 +697,12 @@ static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs,return read_fifo_child (acb); } -static BlockDriverAIOCB *quorum_aio_writev (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *quorum_aio_writev (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque) {BDRVQuorumState *s = bs->opaque; QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num, nb_sectors,block/raw-aio.h +4
-4@@ -35,9 +35,9 @@#ifdef CONFIG_LINUX_AIO void *laio_init (void );void laio_cleanup (void *s); -BlockDriverAIOCB *laio_submit (BlockDriverState *bs,void *aio_ctx,int fd, +BlockAIOCB *laio_submit (BlockDriverState *bs,void *aio_ctx,int fd,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type); +BlockCompletionFunc *cb,void *opaque,int type);void laio_detach_aio_context (void *s,AioContext *old_context);void laio_attach_aio_context (void *s,AioContext *new_context);void laio_io_plug (BlockDriverState *bs,void *aio_ctx);@@ -49,10 +49,10 @@ typedef struct QEMUWin32AIOState QEMUWin32AIOState;QEMUWin32AIOState *win32_aio_init (void );void win32_aio_cleanup (QEMUWin32AIOState *aio);int win32_aio_attach (QEMUWin32AIOState *aio,HANDLE hfile); -BlockDriverAIOCB *win32_aio_submit (BlockDriverState *bs, +BlockAIOCB *win32_aio_submit (BlockDriverState *bs,QEMUWin32AIOState *aio,HANDLE hfile,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type); +BlockCompletionFunc *cb,void *opaque,int type);void win32_aio_detach_aio_context (QEMUWin32AIOState *aio,AioContext *old_context); void win32_aio_attach_aio_context(QEMUWin32AIOState *aio,block/raw-posix.c +16
-16@@ -1040,9 +1040,9 @@ static int paio_submit_co(BlockDriverState *bs, int fd,return thread_pool_submit_co (pool, aio_worker, acb); } -static BlockDriverAIOCB *paio_submit (BlockDriverState *bs,int fd, +static BlockAIOCB *paio_submit (BlockDriverState *bs,int fd,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {RawPosixAIOData *acb =g_slice_new (RawPosixAIOData);ThreadPool *pool;@@ -1065,9 +1065,9 @@ static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd,return thread_pool_submit_aio (pool, aio_worker, acb, cb, opaque); } -static BlockDriverAIOCB *raw_aio_submit (BlockDriverState *bs, +static BlockAIOCB *raw_aio_submit (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {BDRVRawState *s = bs->opaque;@@ -1124,24 +1124,24 @@ static void raw_aio_flush_io_queue(BlockDriverState *bs)#endif } -static BlockDriverAIOCB *raw_aio_readv (BlockDriverState *bs, +static BlockAIOCB *raw_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return raw_aio_submit (bs, sector_num, qiov, nb_sectors, cb, opaque,QEMU_AIO_READ ); } -static BlockDriverAIOCB *raw_aio_writev (BlockDriverState *bs, +static BlockAIOCB *raw_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {return raw_aio_submit (bs, sector_num, qiov, nb_sectors, cb, opaque,QEMU_AIO_WRITE ); } -static BlockDriverAIOCB *raw_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +static BlockAIOCB *raw_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;@@ -1536,9 +1536,9 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs,return ret; } -static coroutine_fn BlockDriverAIOCB *raw_aio_discard(BlockDriverState *bs, +static coroutine_fn BlockAIOCB *raw_aio_discard(BlockDriverState *bs,int64_t sector_num,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;@@ -1871,9 +1871,9 @@ static int hdev_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)return ioctl (s->fd, req, buf); } -static BlockDriverAIOCB *hdev_aio_ioctl (BlockDriverState *bs, +static BlockAIOCB *hdev_aio_ioctl (BlockDriverState *bs,unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;RawPosixAIOData *acb;@@ -1912,9 +1912,9 @@ static int fd_open(BlockDriverState *bs)#endif /* !linux && !FreeBSD */ -static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs, +static coroutine_fn BlockAIOCB *hdev_aio_discard(BlockDriverState *bs,int64_t sector_num,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;block/raw-win32.c +8
-8@@ -138,9 +138,9 @@ static int aio_worker(void *arg)return ret; } -static BlockDriverAIOCB *paio_submit (BlockDriverState *bs,HANDLE hfile, +static BlockAIOCB *paio_submit (BlockDriverState *bs,HANDLE hfile,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {RawWin32AIOData *acb =g_slice_new (RawWin32AIOData);ThreadPool *pool;@@ -369,9 +369,9 @@ fail:return ret; } -static BlockDriverAIOCB *raw_aio_readv (BlockDriverState *bs, +static BlockAIOCB *raw_aio_readv (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;if (s->aio) {@@ -383,9 +383,9 @@ static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, } } -static BlockDriverAIOCB *raw_aio_writev (BlockDriverState *bs, +static BlockAIOCB *raw_aio_writev (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;if (s->aio) {@@ -397,8 +397,8 @@ static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, } } -static BlockDriverAIOCB *raw_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque) +static BlockAIOCB *raw_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque) {BDRVRawState *s = bs->opaque;return paio_submit (bs, s->hfile,0 ,NULL ,0 , cb, opaque,QEMU_AIO_FLUSH );block/raw_bsd.c +4
-4@@ -129,10 +129,10 @@ static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)return bdrv_ioctl (bs->file, req, buf); } -static BlockDriverAIOCB *raw_aio_ioctl (BlockDriverState *bs, -unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *raw_aio_ioctl (BlockDriverState *bs, +unsigned long int req,void *buf, +BlockCompletionFunc *cb, +void *opaque) {return bdrv_aio_ioctl (bs->file, req, buf, cb, opaque); }block/rbd.c +29
-29@@ -68,7 +68,7 @@ typedef enum { } RBDAIOCmd; typedef struct RBDAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; int64_t ret; QEMUIOVector *qiov;@@ -542,7 +542,7 @@ static void qemu_rbd_close(BlockDriverState *bs)* Cancel aio. Since we don't reference acb in a non qemu threads, * it is safe to access it here. */ -static void qemu_rbd_aio_cancel (BlockDriverAIOCB *blockacb) +static void qemu_rbd_aio_cancel (BlockAIOCB *blockacb) {RBDAIOCB *acb = (RBDAIOCB *) blockacb; acb->cancelled =1 ;@@ -608,13 +608,13 @@ static int rbd_aio_flush_wrapper(rbd_image_t image,#endif } -static BlockDriverAIOCB *rbd_start_aio (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque, -RBDAIOCmd cmd) +static BlockAIOCB *rbd_start_aio (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque, +RBDAIOCmd cmd) {RBDAIOCB *acb;RADOSCB *rcb =NULL ;@@ -695,32 +695,32 @@ failed:return NULL ; } -static BlockDriverAIOCB *qemu_rbd_aio_readv (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *qemu_rbd_aio_readv (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque) {return rbd_start_aio (bs, sector_num, qiov, nb_sectors, cb, opaque,RBD_AIO_READ ); } -static BlockDriverAIOCB *qemu_rbd_aio_writev (BlockDriverState *bs, -int64_t sector_num, -QEMUIOVector *qiov, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *qemu_rbd_aio_writev (BlockDriverState *bs, +int64_t sector_num, +QEMUIOVector *qiov, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque) {return rbd_start_aio (bs, sector_num, qiov, nb_sectors, cb, opaque,RBD_AIO_WRITE ); }#ifdef LIBRBD_SUPPORTS_AIO_FLUSH -static BlockDriverAIOCB *qemu_rbd_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *qemu_rbd_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb, +void *opaque) {return rbd_start_aio (bs,0 ,NULL ,0 , cb, opaque,RBD_AIO_FLUSH ); }@@ -896,11 +896,11 @@ static int qemu_rbd_snap_list(BlockDriverState *bs, }#ifdef LIBRBD_SUPPORTS_DISCARD -static BlockDriverAIOCB *qemu_rbd_aio_discard (BlockDriverState *bs, -int64_t sector_num, -int nb_sectors, -BlockDriverCompletionFunc *cb, -void *opaque) +static BlockAIOCB *qemu_rbd_aio_discard (BlockDriverState *bs, +int64_t sector_num, +int nb_sectors, +BlockCompletionFunc *cb, +void *opaque) {return rbd_start_aio (bs, sector_num,NULL , nb_sectors, cb, opaque,RBD_AIO_DISCARD );block/sheepdog.c +2
-2@@ -301,7 +301,7 @@ enum AIOCBState { };struct SheepdogAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;QEMUIOVector *qiov;@@ -477,7 +477,7 @@ static bool sd_acb_cancelable(const SheepdogAIOCB *acb)return true; } -static void sd_aio_cancel (BlockDriverAIOCB *blockacb) +static void sd_aio_cancel (BlockAIOCB *blockacb) {SheepdogAIOCB *acb = (SheepdogAIOCB *)blockacb;BDRVSheepdogState *s = acb->common.bs->opaque;block/stream.c +1
-1@@ -220,7 +220,7 @@ static const BlockJobDriver stream_job_driver = {void stream_start (BlockDriverState *bs,BlockDriverState *base,const char *backing_file_str,int64_t speed,BlockdevOnError on_error, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque,Error **errp) {StreamBlockJob *s;block/win32-aio.c +4
-4@@ -44,7 +44,7 @@ struct QEMUWin32AIOState { }; typedef struct QEMUWin32AIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; struct QEMUWin32AIOState *ctx; int nbytes; OVERLAPPED ov;@@ -106,7 +106,7 @@ static void win32_aio_completion_cb(EventNotifier *e) } } -static void win32_aio_cancel (BlockDriverAIOCB *blockacb) +static void win32_aio_cancel (BlockAIOCB *blockacb) {QEMUWin32AIOCB *waiocb = (QEMUWin32AIOCB *)blockacb;@@ -124,10 +124,10 @@ static const AIOCBInfo win32_aiocb_info = { .cancel = win32_aio_cancel, }; -BlockDriverAIOCB *win32_aio_submit (BlockDriverState *bs, +BlockAIOCB *win32_aio_submit (BlockDriverState *bs,QEMUWin32AIOState *aio,HANDLE hfile,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque,int type) +BlockCompletionFunc *cb,void *opaque,int type) {struct QEMUWin32AIOCB *waiocb;uint64_t offset = sector_num *512 ;blockjob.c +2
-2@@ -36,7 +36,7 @@#include "qapi-event.h" void *block_job_create (const BlockJobDriver *driver,BlockDriverState *bs, -int64_t speed,BlockDriverCompletionFunc *cb, +int64_t speed,BlockCompletionFunc *cb,void *opaque,Error **errp) {BlockJob *job;@@ -155,7 +155,7 @@ void block_job_iostatus_reset(BlockJob *job)struct BlockCancelData {BlockJob *job; -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;void *opaque;bool cancelled;int ret;dma-helpers.c +12
-12@@ -67,9 +67,9 @@ void qemu_sglist_destroy(QEMUSGList *qsg) } typedef struct { - BlockDriverAIOCB common; + BlockAIOCB common; BlockDriverState *bs; - BlockDriverAIOCB *acb; + BlockAIOCB *acb; QEMUSGList *sg; uint64_t sector_num; DMADirection dir;@@ -179,14 +179,14 @@ static void dma_bdrv_cb(void *opaque, int ret)assert (dbs->acb); } -static void dma_aio_cancel (BlockDriverAIOCB *acb) +static void dma_aio_cancel (BlockAIOCB *acb) {DMAAIOCB *dbs =container_of (acb,DMAAIOCB , common);trace_dma_aio_cancel (dbs);if (dbs->acb) { -BlockDriverAIOCB *acb = dbs->acb; +BlockAIOCB *acb = dbs->acb; dbs->acb =NULL ; dbs->in_cancel = true;bdrv_aio_cancel (acb);@@ -201,9 +201,9 @@ static const AIOCBInfo dma_aiocb_info = { .cancel = dma_aio_cancel, }; -BlockDriverAIOCB *dma_bdrv_io ( +BlockAIOCB *dma_bdrv_io (BlockDriverState *bs,QEMUSGList *sg,uint64_t sector_num, -DMAIOFunc *io_func,BlockDriverCompletionFunc *cb, +DMAIOFunc *io_func,BlockCompletionFunc *cb,void *opaque,DMADirection dir) {DMAAIOCB *dbs =qemu_aio_get (&dma_aiocb_info, bs, cb, opaque);@@ -226,17 +226,17 @@ BlockDriverAIOCB *dma_bdrv_io( } -BlockDriverAIOCB *dma_bdrv_read (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector, -void (*cb)(void *opaque,int ret),void *opaque) +BlockAIOCB *dma_bdrv_read (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector, +void (*cb)(void *opaque,int ret),void *opaque) {return dma_bdrv_io (bs, sg, sector, bdrv_aio_readv, cb, opaque,DMA_DIRECTION_FROM_DEVICE ); } -BlockDriverAIOCB *dma_bdrv_write (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector, -void (*cb)(void *opaque,int ret),void *opaque) +BlockAIOCB *dma_bdrv_write (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector, +void (*cb)(void *opaque,int ret),void *opaque) {return dma_bdrv_io (bs, sg, sector, bdrv_aio_writev, cb, opaque,DMA_DIRECTION_TO_DEVICE );hw/block/nvme.h +1
-1@@ -636,7 +636,7 @@ typedef struct NvmeAsyncEvent { typedef struct NvmeRequest { struct NvmeSQueue *sq; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; uint16_t status; NvmeCqe cqe; BlockAcctCookie acct;hw/ide/ahci.c +1
-1@@ -1104,7 +1104,7 @@ out: }static void ahci_start_dma (IDEDMA *dma,IDEState *s, -BlockDriverCompletionFunc *dma_cb) +BlockCompletionFunc *dma_cb) {#ifdef DEBUG_AHCI AHCIDevice *ad =DO_UPCAST (AHCIDevice, dma, dma);hw/ide/ahci.h +1
-1@@ -241,7 +241,7 @@ typedef struct AHCIDevice AHCIDevice; typedef struct NCQTransferState { AHCIDevice *drive; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; QEMUSGList sglist; BlockAcctCookie acct; uint16_t sector_count;hw/ide/core.c +6
-6@@ -360,15 +360,15 @@ static void ide_set_signature(IDEState *s) }typedef struct TrimAIOCB { -BlockDriverAIOCB common; +BlockAIOCB common;QEMUBH *bh;int ret;QEMUIOVector *qiov; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;int i, j; }TrimAIOCB ; -static void trim_aio_cancel (BlockDriverAIOCB *acb) +static void trim_aio_cancel (BlockAIOCB *acb) {TrimAIOCB *iocb =container_of (acb, TrimAIOCB, common);@@ -440,9 +440,9 @@ static void ide_issue_trim_cb(void *opaque, int ret) } } -BlockDriverAIOCB *ide_issue_trim (BlockDriverState *bs, +BlockAIOCB *ide_issue_trim (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {TrimAIOCB *iocb;@@ -784,7 +784,7 @@ static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)ide_start_dma (s, ide_dma_cb); } -void ide_start_dma (IDEState *s,BlockDriverCompletionFunc *cb) +void ide_start_dma (IDEState *s,BlockCompletionFunc *cb) {if (s->bus->dma->ops->start_dma) { s->bus->dma->ops->start_dma (s->bus->dma, s, cb);hw/ide/internal.h +6
-6@@ -319,7 +319,7 @@ typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind;typedef void EndTransferFunc (IDEState *); -typedef void DMAStartFunc (IDEDMA *,IDEState *,BlockDriverCompletionFunc *); +typedef void DMAStartFunc (IDEDMA *,IDEState *,BlockCompletionFunc *);typedef void DMAVoidFunc (IDEDMA *);typedef int DMAIntFunc (IDEDMA *,int );typedef void DMAStopFunc (IDEDMA *,bool );@@ -389,7 +389,7 @@ struct IDEState {int cd_sector_size;int atapi_dma;/* true if dma is requested for the packet cmd */ BlockAcctCookie acct; -BlockDriverAIOCB *pio_aiocb; +BlockAIOCB *pio_aiocb;struct iovec iov;QEMUIOVector qiov;/* ATA DMA state */ @@ -442,7 +442,7 @@ struct IDEDMA {const struct IDEDMAOps *ops;struct iovec iov;QEMUIOVector qiov; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb; };struct IDEBus {@@ -521,7 +521,7 @@ void ide_bus_reset(IDEBus *bus);int64_t ide_get_sector (IDEState *s);void ide_set_sector (IDEState *s,int64_t sector_num); -void ide_start_dma (IDEState *s,BlockDriverCompletionFunc *cb); +void ide_start_dma (IDEState *s,BlockCompletionFunc *cb);void ide_dma_error (IDEState *s);void ide_atapi_cmd_ok (IDEState *s);@@ -555,9 +555,9 @@ void ide_transfer_start(IDEState *s, uint8_t *buf, int size, EndTransferFunc *end_transfer_func);void ide_transfer_stop (IDEState *s);void ide_set_inactive (IDEState *s,bool more); -BlockDriverAIOCB *ide_issue_trim (BlockDriverState *bs, +BlockAIOCB *ide_issue_trim (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);/* hw/ide/atapi.c */ void ide_atapi_cmd (IDEState *s);hw/ide/macio.c +1
-1@@ -555,7 +555,7 @@ static void ide_nop_restart(void *opaque, int x, RunState y) }static void ide_dbdma_start (IDEDMA *dma,IDEState *s, -BlockDriverCompletionFunc *cb) +BlockCompletionFunc *cb) {MACIOIDEState *m =container_of (dma, MACIOIDEState, dma);hw/ide/pci.c +1
-1@@ -38,7 +38,7 @@ IDE_RETRY_READ | IDE_RETRY_FLUSH)static void bmdma_start_dma (IDEDMA *dma,IDEState *s, -BlockDriverCompletionFunc *dma_cb) +BlockCompletionFunc *dma_cb) {BMDMAState *bm =DO_UPCAST (BMDMAState, dma, dma);hw/ide/pci.h +1
-1@@ -23,7 +23,7 @@ typedef struct BMDMAState {uint32_t cur_prd_addr;uint32_t cur_prd_len;uint8_t unit; -BlockDriverCompletionFunc *dma_cb; +BlockCompletionFunc *dma_cb;int64_t sector_num;uint32_t nsector;MemoryRegion addr_ioport;hw/ppc/mac.h +1
-1@@ -131,7 +131,7 @@ typedef struct MACIOIDEState {MemoryRegion mem;IDEBus bus; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;IDEDMA dma;void *dbdma;bool dma_active;hw/scsi/scsi-generic.c +1
-1@@ -157,7 +157,7 @@ static void scsi_cancel_io(SCSIRequest *req)static int execute_command (BlockDriverState *bdrv,SCSIGenericReq *r,int direction, -BlockDriverCompletionFunc *complete) +BlockCompletionFunc *complete) { r->io_header.interface_id ='S' ; r->io_header.dxfer_direction = direction;include/block/aio.h +6
-6@@ -22,23 +22,23 @@#include "qemu/rfifolock.h" #include "qemu/timer.h" -typedef struct BlockDriverAIOCB BlockDriverAIOCB ; -typedef void BlockDriverCompletionFunc (void *opaque,int ret); +typedef struct BlockAIOCB BlockAIOCB ; +typedef void BlockCompletionFunc (void *opaque,int ret);typedef struct AIOCBInfo { -void (*cancel)(BlockDriverAIOCB *acb); +void (*cancel)(BlockAIOCB *acb);size_t aiocb_size; }AIOCBInfo ; -struct BlockDriverAIOCB { +struct BlockAIOCB {const AIOCBInfo *aiocb_info;BlockDriverState *bs; -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;void *opaque; };void *qemu_aio_get (const AIOCBInfo *aiocb_info,BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);void qemu_aio_release (void *p);typedef struct AioHandler AioHandler ;include/block/block.h +18
-18@@ -246,9 +246,9 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors);int bdrv_write_zeroes (BlockDriverState *bs,int64_t sector_num,int nb_sectors,BdrvRequestFlags flags); -BlockDriverAIOCB *bdrv_aio_write_zeroes (BlockDriverState *bs,int64_t sector_num, -int nb_sectors,BdrvRequestFlags flags, -BlockDriverCompletionFunc *cb,void *opaque); +BlockAIOCB *bdrv_aio_write_zeroes (BlockDriverState *bs,int64_t sector_num, +int nb_sectors,BdrvRequestFlags flags, +BlockCompletionFunc *cb,void *opaque);int bdrv_make_zero (BlockDriverState *bs,BdrvRequestFlags flags);int bdrv_pread (BlockDriverState *bs,int64_t offset,void *buf,int count);@@ -324,18 +324,18 @@ BlockDriverState *check_to_replace_node(const char *node_name, Error **errp);/* async block I/O */ typedef void BlockDriverDirtyHandler (BlockDriverState *bs,int64_t sector,int sector_num); -BlockDriverAIOCB *bdrv_aio_readv (BlockDriverState *bs,int64_t sector_num, -QEMUIOVector *iov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *bdrv_aio_writev (BlockDriverState *bs,int64_t sector_num, -QEMUIOVector *iov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *bdrv_aio_flush (BlockDriverState *bs, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *bdrv_aio_discard (BlockDriverState *bs, -int64_t sector_num,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); -void bdrv_aio_cancel (BlockDriverAIOCB *acb); +BlockAIOCB *bdrv_aio_readv (BlockDriverState *bs,int64_t sector_num, +QEMUIOVector *iov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *bdrv_aio_writev (BlockDriverState *bs,int64_t sector_num, +QEMUIOVector *iov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *bdrv_aio_flush (BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *bdrv_aio_discard (BlockDriverState *bs, +int64_t sector_num,int nb_sectors, +BlockCompletionFunc *cb,void *opaque); +void bdrv_aio_cancel (BlockAIOCB *acb); typedef struct BlockRequest { /* Fields to be filled by multiwrite caller */@@ -343,7 +343,7 @@ typedef struct BlockRequest {int nb_sectors;int flags;QEMUIOVector *qiov; -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;void *opaque;/* Filled by multiwrite implementation */ @@ -355,9 +355,9 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs,/* sg packet commands */ int bdrv_ioctl (BlockDriverState *bs,unsigned long int req,void *buf); -BlockDriverAIOCB *bdrv_aio_ioctl (BlockDriverState *bs, +BlockAIOCB *bdrv_aio_ioctl (BlockDriverState *bs,unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);/* Invalidate any cached metadata used by image formats */ void bdrv_invalidate_cache (BlockDriverState *bs,Error **errp);include/block/block_int.h +15
-15@@ -127,17 +127,17 @@ struct BlockDriver {void (*bdrv_refresh_filename)(BlockDriverState *bs);/* aio */ -BlockDriverAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs, +BlockAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); - BlockDriverAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque); -BlockDriverAIOCB *(*bdrv_aio_discard)(BlockDriverState *bs, +BlockCompletionFunc *cb,void *opaque); + BlockAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque); +BlockAIOCB *(*bdrv_aio_discard)(BlockDriverState *bs,int64_t sector_num,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque); int coroutine_fn (*bdrv_co_readv)(BlockDriverState *bs,int64_t sector_num,int nb_sectors,QEMUIOVector *qiov);@@ -217,9 +217,9 @@ struct BlockDriver {/* to control generic scsi devices */ int (*bdrv_ioctl)(BlockDriverState *bs,unsigned long int req,void *buf); -BlockDriverAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs, +BlockAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs,unsigned long int req,void *buf, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque);/* List of options for creating images, terminated by name == NULL */ QemuOptsList *create_opts;@@ -501,7 +501,7 @@ int is_windows_drive(const char *filename);*/ void stream_start (BlockDriverState *bs,BlockDriverState *base,const char *base_id,int64_t speed,BlockdevOnError on_error, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque,Error **errp);/** @@ -519,7 +519,7 @@ void stream_start(BlockDriverState *bs, BlockDriverState *base,*/ void commit_start (BlockDriverState *bs,BlockDriverState *base,BlockDriverState *top,int64_t speed, -BlockdevOnError on_error,BlockDriverCompletionFunc *cb, +BlockdevOnError on_error,BlockCompletionFunc *cb,void *opaque,const char *backing_file_str,Error **errp);/** * commit_active_start: @@ -535,7 +535,7 @@ void commit_start(BlockDriverState *bs, BlockDriverState *base,void commit_active_start (BlockDriverState *bs,BlockDriverState *base,int64_t speed,BlockdevOnError on_error, -BlockDriverCompletionFunc *cb, +BlockCompletionFunc *cb,void *opaque,Error **errp);/* * mirror_start: @@ -563,7 +563,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, int64_t granularity, int64_t buf_size, MirrorSyncMode mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp);/* @@ -584,7 +584,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, void *opaque, + BlockCompletionFunc *cb, void *opaque, Error **errp);#endif /* BLOCK_INT_H */ include/block/blockjob.h +2
-2@@ -104,7 +104,7 @@ struct BlockJob {int64_t speed;/** The completion function that will be called when the job completes. */ -BlockDriverCompletionFunc *cb; +BlockCompletionFunc *cb;/** Block other operations when block job is running */ Error *blocker;@@ -132,7 +132,7 @@ struct BlockJob {* called from a wrapper that is specific to the job type. */ void *block_job_create (const BlockJobDriver *driver,BlockDriverState *bs, -int64_t speed,BlockDriverCompletionFunc *cb, +int64_t speed,BlockCompletionFunc *cb,void *opaque,Error **errp);/** include/block/thread-pool.h +2
-2@@ -27,9 +27,9 @@ typedef struct ThreadPool ThreadPool;ThreadPool *thread_pool_new (struct AioContext *ctx);void thread_pool_free (ThreadPool *pool); -BlockDriverAIOCB *thread_pool_submit_aio (ThreadPool *pool, +BlockAIOCB *thread_pool_submit_aio (ThreadPool *pool,ThreadPoolFunc *func,void *arg, -BlockDriverCompletionFunc *cb,void *opaque); +BlockCompletionFunc *cb,void *opaque); int coroutine_fn thread_pool_submit_co(ThreadPool *pool, ThreadPoolFunc *func, void *arg);void thread_pool_submit (ThreadPool *pool,ThreadPoolFunc *func,void *arg);include/hw/scsi/scsi.h +1
-1@@ -52,7 +52,7 @@ struct SCSIRequest {uint32_t status;size_t resid;SCSICommand cmd; -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;QEMUSGList *sg;bool dma_started;uint8_t sense[SCSI_SENSE_BUF_SIZE ];include/monitor/monitor.h +2
-2@@ -27,10 +27,10 @@ int monitor_suspend(Monitor *mon);void monitor_resume (Monitor *mon);int monitor_read_bdrv_key_start (Monitor *mon,BlockDriverState *bs, -BlockDriverCompletionFunc *completion_cb, +BlockCompletionFunc *completion_cb,void *opaque);int monitor_read_block_device_key (Monitor *mon,const char *device, -BlockDriverCompletionFunc *completion_cb, +BlockCompletionFunc *completion_cb,void *opaque);int monitor_get_fd (Monitor *mon,const char *fdname,Error **errp);include/sysemu/dma.h +13
-13@@ -196,20 +196,20 @@ void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len);void qemu_sglist_destroy (QEMUSGList *qsg);#endif -typedef BlockDriverAIOCB *DMAIOFunc (BlockDriverState *bs,int64_t sector_num, -QEMUIOVector *iov,int nb_sectors, -BlockDriverCompletionFunc *cb,void *opaque); +typedef BlockAIOCB *DMAIOFunc (BlockDriverState *bs,int64_t sector_num, +QEMUIOVector *iov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *dma_bdrv_io (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector_num, -DMAIOFunc *io_func,BlockDriverCompletionFunc *cb, -void *opaque,DMADirection dir); -BlockDriverAIOCB *dma_bdrv_read (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector, -BlockDriverCompletionFunc *cb,void *opaque); -BlockDriverAIOCB *dma_bdrv_write (BlockDriverState *bs, -QEMUSGList *sg,uint64_t sector, -BlockDriverCompletionFunc *cb,void *opaque); +BlockAIOCB *dma_bdrv_io (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector_num, +DMAIOFunc *io_func,BlockCompletionFunc *cb, +void *opaque,DMADirection dir); +BlockAIOCB *dma_bdrv_read (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector, +BlockCompletionFunc *cb,void *opaque); +BlockAIOCB *dma_bdrv_write (BlockDriverState *bs, +QEMUSGList *sg,uint64_t sector, +BlockCompletionFunc *cb,void *opaque);uint64_t dma_buf_read (uint8_t *ptr,int32_t len,QEMUSGList *sg);uint64_t dma_buf_write (uint8_t *ptr,int32_t len,QEMUSGList *sg);monitor.c +3
-3@@ -206,7 +206,7 @@ struct Monitor {ReadLineState *rs;MonitorControl *mc;CPUState *mon_cpu; -BlockDriverCompletionFunc *password_completion_cb; +BlockCompletionFunc *password_completion_cb;void *password_opaque;mon_cmd_t *cmd_table;QError *error;@@ -5361,7 +5361,7 @@ ReadLineState *monitor_get_rs(Monitor *mon) }int monitor_read_bdrv_key_start (Monitor *mon,BlockDriverState *bs, -BlockDriverCompletionFunc *completion_cb, +BlockCompletionFunc *completion_cb,void *opaque) {int err;@@ -5393,7 +5393,7 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, }int monitor_read_block_device_key (Monitor *mon,const char *device, -BlockDriverCompletionFunc *completion_cb, +BlockCompletionFunc *completion_cb,void *opaque) {BlockDriverState *bs;tests/test-thread-pool.c +1
-1@@ -10,7 +10,7 @@ static ThreadPool *pool;static int active;typedef struct { -BlockDriverAIOCB *aiocb; +BlockAIOCB *aiocb;int n;int ret; }WorkerTestData ;thread-pool.c +4
-4@@ -35,7 +35,7 @@ enum ThreadState { };struct ThreadPoolElement { -BlockDriverAIOCB common; +BlockAIOCB common;ThreadPool *pool;ThreadPoolFunc *func;void *arg;@@ -201,7 +201,7 @@ restart: } } -static void thread_pool_cancel (BlockDriverAIOCB *acb) +static void thread_pool_cancel (BlockAIOCB *acb) {ThreadPoolElement *elem = (ThreadPoolElement *)acb;ThreadPool *pool = elem->pool;@@ -235,9 +235,9 @@ static const AIOCBInfo thread_pool_aiocb_info = { .cancel = thread_pool_cancel, }; -BlockDriverAIOCB *thread_pool_submit_aio (ThreadPool *pool, +BlockAIOCB *thread_pool_submit_aio (ThreadPool *pool,ThreadPoolFunc *func,void *arg, -BlockDriverCompletionFunc *cb,void *opaque) +BlockCompletionFunc *cb,void *opaque) {ThreadPoolElement *req;Signature · 1 line
1.9.3
I think you should rebase this on top of Fam's null driver.
Re: [Qemu-devel] [PATCH 11/23] block: Rename BlockDriverAIOCB* to BlockAIOCB*
Quoted 1 line · Benoît Canet
I think you should rebase this on top of Fam's null driver.
This patch is prone to conflicts, but I expect them to be trivial. I'll rebase onto whatever is current when we're ready to merge.
PATCH 12/23 virtio-blk: Drop redundant VirtIOBlock member conf
In reply to Markus ArmbrusterCommit 12c5674 turned it into a pointer to member blk.conf.
--- hw/block/virtio-blk.c | 28 ++++++++++++++-------------- include/hw/virtio/virtio-blk.h | 1 - 2 files changed, 14 insertions(+), 15 deletions(-)
hw/block/virtio-blk.c +14 -14
@@ -297,7 +297,7 @@ static bool virtio_blk_sect_range_ok(VirtIOBlock *dev,if (sector & dev->sector_mask) {return false; } -if (size % dev->conf->logical_block_size) { +if (size % dev->blk.conf.logical_block_size) {return false; }bdrv_get_geometry (dev->bs, &total_sectors);
@@ -516,19 +516,20 @@ static void virtio_blk_reset(VirtIODevice *vdev)static void virtio_blk_update_config (VirtIODevice *vdev,uint8_t *config) {VirtIOBlock *s =VIRTIO_BLK (vdev); +BlockConf *conf = &s->blk.conf;struct virtio_blk_config blkcfg;uint64_t capacity; -int blk_size = s->conf->logical_block_size; +int blk_size = conf->logical_block_size;bdrv_get_geometry (s->bs, &capacity);memset (&blkcfg,0 ,sizeof (blkcfg));virtio_stq_p (vdev, &blkcfg.capacity, capacity);virtio_stl_p (vdev, &blkcfg.seg_max,128 -2 ); -virtio_stw_p (vdev, &blkcfg.cylinders, s->conf->cyls); +virtio_stw_p (vdev, &blkcfg.cylinders, conf->cyls);virtio_stl_p (vdev, &blkcfg.blk_size, blk_size); -virtio_stw_p (vdev, &blkcfg.min_io_size, s->conf->min_io_size / blk_size); -virtio_stw_p (vdev, &blkcfg.opt_io_size, s->conf->opt_io_size / blk_size); - blkcfg.heads = s->conf->heads; +virtio_stw_p (vdev, &blkcfg.min_io_size, conf->min_io_size / blk_size); +virtio_stw_p (vdev, &blkcfg.opt_io_size, conf->opt_io_size / blk_size); + blkcfg.heads = conf->heads;/* * We must ensure that the block device capacity is a multiple of * the logical block size. If that is not the case, let's use
@@ -540,13 +541,13 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)* divided by 512 - instead it is the amount of blk_size blocks * per track (cylinder). */ -if (bdrv_getlength (s->bs) / s->conf->heads / s->conf->secs % blk_size) { - blkcfg.sectors = s->conf->secs & ~s->sector_mask; +if (bdrv_getlength (s->bs) / conf->heads / conf->secs % blk_size) { + blkcfg.sectors = conf->secs & ~s->sector_mask; }else { - blkcfg.sectors = s->conf->secs; + blkcfg.sectors = conf->secs; } blkcfg.size_max =0 ; - blkcfg.physical_block_exp =get_physical_block_exp (s->conf); + blkcfg.physical_block_exp =get_physical_block_exp (&s->blk.conf); blkcfg.alignment_offset =0 ; blkcfg.wce =bdrv_enable_write_cache (s->bs);memcpy (config, &blkcfg,sizeof (struct virtio_blk_config ));
@@ -753,9 +754,8 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) sizeof(struct virtio_blk_config)); s->bs = blk->conf.bs; - s->conf = &blk->conf; s->rq =NULL ; - s->sector_mask = (s->conf->logical_block_size /BDRV_SECTOR_SIZE ) -1 ; + s->sector_mask = (s->blk.conf.logical_block_size /BDRV_SECTOR_SIZE ) -1 ; s->vq =virtio_add_queue (vdev,128 , virtio_blk_handle_output); s->complete_request = virtio_blk_complete_request;
@@ -774,11 +774,11 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)register_savevm (dev,"virtio-blk" , virtio_blk_id++,2 , virtio_blk_save, virtio_blk_load, s);bdrv_set_dev_ops (s->bs, &virtio_block_ops, s); -bdrv_set_guest_block_size (s->bs, s->conf->logical_block_size); +bdrv_set_guest_block_size (s->bs, s->blk.conf.logical_block_size);bdrv_iostatus_enable (s->bs); -add_boot_device_path (s->conf->bootindex, dev,"/disk@0,0" ); +add_boot_device_path (s->blk.conf.bootindex, dev,"/disk@0,0" ); }static void virtio_blk_device_unrealize (DeviceState *dev,Error **errp)
include/hw/virtio/virtio-blk.h +0 -1
@@ -124,7 +124,6 @@ typedef struct VirtIOBlock {VirtQueue *vq;void *rq;QEMUBH *bh; -BlockConf *conf;VirtIOBlkConf blk;unsigned short sector_mask;bool original_wce;
Signature · 1 line
1.9.3
PATCH 13/23 virtio-blk: Rename VirtIOBlkConf variables to conf
In reply to Markus ArmbrusterThis is consistent with how VirtIOFOOConf variables are named elsewhere, and makes blk available for BlockBackend variables.
--- hw/block/dataplane/virtio-blk.c | 33 +++++++++++++------------- hw/block/dataplane/virtio-blk.h | 2 +- hw/block/virtio-blk.c | 52 ++++++++++++++++++++--------------------- include/hw/virtio/virtio-blk.h | 2 +- 4 files changed, 45 insertions(+), 44 deletions(-)
hw/block/dataplane/virtio-blk.c +17 -16
@@ -30,7 +30,7 @@ struct VirtIOBlockDataPlane {bool stopping;bool disabled; -VirtIOBlkConf *blk; +VirtIOBlkConf *conf;VirtIODevice *vdev;Vring vring;/* virtqueue vring */
@@ -94,7 +94,7 @@ static void handle_notify(EventNotifier *e)VirtIOBlock *vblk =VIRTIO_BLK (s->vdev);event_notifier_test_and_clear (&s->host_notifier); -bdrv_io_plug (s->blk->conf.bs); +bdrv_io_plug (s->conf->conf.bs);for (;;) {MultiReqBuffer mrb = { .num_writes =0 ,
@@ -120,7 +120,7 @@ static void handle_notify(EventNotifier *e)virtio_blk_handle_request (req, &mrb); } -virtio_submit_multiwrite (s->blk->conf.bs, &mrb); +virtio_submit_multiwrite (s->conf->conf.bs, &mrb);if (likely (ret == -EAGAIN )) {/* vring emptied */ /* Re-enable guest->host notifies and stop processing the vring.
@@ -133,11 +133,11 @@ static void handle_notify(EventNotifier *e)break ; } } -bdrv_io_unplug (s->blk->conf.bs); +bdrv_io_unplug (s->conf->conf.bs); }/* Context: QEMU global mutex held */ -void virtio_blk_data_plane_create (VirtIODevice *vdev,VirtIOBlkConf *blk, +void virtio_blk_data_plane_create (VirtIODevice *vdev,VirtIOBlkConf *conf,VirtIOBlockDataPlane **dataplane,Error **errp) {
@@ -148,7 +148,7 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk, *dataplane =NULL ; -if (!blk->data_plane && !blk->iothread) { +if (!conf->data_plane && !conf->iothread) {return ; }
@@ -163,7 +163,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,/* If dataplane is (re-)enabled while the guest is running there could be * block jobs that can conflict. */ -if (bdrv_op_is_blocked (blk->conf.bs,BLOCK_OP_TYPE_DATAPLANE , &local_err)) { +if (bdrv_op_is_blocked (conf->conf.bs,BLOCK_OP_TYPE_DATAPLANE , + &local_err)) {error_report ("cannot start dataplane thread: %s" ,error_get_pretty (local_err));error_free (local_err);
@@ -172,10 +173,10 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk, s =g_new0 (VirtIOBlockDataPlane,1 ); s->vdev = vdev; - s->blk = blk; + s->conf = conf; -if (blk->iothread) { - s->iothread = blk->iothread; +if (conf->iothread) { + s->iothread = conf->iothread;object_ref (OBJECT (s->iothread)); }else {/* Create per-device IOThread if none specified. This is for
@@ -192,9 +193,9 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk, s->bh =aio_bh_new (s->ctx, notify_guest_bh, s);error_setg (&s->blocker,"block device is in use by data plane" ); -bdrv_op_block_all (blk->conf.bs, s->blocker); -bdrv_op_unblock (blk->conf.bs,BLOCK_OP_TYPE_RESIZE , s->blocker); -bdrv_op_unblock (blk->conf.bs,BLOCK_OP_TYPE_DRIVE_DEL , s->blocker); +bdrv_op_block_all (conf->conf.bs, s->blocker); +bdrv_op_unblock (conf->conf.bs,BLOCK_OP_TYPE_RESIZE , s->blocker); +bdrv_op_unblock (conf->conf.bs,BLOCK_OP_TYPE_DRIVE_DEL , s->blocker); *dataplane = s; }
@@ -207,7 +208,7 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s) }virtio_blk_data_plane_stop (s); -bdrv_op_unblock_all (s->blk->conf.bs, s->blocker); +bdrv_op_unblock_all (s->conf->conf.bs, s->blocker);error_free (s->blocker);object_unref (OBJECT (s->iothread));qemu_bh_delete (s->bh);
@@ -262,7 +263,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) s->started = true;trace_virtio_blk_data_plane_start (s); -bdrv_set_aio_context (s->blk->conf.bs, s->ctx); +bdrv_set_aio_context (s->conf->conf.bs, s->ctx);/* Kick right away to begin processing requests already in vring */ event_notifier_set (virtio_queue_get_host_notifier (vq));
@@ -308,7 +309,7 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)aio_set_event_notifier (s->ctx, &s->host_notifier,NULL );/* Drain and switch bs back to the QEMU main loop */ -bdrv_set_aio_context (s->blk->conf.bs,qemu_get_aio_context ()); +bdrv_set_aio_context (s->conf->conf.bs,qemu_get_aio_context ());aio_context_release (s->ctx);
hw/block/dataplane/virtio-blk.h +1 -1
@@ -19,7 +19,7 @@typedef struct VirtIOBlockDataPlane VirtIOBlockDataPlane ; -void virtio_blk_data_plane_create (VirtIODevice *vdev,VirtIOBlkConf *blk, +void virtio_blk_data_plane_create (VirtIODevice *vdev,VirtIOBlkConf *conf,VirtIOBlockDataPlane **dataplane,Error **errp);void virtio_blk_data_plane_destroy (VirtIOBlockDataPlane *s);
hw/block/virtio-blk.c +26 -26
150 lines not on this page · raw message
include/hw/virtio/virtio-blk.h +1 -1
@@ -124,7 +124,7 @@ typedef struct VirtIOBlock {VirtQueue *vq;void *rq;QEMUBH *bh; -VirtIOBlkConf blk; +VirtIOBlkConf conf;unsigned short sector_mask;bool original_wce;VMChangeStateEntry *change;
Signature · 1 line
1.9.3
PATCH 14/23 hw: Convert from BlockDriverState to BlockBackend, mostly
In reply to Markus ArmbrusterJust four uses of BlockDriverState are left:
* The Xen paravirtual block device backend (xen_disk.c) opens images itself when set up via xenbus, bypassing blockdev.c. I figure it should go through qmp_blockdev_add() instead.
* Device model "usb-storage" prompts for keys. No other device model does, and this one probably shouldn't do it, either.
* ide_issue_trim_cb() uses bdrv_aio_discard() instead of blk_aio_discard() because it fishes its backend out of a BlockAIOCB, which has only the BlockDriverState.
* PC87312State has an unused BlockDriverState[] member.
The next two commits take care of the latter two.
--- block/block-backend.c | 276 +++++++++++++++++++++++++++++++ blockdev.c | 23 +-- dma-helpers.c | 61 +++---- hw/arm/collie.c | 5 +- hw/arm/gumstix.c | 5 +- hw/arm/highbank.c | 2 +- hw/arm/mainstone.c | 2 +- hw/arm/musicpal.c | 10 +- hw/arm/nseries.c | 3 +- hw/arm/omap1.c | 2 +- hw/arm/omap2.c | 2 +- hw/arm/omap_sx1.c | 5 +- hw/arm/pxa2xx.c | 4 +- hw/arm/realview.c | 2 +- hw/arm/spitz.c | 4 +- hw/arm/tosa.c | 3 +- hw/arm/versatilepb.c | 3 +- hw/arm/vexpress.c | 3 +- hw/arm/xilinx_zynq.c | 3 +- hw/arm/z2.c | 3 +- hw/block/block.c | 7 +- hw/block/dataplane/virtio-blk.c | 24 +-- hw/block/fdc.c | 78 +++++---- hw/block/hd-geometry.c | 24 +-- hw/block/m25p80.c | 28 ++-- hw/block/nand.c | 50 +++--- hw/block/nvme.c | 17 +- hw/block/onenand.c | 67 ++++---- hw/block/pflash_cfi01.c | 24 +-- hw/block/pflash_cfi02.c | 24 +-- hw/block/virtio-blk.c | 95 +++++------ hw/block/xen_disk.c | 83 +++++----- hw/core/qdev-properties-system.c | 26 +-- hw/core/qdev-properties.c | 2 +- hw/cris/axis_dev88.c | 3 +- hw/display/tc6393xb.c | 2 +- hw/i386/pc.c | 2 +- hw/i386/pc_piix.c | 2 +- hw/i386/pc_sysfw.c | 9 +- hw/i386/xen/xen_platform.c | 5 +- hw/ide/ahci.c | 31 ++-- hw/ide/atapi.c | 33 ++-- hw/ide/cmd646.c | 2 +- hw/ide/core.c | 190 +++++++++++---------- hw/ide/ich.c | 2 +- hw/ide/internal.h | 6 +- hw/ide/isa.c | 2 +- hw/ide/macio.c | 52 +++--- hw/ide/microdrive.c | 4 +- hw/ide/mmio.c | 2 +- hw/ide/pci.c | 4 +- hw/ide/piix.c | 9 +- hw/ide/qdev.c | 11 +- hw/ide/via.c | 2 +- hw/isa/pc87312.c | 4 +- hw/lm32/lm32_boards.c | 5 +- hw/lm32/milkymist.c | 3 +- hw/microblaze/petalogix_ml605_mmu.c | 3 +- hw/microblaze/petalogix_s3adsp1800_mmu.c | 3 +- hw/mips/mips_fulong2e.c | 2 +- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 6 +- hw/mips/mips_r4k.c | 3 +- hw/nvram/spapr_nvram.c | 17 +- hw/pci/pci-hotplug-old.c | 5 +- hw/ppc/mac_newworld.c | 2 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/ppc405_boards.c | 26 +-- hw/ppc/prep.c | 2 +- hw/ppc/spapr.c | 4 +- hw/ppc/virtex_ml507.c | 3 +- hw/s390x/s390-virtio-bus.c | 2 +- hw/s390x/s390-virtio.c | 2 +- hw/s390x/virtio-ccw.c | 2 +- hw/scsi/megasas.c | 15 +- hw/scsi/scsi-bus.c | 8 +- hw/scsi/scsi-disk.c | 192 ++++++++++----------- hw/scsi/scsi-generic.c | 39 +++-- hw/sd/milkymist-memcard.c | 8 +- hw/sd/omap_mmc.c | 8 +- hw/sd/pl181.c | 2 +- hw/sd/pxa2xx_mmci.c | 4 +- hw/sd/sd.c | 60 +++---- hw/sd/sdhci.c | 2 +- hw/sd/ssi-sd.c | 2 +- hw/sh4/r2d.c | 3 +- hw/sparc/sun4m.c | 2 +- hw/sparc64/sun4u.c | 2 +- hw/tpm/tpm_tis.c | 2 +- hw/tricore/tricore_testboard.c | 2 +- hw/usb/dev-storage.c | 17 +- hw/virtio/virtio-pci.c | 2 +- hw/xen/xen_devconfig.c | 1 + hw/xenpv/xen_machine_pv.c | 2 +- hw/xtensa/xtfpga.c | 3 +- include/hw/arm/omap.h | 4 +- include/hw/arm/pxa.h | 2 +- include/hw/block/block.h | 6 +- include/hw/block/flash.h | 6 +- include/hw/qdev-properties.h | 8 +- include/hw/scsi/scsi.h | 4 +- include/hw/sd.h | 2 +- include/hw/virtio/virtio-blk.h | 6 +- include/qemu/typedefs.h | 1 + include/sysemu/block-backend.h | 78 +++++++++ include/sysemu/blockdev.h | 5 +- include/sysemu/dma.h | 24 +-- trace-events | 8 +- 108 files changed, 1157 insertions(+), 814 deletions(-)
block/block-backend.c +276 -0
@@ -129,6 +129,19 @@ static void drive_info_del(DriveInfo *dinfo) } } +/** +* blk_make_anon: +* +* Strictly for use by do_drive_del(). +* TODO get rid of it! +*/ +void blk_make_anon (BlockBackend *blk) +{ + blk->name[0 ] =0 ; +QTAILQ_REMOVE (&blk_backends, blk, link); +bdrv_make_anon (blk->bs); +} +const char *blk_name (BlockBackend *blk) {return blk->name;
@@ -224,3 +237,266 @@ BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo) }assert (0 ); } + +void blk_iostatus_enable (BlockBackend *blk) +{ +bdrv_iostatus_enable (blk->bs); +} + +int blk_attach_dev (BlockBackend *blk,void *dev) +{ +return bdrv_attach_dev (blk->bs, dev); +} + +void blk_attach_dev_nofail (BlockBackend *blk,void *dev) +{ +bdrv_attach_dev_nofail (blk->bs, dev); +} + +void blk_detach_dev (BlockBackend *blk,void *dev) +{ +bdrv_detach_dev (blk->bs, dev); +} + +void *blk_get_attached_dev (BlockBackend *blk) +{ +return bdrv_get_attached_dev (blk->bs); +} + +void blk_set_dev_ops (BlockBackend *blk,const BlockDevOps *ops,void *opaque) +{ +bdrv_set_dev_ops (blk->bs, ops, opaque); +} + +int blk_read (BlockBackend *blk,int64_t sector_num,uint8_t *buf, +int nb_sectors) +{ +return bdrv_read (blk->bs, sector_num, buf, nb_sectors); +} + +int blk_read_unthrottled (BlockBackend *blk,int64_t sector_num,uint8_t *buf, +int nb_sectors) +{ +return bdrv_read_unthrottled (blk->bs, sector_num, buf, nb_sectors); +} + +int blk_write (BlockBackend *blk,int64_t sector_num,const uint8_t *buf, +int nb_sectors) +{ +return bdrv_write (blk->bs, sector_num, buf, nb_sectors); +} + +BlockAIOCB *blk_aio_write_zeroes (BlockBackend *blk,int64_t sector_num, +int nb_sectors,BdrvRequestFlags flags, +BlockCompletionFunc *cb,void *opaque) +{ +return bdrv_aio_write_zeroes (blk->bs, sector_num, nb_sectors, flags, + cb, opaque); +} + +int blk_pread (BlockBackend *blk,int64_t offset,void *buf,int count) +{ +return bdrv_pread (blk->bs, offset, buf, count); +} + +int blk_pwrite (BlockBackend *blk,int64_t offset,const void *buf,int count) +{ +return bdrv_pwrite (blk->bs, offset, buf, count); +} + +int64_t blk_getlength (BlockBackend *blk) +{ +return bdrv_getlength (blk->bs); +} + +void blk_get_geometry (BlockBackend *blk,uint64_t *nb_sectors_ptr) +{ +bdrv_get_geometry (blk->bs, nb_sectors_ptr); +} + +BlockAIOCB *blk_aio_readv (BlockBackend *blk,int64_t sector_num, +QEMUIOVector *iov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque) +{ +return bdrv_aio_readv (blk->bs, sector_num, iov, nb_sectors, cb, opaque); +} + +BlockAIOCB *blk_aio_writev (BlockBackend *blk,int64_t sector_num, +QEMUIOVector *iov,int nb_sectors, +BlockCompletionFunc *cb,void *opaque) +{ +return bdrv_aio_writev (blk->bs, sector_num, iov, nb_sectors, cb, opaque); +} + +BlockAIOCB *blk_aio_flush (BlockBackend *blk, +BlockCompletionFunc *cb,void *opaque) +{ +return bdrv_aio_flush (blk->bs, cb, opaque); +} + +BlockAIOCB *blk_aio_discard (BlockBackend *blk, +int64_t sector_num,int nb_sectors, +BlockCompletionFunc *cb,void *opaque) +{ +return bdrv_aio_discard (blk->bs, sector_num, nb_sectors, cb, opaque); +} + +void blk_aio_cancel (BlockAIOCB *acb) +{ +bdrv_aio_cancel (acb); +} + +int blk_aio_multiwrite (BlockBackend *blk,BlockRequest *reqs,int num_reqs) +{ +return bdrv_aio_multiwrite (blk->bs, reqs, num_reqs); +} + +int blk_ioctl (BlockBackend *blk,unsigned long int req,void *buf) +{ +return bdrv_ioctl (blk->bs, req, buf); +} + +BlockAIOCB *blk_aio_ioctl (BlockBackend *blk,unsigned long int req,void *buf, +BlockCompletionFunc *cb,void *opaque) +{ +return bdrv_aio_ioctl (blk->bs, req, buf, cb, opaque); +} + +int blk_flush (BlockBackend *blk) +{ +return bdrv_flush (blk->bs); +} + +int blk_flush_all (void ) +{ +return bdrv_flush_all (); +} + +void blk_drain_all (void ) +{ +bdrv_drain_all (); +} + +BlockdevOnError blk_get_on_error (BlockBackend *blk,bool is_read) +{ +return bdrv_get_on_error (blk->bs, is_read); +} + +BlockErrorAction blk_get_error_action (BlockBackend *blk,bool is_read, +int error) +{ +return bdrv_get_error_action (blk->bs, is_read, error); +} + +void blk_error_action (BlockBackend *blk,BlockErrorAction action, +bool is_read,int error) +{ +bdrv_error_action (blk->bs, action, is_read, error); +} + +int blk_is_read_only (BlockBackend *blk) +{ +return bdrv_is_read_only (blk->bs); +} + +int blk_is_sg (BlockBackend *blk) +{ +return bdrv_is_sg (blk->bs); +} + +int blk_enable_write_cache (BlockBackend *blk) +{ +return bdrv_enable_write_cache (blk->bs); +} + +void blk_set_enable_write_cache (BlockBackend *blk,bool wce) +{ +bdrv_set_enable_write_cache (blk->bs, wce); +} + +int blk_is_inserted (BlockBackend *blk) +{ +return bdrv_is_inserted (blk->bs); +} + +void blk_lock_medium (BlockBackend *blk,bool locked) +{ +bdrv_lock_medium (blk->bs, locked); +} + +void blk_eject (BlockBackend *blk,bool eject_flag) +{ +bdrv_eject (blk->bs, eject_flag); +} + +int blk_get_flags (BlockBackend *blk) +{ +return bdrv_get_flags (blk->bs); +} + +void blk_set_guest_block_size (BlockBackend *blk,int align) +{ +bdrv_set_guest_block_size (blk->bs, align); +} + +void *blk_blockalign (BlockBackend *blk,size_t size) +{ +return qemu_blockalign (blk ? blk->bs :NULL , size); +} + +bool blk_op_is_blocked (BlockBackend *blk,BlockOpType op,Error **errp) +{ +return bdrv_op_is_blocked (blk->bs, op, errp); +} + +void blk_op_unblock (BlockBackend *blk,BlockOpType op,Error *reason) +{ +bdrv_op_unblock (blk->bs, op, reason); +} + +void blk_op_block_all (BlockBackend *blk,Error *reason) +{ +bdrv_op_block_all (blk->bs, reason); +} + +void blk_op_unblock_all (BlockBackend *blk,Error *reason) +{ +bdrv_op_unblock_all (blk->bs, reason); +} + +void blk_acct_start (BlockBackend *blk,BlockAcctCookie *cookie, +int64_t bytes,enum BlockAcctType type) +{ +bdrv_acct_start (blk->bs, cookie, bytes, type); +} + +void blk_acct_done (BlockBackend *blk,BlockAcctCookie *cookie) +{ +bdrv_acct_done (blk->bs, cookie); +} + +AioContext *blk_get_aio_context (BlockBackend *blk) +{ +return bdrv_get_aio_context (blk->bs); +} + +void blk_set_aio_context (BlockBackend *blk,AioContext *new_context) +{ +bdrv_set_aio_context (blk->bs, new_context); +} + +void blk_io_plug (BlockBackend *blk) +{ +bdrv_io_plug (blk->bs); +} + +void blk_io_unplug (BlockBackend *blk) +{ +bdrv_io_unplug (blk->bs); +} + +void *blk_aio_get (const AIOCBInfo *aiocb_info,BlockBackend *blk, +BlockCompletionFunc *cb,void *opaque) +{ +return qemu_aio_get (aiocb_info,blk_bs (blk), cb, opaque); +}
blockdev.c +4 -19
@@ -85,10 +85,10 @@ static const int if_max_devs[IF_COUNT] = {* automatic deletion, and generic qdev code calls blockdev_auto_del() * when deletion is actually safe. */ -void blockdev_mark_auto_del (BlockDriverState *bs) +void blockdev_mark_auto_del (BlockBackend *blk) { -BlockBackend *blk = bs->blk;DriveInfo *dinfo =blk_legacy_dinfo (blk); +BlockDriverState *bs =blk_bs (blk);if (dinfo && !dinfo->enable_auto_del) {return ;
@@ -102,9 +102,8 @@ void blockdev_mark_auto_del(BlockDriverState *bs) } } -void blockdev_auto_del (BlockDriverState *bs) +void blockdev_auto_del (BlockBackend *blk) { -BlockBackend *blk = bs->blk;DriveInfo *dinfo =blk_legacy_dinfo (blk);if (dinfo && dinfo->auto_del) {
@@ -200,18 +199,6 @@ DriveInfo *drive_get_next(BlockInterfaceType type)return drive_get (type,0 , next_block_unit[type]++); } -DriveInfo *drive_get_by_blockdev (BlockDriverState *bs) -{ -BlockBackend *blk; - -for (blk =blk_next (NULL ); blk; blk =blk_next (blk)) { -if (blk_bs (blk) == bs) { -return blk_legacy_dinfo (blk); - } - } -return NULL ; -} -static void bdrv_format_print (void *opaque,const char *name) {error_printf (" %s" , name);
@@ -1766,9 +1753,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)* then we can just get rid of the block driver state right here. */ if (bdrv_get_attached_dev (bs)) { -blk_detach_bs (blk); -blk_unref (blk); -bdrv_make_anon (bs); +blk_make_anon (blk);/* Further I/O must not pause the guest */ bdrv_set_on_error (bs,BLOCKDEV_ON_ERROR_REPORT ,BLOCKDEV_ON_ERROR_REPORT );
dma-helpers.c +31 -30
157 lines not on this page · raw message
hw/arm/collie.c +2 -3
@@ -16,7 +16,6 @@#include "hw/arm/arm.h" #include "hw/block/flash.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "exec/address-spaces.h" static struct arm_boot_info collie_binfo = {
@@ -42,12 +41,12 @@ static void collie_init(MachineState *machine) dinfo =drive_get (IF_PFLASH ,0 ,0 );pflash_cfi01_register (SA_CS0 ,NULL ,"collie.fl1" ,0x02000000 , - dinfo ?blk_bs (blk_by_legacy_dinfo (dinfo)) :NULL , + dinfo ?blk_by_legacy_dinfo (dinfo) :NULL , (64 *1024 ),512 ,4 ,0x00 ,0x00 ,0x00 ,0x00 ,0 ); dinfo =drive_get (IF_PFLASH ,0 ,1 );pflash_cfi01_register (SA_CS1 ,NULL ,"collie.fl2" ,0x02000000 , - dinfo ?blk_bs (blk_by_legacy_dinfo (dinfo)) :NULL , + dinfo ?blk_by_legacy_dinfo (dinfo) :NULL , (64 *1024 ),512 ,4 ,0x00 ,0x00 ,0x00 ,0x00 ,0 );sysbus_create_simple ("scoop" ,0x40800000 ,NULL );
hw/arm/gumstix.c +2 -3
@@ -41,7 +41,6 @@#include "hw/devices.h" #include "hw/boards.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h"
@@ -72,7 +71,7 @@ static void connex_init(MachineState *machine) be =0 ;#endif if (!pflash_cfi01_register (0x00000000 ,NULL ,"connext.rom" , connex_rom, - dinfo ?blk_bs (blk_by_legacy_dinfo (dinfo)) :NULL , + dinfo ?blk_by_legacy_dinfo (dinfo) :NULL , sector_len, connex_rom / sector_len,2 ,0 ,0 ,0 ,0 , be)) {fprintf (stderr,"qemu: Error registering flash memory.\n" );
@@ -110,7 +109,7 @@ static void verdex_init(MachineState *machine) be =0 ;#endif if (!pflash_cfi01_register (0x00000000 ,NULL ,"verdex.rom" , verdex_rom, - dinfo ?blk_bs (blk_by_legacy_dinfo (dinfo)) :NULL , + dinfo ?blk_by_legacy_dinfo (dinfo) :NULL , sector_len, verdex_rom / sector_len,2 ,0 ,0 ,0 ,0 , be)) {fprintf (stderr,"qemu: Error registering flash memory.\n" );
hw/arm/highbank.c +1 -1
@@ -24,7 +24,7 @@#include "net/net.h" #include "sysemu/sysemu.h" #include "hw/boards.h" -#include "sysemu/blockdev.h" +#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "qemu/error-report.h"
hw/arm/mainstone.c +1 -1
@@ -148,7 +148,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,if (!pflash_cfi01_register (mainstone_flash_base[i],NULL , i ?"mainstone.flash1" :"mainstone.flash0" ,MAINSTONE_FLASH , -blk_bs (blk_by_legacy_dinfo (dinfo)), +blk_by_legacy_dinfo (dinfo), sector_len,MAINSTONE_FLASH / sector_len,4 ,0 ,0 ,0 ,0 , be)) {fprintf (stderr,"qemu: Error registering flash memory.\n" );
hw/arm/musicpal.c +4 -6
@@ -18,12 +18,10 @@#include "hw/char/serial.h" #include "qemu/timer.h" #include "hw/ptimer.h" -#include "block/block.h" #include "hw/block/flash.h" #include "ui/console.h" #include "hw/i2c/i2c.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "ui/pixel_ops.h"
@@ -1631,9 +1629,9 @@ static void musicpal_init(MachineState *machine)/* Register flash */ dinfo =drive_get (IF_PFLASH ,0 ,0 );if (dinfo) { -BlockDriverState *bs =blk_bs (blk_by_legacy_dinfo (dinfo)); +BlockBackend *blk =blk_by_legacy_dinfo (dinfo); - flash_size =bdrv_getlength (bs); + flash_size =blk_getlength (blk);if (flash_size !=8 *1024 *1024 && flash_size !=16 *1024 *1024 && flash_size !=32 *1024 *1024 ) {fprintf (stderr,"Invalid flash image size\n" );
@@ -1648,14 +1646,14 @@ static void musicpal_init(MachineState *machine)#ifdef TARGET_WORDS_BIGENDIAN pflash_cfi02_register (0x100000000ULL -MP_FLASH_SIZE_MAX ,NULL ,"musicpal.flash" , flash_size, - bs,0x10000 , (flash_size +0xffff ) >>16 , + blk,0x10000 , (flash_size +0xffff ) >>16 ,MP_FLASH_SIZE_MAX / flash_size,2 ,0x00BF ,0x236D ,0x0000 ,0x0000 ,0x5555 ,0x2AAA ,1 );#else pflash_cfi02_register (0x100000000ULL -MP_FLASH_SIZE_MAX ,NULL ,"musicpal.flash" , flash_size, - bs,0x10000 , (flash_size +0xffff ) >>16 , + blk,0x10000 , (flash_size +0xffff ) >>16 ,MP_FLASH_SIZE_MAX / flash_size,2 ,0x00BF ,0x236D ,0x0000 ,0x0000 ,0x5555 ,0x2AAA ,0 );
hw/arm/nseries.c +1 -2
@@ -32,7 +32,6 @@#include "hw/bt.h" #include "hw/loader.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "hw/sysbus.h" #include "exec/address-spaces.h"
@@ -175,7 +174,7 @@ static void n8x0_nand_setup(struct n800_s *s) dinfo =drive_get (IF_MTD ,0 ,0 );if (dinfo) {qdev_prop_set_drive_nofail (s->nand,"drive" , -blk_bs (blk_by_legacy_dinfo (dinfo))); +blk_by_legacy_dinfo (dinfo)); }qdev_init_nofail (s->nand); sysbus_connect_irq(SYS_BUS_DEVICE(s->nand), 0,
hw/arm/omap1.c +1 -1
@@ -3978,7 +3978,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,exit (1 ); } s->mmc =omap_mmc_init (0xfffb7800 , system_memory, -blk_bs (blk_by_legacy_dinfo (dinfo)), +blk_by_legacy_dinfo (dinfo),qdev_get_gpio_in (s->ih[1 ],OMAP_INT_OQN ), &s->drq[OMAP_DMA_MMC_TX ],omap_findclk (s,"mmc_ck" ));
hw/arm/omap2.c +1 -1
@@ -2461,7 +2461,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,exit (1 ); } s->mmc =omap2_mmc_init (omap_l4tao (s->l4,9 ), -blk_bs (blk_by_legacy_dinfo (dinfo)), +blk_by_legacy_dinfo (dinfo),qdev_get_gpio_in (s->ih[0 ],OMAP_INT_24XX_MMC_IRQ ), &s->drq[OMAP24XX_DMA_MMC1_TX ],omap_findclk (s,"mmc_fclk" ),omap_findclk (s,"mmc_iclk" ));
hw/arm/omap_sx1.c +2 -3
@@ -32,7 +32,6 @@#include "hw/arm/arm.h" #include "hw/block/flash.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "sysemu/qtest.h" #include "exec/address-spaces.h"
@@ -154,7 +153,7 @@ static void sx1_init(MachineState *machine, const int version)if ((dinfo =drive_get (IF_PFLASH ,0 , fl_idx)) !=NULL ) {if (!pflash_cfi01_register (OMAP_CS0_BASE ,NULL ,"omap_sx1.flash0-1" , flash_size, -blk_bs (blk_by_legacy_dinfo (dinfo)), +blk_by_legacy_dinfo (dinfo), sector_size, flash_size / sector_size,4 ,0 ,0 ,0 ,0 , be)) { fprintf(stderr, "qemu: Error registering flash memory %d.\n",
@@ -177,7 +176,7 @@ static void sx1_init(MachineState *machine, const int version)if (!pflash_cfi01_register (OMAP_CS1_BASE ,NULL ,"omap_sx1.flash1-1" , flash1_size, -blk_bs (blk_by_legacy_dinfo (dinfo)), +blk_by_legacy_dinfo (dinfo), sector_size, flash1_size / sector_size,4 ,0 ,0 ,0 ,0 , be)) { fprintf(stderr, "qemu: Error registering flash memory %d.\n",
hw/arm/pxa2xx.c +2 -2
@@ -2085,7 +2085,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,exit (1 ); } s->mmc =pxa2xx_mmci_init (address_space,0x41100000 , -blk_bs (blk_by_legacy_dinfo (dinfo)), +blk_by_legacy_dinfo (dinfo),qdev_get_gpio_in (s->pic,PXA2XX_PIC_MMC ),qdev_get_gpio_in (s->dma,PXA2XX_RX_RQ_MMCI ),qdev_get_gpio_in (s->dma,PXA2XX_TX_RQ_MMCI ));
@@ -2217,7 +2217,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)exit (1 ); } s->mmc =pxa2xx_mmci_init (address_space,0x41100000 , -blk_bs (blk_by_legacy_dinfo (dinfo)), +blk_by_legacy_dinfo (dinfo),qdev_get_gpio_in (s->pic,PXA2XX_PIC_MMC ),qdev_get_gpio_in (s->dma,PXA2XX_RX_RQ_MMCI ),qdev_get_gpio_in (s->dma,PXA2XX_TX_RQ_MMCI ));
hw/arm/realview.c +1 -1
@@ -16,7 +16,7 @@#include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/i2c/i2c.h" -#include "sysemu/blockdev.h" +#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "qemu/error-report.h"
hw/arm/spitz.c +1 -3
@@ -22,11 +22,9 @@#include "hw/devices.h" #include "hw/arm/sharpsl.h" #include "ui/console.h" -#include "block/block.h" #include "audio/audio.h" #include "hw/boards.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "hw/sysbus.h" #include "exec/address-spaces.h"
@@ -171,7 +169,7 @@ static int sl_nand_init(SysBusDevice *dev) s->ctl =0 ; nand =drive_get (IF_MTD ,0 ,0 ); - s->nand =nand_init (nand ?blk_bs (blk_by_legacy_dinfo (nand)) :NULL , + s->nand =nand_init (nand ?blk_by_legacy_dinfo (nand) :NULL , s->manf_id, s->chip_id);memory_region_init_io (&s->iomem,OBJECT (s), &sl_ops, s,"sl" ,0x40 );
hw/arm/tosa.c +1 -2
@@ -17,11 +17,10 @@#include "hw/devices.h" #include "hw/arm/sharpsl.h" #include "hw/pcmcia.h" -#include "block/block.h" #include "hw/boards.h" #include "hw/i2c/i2c.h" #include "hw/ssi.h" -#include "sysemu/blockdev.h" +#include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h"
hw/arm/versatilepb.c +1 -2
@@ -16,7 +16,6 @@#include "hw/i2c/i2c.h" #include "hw/boards.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "hw/block/flash.h"
@@ -339,7 +338,7 @@ static void versatile_init(MachineState *machine, int board_id) dinfo =drive_get (IF_PFLASH ,0 ,0 );if (!pflash_cfi01_register (VERSATILE_FLASH_ADDR ,NULL ,"versatile.flash" ,VERSATILE_FLASH_SIZE , - dinfo ?blk_bs (blk_by_legacy_dinfo (dinfo)) :NULL , + dinfo ?blk_by_legacy_dinfo (dinfo) :NULL ,VERSATILE_FLASH_SECT_SIZE ,VERSATILE_FLASH_SIZE /VERSATILE_FLASH_SECT_SIZE ,4 ,0x0089 ,0x0018 ,0x0000 ,0x0 ,0 )) {
hw/arm/vexpress.c +1 -2
@@ -31,7 +31,6 @@#include "hw/loader.h" #include "exec/address-spaces.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "hw/block/flash.h" #include "sysemu/device_tree.h" #include "qemu/error-report.h"
@@ -490,7 +489,7 @@ static pflash_t *ve_pflash_cfi01_register(hwaddr base, const char *name,DeviceState *dev =qdev_create (NULL ,"cfi.pflash01" );if (di &&qdev_prop_set_drive (dev,"drive" , -blk_bs (blk_by_legacy_dinfo (di)))) { +blk_by_legacy_dinfo (di))) {abort (); }
hw/arm/xilinx_zynq.c +1 -2
@@ -23,7 +23,6 @@#include "hw/boards.h" #include "hw/block/flash.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "hw/loader.h" #include "hw/ssi.h" #include "qemu/error-report.h"
@@ -163,7 +162,7 @@ static void zynq_init(MachineState *machine)/* AMD */ pflash_cfi02_register(0xe2000000, NULL, "zynq.pflash", FLASH_SIZE, - dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, FLASH_SECTOR_SIZE, FLASH_SIZE/FLASH_SECTOR_SIZE, 1, 1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa,
hw/arm/z2.c +1 -2
@@ -21,7 +21,6 @@#include "sysemu/sysemu.h" #include "hw/block/flash.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "ui/console.h" #include "audio/audio.h" #include "exec/address-spaces.h"
@@ -337,7 +336,7 @@ static void z2_init(MachineState *machine)if (!pflash_cfi01_register (Z2_FLASH_BASE ,NULL ,"z2.flash0" ,Z2_FLASH_SIZE , - dinfo ?blk_bs (blk_by_legacy_dinfo (dinfo)) :NULL , + dinfo ?blk_by_legacy_dinfo (dinfo) :NULL , sector_len,Z2_FLASH_SIZE / sector_len,4 ,0 ,0 ,0 ,0 , be)) {fprintf (stderr,"qemu: Error registering flash memory.\n" );
hw/block/block.c +4 -3
@@ -8,6 +8,7 @@*/ #include "sysemu/blockdev.h" +#include "sysemu/block-backend.h" #include "hw/block/block.h" #include "qemu/error-report.h"
@@ -17,7 +18,7 @@ void blkconf_serial(BlockConf *conf, char **serial)if (!*serial) {/* try to fall back to value set with legacy -drive serial=... */ - dinfo =drive_get_by_blockdev (conf->bs); + dinfo =blk_legacy_dinfo (conf->blk); *serial =g_strdup (dinfo->serial); } }
@@ -30,7 +31,7 @@ void blkconf_geometry(BlockConf *conf, int *ptrans,if (!conf->cyls && !conf->heads && !conf->secs) {/* try to fall back to value set with legacy -drive cyls=... */ - dinfo =drive_get_by_blockdev (conf->bs); + dinfo =blk_legacy_dinfo (conf->blk); conf->cyls = dinfo->cyls; conf->heads = dinfo->heads; conf->secs = dinfo->secs;
@@ -39,7 +40,7 @@ void blkconf_geometry(BlockConf *conf, int *ptrans, } }if (!conf->cyls && !conf->heads && !conf->secs) { -hd_geometry_guess (conf->bs, +hd_geometry_guess (conf->blk, &conf->cyls, &conf->heads, &conf->secs, ptrans); }else if (ptrans && *ptrans ==BIOS_ATA_TRANSLATION_AUTO ) {
hw/block/dataplane/virtio-blk.c +12 -12
@@ -17,7 +17,7 @@#include "qemu/thread.h" #include "qemu/error-report.h" #include "hw/virtio/dataplane/vring.h" -#include "block/block.h" +#include "sysemu/block-backend.h" #include "hw/virtio/virtio-blk.h" #include "virtio-blk.h" #include "block/aio.h"
@@ -94,7 +94,7 @@ static void handle_notify(EventNotifier *e)VirtIOBlock *vblk =VIRTIO_BLK (s->vdev);event_notifier_test_and_clear (&s->host_notifier); -bdrv_io_plug (s->conf->conf.bs); +blk_io_plug (s->conf->conf.blk);for (;;) {MultiReqBuffer mrb = { .num_writes =0 ,
@@ -120,7 +120,7 @@ static void handle_notify(EventNotifier *e)virtio_blk_handle_request (req, &mrb); } -virtio_submit_multiwrite (s->conf->conf.bs, &mrb); +virtio_submit_multiwrite (s->conf->conf.blk, &mrb);if (likely (ret == -EAGAIN )) {/* vring emptied */ /* Re-enable guest->host notifies and stop processing the vring.
@@ -133,7 +133,7 @@ static void handle_notify(EventNotifier *e)break ; } } -bdrv_io_unplug (s->conf->conf.bs); +blk_io_unplug (s->conf->conf.blk); }/* Context: QEMU global mutex held */
@@ -163,8 +163,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,/* If dataplane is (re-)enabled while the guest is running there could be * block jobs that can conflict. */ -if (bdrv_op_is_blocked (conf->conf.bs,BLOCK_OP_TYPE_DATAPLANE , - &local_err)) { +if (blk_op_is_blocked (conf->conf.blk,BLOCK_OP_TYPE_DATAPLANE , + &local_err)) {error_report ("cannot start dataplane thread: %s" ,error_get_pretty (local_err));error_free (local_err);
@@ -193,9 +193,9 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf, s->bh =aio_bh_new (s->ctx, notify_guest_bh, s);error_setg (&s->blocker,"block device is in use by data plane" ); -bdrv_op_block_all (conf->conf.bs, s->blocker); -bdrv_op_unblock (conf->conf.bs,BLOCK_OP_TYPE_RESIZE , s->blocker); -bdrv_op_unblock (conf->conf.bs,BLOCK_OP_TYPE_DRIVE_DEL , s->blocker); +blk_op_block_all (conf->conf.blk, s->blocker); +blk_op_unblock (conf->conf.blk,BLOCK_OP_TYPE_RESIZE , s->blocker); +blk_op_unblock (conf->conf.blk,BLOCK_OP_TYPE_DRIVE_DEL , s->blocker); *dataplane = s; }
@@ -208,7 +208,7 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s) }virtio_blk_data_plane_stop (s); -bdrv_op_unblock_all (s->conf->conf.bs, s->blocker); +blk_op_unblock_all (s->conf->conf.blk, s->blocker);error_free (s->blocker);object_unref (OBJECT (s->iothread));qemu_bh_delete (s->bh);
@@ -263,7 +263,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) s->started = true;trace_virtio_blk_data_plane_start (s); -bdrv_set_aio_context (s->conf->conf.bs, s->ctx); +blk_set_aio_context (s->conf->conf.blk, s->ctx);/* Kick right away to begin processing requests already in vring */ event_notifier_set (virtio_queue_get_host_notifier (vq));
@@ -309,7 +309,7 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)aio_set_event_notifier (s->ctx, &s->host_notifier,NULL );/* Drain and switch bs back to the QEMU main loop */ -bdrv_set_aio_context (s->conf->conf.bs,qemu_get_aio_context ()); +blk_set_aio_context (s->conf->conf.blk,qemu_get_aio_context ());aio_context_release (s->ctx);
hw/block/fdc.c +38 -40
219 lines not on this page · raw message
hw/block/hd-geometry.c +12 -12
@@ -30,7 +30,7 @@* THE SOFTWARE. */ -#include "block/block.h" +#include "sysemu/block-backend.h" #include "hw/block/block.h" #include "trace.h"
@@ -49,7 +49,7 @@ struct partition {/* try to guess the disk logical geometry from the MSDOS partition table. Return 0 if OK, -1 if could not guess */ -static int guess_disk_lchs (BlockDriverState *bs, +static int guess_disk_lchs (BlockBackend *blk,int *pcylinders,int *pheads,int *psectors) {uint8_t buf[BDRV_SECTOR_SIZE ];
@@ -58,14 +58,14 @@ static int guess_disk_lchs(BlockDriverState *bs,uint32_t nr_sects;uint64_t nb_sectors; -bdrv_get_geometry (bs, &nb_sectors); +blk_get_geometry (blk, &nb_sectors);/** * The function will be invoked during startup not only in sync I/O mode, * but also in async I/O mode. So the I/O throttling function has to * be disabled temporarily here, not permanently. */ -if (bdrv_read_unthrottled (bs,0 , buf,1 ) <0 ) { +if (blk_read_unthrottled (blk,0 , buf,1 ) <0 ) {return -1 ; }/* test msdos magic */
@@ -90,20 +90,20 @@ static int guess_disk_lchs(BlockDriverState *bs, *pheads = heads; *psectors = sectors; *pcylinders = cylinders; -trace_hd_geometry_lchs_guess (bs, cylinders, heads, sectors); +trace_hd_geometry_lchs_guess (blk, cylinders, heads, sectors);return 0 ; } }return -1 ; } -static void guess_chs_for_size (BlockDriverState *bs, +static void guess_chs_for_size (BlockBackend *blk,uint32_t *pcyls,uint32_t *pheads,uint32_t *psecs) {uint64_t nb_sectors;int cylinders; -bdrv_get_geometry (bs, &nb_sectors); +blk_get_geometry (blk, &nb_sectors); cylinders = nb_sectors / (16 *63 );if (cylinders >16383 ) {
@@ -116,21 +116,21 @@ static void guess_chs_for_size(BlockDriverState *bs, *psecs =63 ; } -void hd_geometry_guess (BlockDriverState *bs, +void hd_geometry_guess (BlockBackend *blk,uint32_t *pcyls,uint32_t *pheads,uint32_t *psecs,int *ptrans) {int cylinders, heads, secs, translation; -if (guess_disk_lchs (bs, &cylinders, &heads, &secs) <0 ) { +if (guess_disk_lchs (blk, &cylinders, &heads, &secs) <0 ) {/* no LCHS guess: use a standard physical disk geometry */ -guess_chs_for_size (bs, pcyls, pheads, psecs); +guess_chs_for_size (blk, pcyls, pheads, psecs); translation =hd_bios_chs_auto_trans (*pcyls, *pheads, *psecs); }else if (heads >16 ) {/* LCHS guess with heads > 16 means that a BIOS LBA translation was active, so a standard physical disk geometry is OK */ -guess_chs_for_size (bs, pcyls, pheads, psecs); +guess_chs_for_size (blk, pcyls, pheads, psecs); translation = *pcyls * *pheads <=131072 ?BIOS_ATA_TRANSLATION_LARGE :BIOS_ATA_TRANSLATION_LBA ;
@@ -146,7 +146,7 @@ void hd_geometry_guess(BlockDriverState *bs,if (ptrans) { *ptrans = translation; } -trace_hd_geometry_guess (bs, *pcyls, *pheads, *psecs, translation); +trace_hd_geometry_guess (blk, *pcyls, *pheads, *psecs, translation); }int hd_bios_chs_auto_trans (uint32_t cyls,uint32_t heads,uint32_t secs)
hw/block/m25p80.c +14 -14
@@ -246,7 +246,7 @@ typedef struct Flash {uint32_t r; -BlockDriverState *bdrv; +BlockBackend *blk;uint8_t *storage;uint32_t size;
@@ -280,7 +280,7 @@ typedef struct M25P80Class {#define M25P80_GET_CLASS (obj) \ OBJECT_GET_CLASS(M25P80Class, (obj), TYPE_M25P80) -static void bdrv_sync_complete (void *opaque,int ret) +static void blk_sync_complete (void *opaque,int ret) {/* do nothing. Masters do not directly interact with the backing store, * only the working copy so no mutexing required.
@@ -289,20 +289,20 @@ static void bdrv_sync_complete(void *opaque, int ret)static void flash_sync_page (Flash *s,int page) { -int bdrv_sector, nb_sectors; +int blk_sector, nb_sectors;QEMUIOVector iov; -if (!s->bdrv ||bdrv_is_read_only (s->bdrv)) { +if (!s->blk ||blk_is_read_only (s->blk)) {return ; } - bdrv_sector = (page * s->pi->page_size) /BDRV_SECTOR_SIZE ; + blk_sector = (page * s->pi->page_size) /BDRV_SECTOR_SIZE ; nb_sectors =DIV_ROUND_UP (s->pi->page_size,BDRV_SECTOR_SIZE );qemu_iovec_init (&iov,1 ); -qemu_iovec_add (&iov, s->storage + bdrv_sector *BDRV_SECTOR_SIZE , +qemu_iovec_add (&iov, s->storage + blk_sector *BDRV_SECTOR_SIZE , nb_sectors *BDRV_SECTOR_SIZE ); -bdrv_aio_writev (s->bdrv, bdrv_sector, &iov, nb_sectors, bdrv_sync_complete, -NULL ); +blk_aio_writev (s->blk, blk_sector, &iov, nb_sectors, blk_sync_complete, +NULL ); }static inline void flash_sync_area (Flash *s,int64_t off,int64_t len)
@@ -310,7 +310,7 @@ static inline void flash_sync_area(Flash *s, int64_t off, int64_t len)int64_t start, end, nb_sectors;QEMUIOVector iov; -if (!s->bdrv ||bdrv_is_read_only (s->bdrv)) { +if (!s->blk ||blk_is_read_only (s->blk)) {return ; }
@@ -321,7 +321,7 @@ static inline void flash_sync_area(Flash *s, int64_t off, int64_t len)qemu_iovec_init (&iov,1 );qemu_iovec_add (&iov, s->storage + (start *BDRV_SECTOR_SIZE ), nb_sectors *BDRV_SECTOR_SIZE ); -bdrv_aio_writev (s->bdrv, start, &iov, nb_sectors, bdrv_sync_complete,NULL ); +blk_aio_writev (s->blk, start, &iov, nb_sectors, blk_sync_complete,NULL ); }static void flash_erase (Flash *s,int offset,FlashCMD cmd)
@@ -621,17 +621,17 @@ static int m25p80_init(SSISlave *ss) s->size = s->pi->sector_size * s->pi->n_sectors; s->dirty_page =-1 ; - s->storage =qemu_blockalign (s->bdrv, s->size); + s->storage =blk_blockalign (s->blk, s->size); dinfo =drive_get_next (IF_MTD );if (dinfo) {DB_PRINT_L (0 ,"Binding to IF_MTD drive\n" ); - s->bdrv =blk_bs (blk_by_legacy_dinfo (dinfo)); + s->blk =blk_by_legacy_dinfo (dinfo);/* FIXME: Move to late init */ -if (bdrv_read (s->bdrv,0 , s->storage,DIV_ROUND_UP (s->size, -BDRV_SECTOR_SIZE ))) { +if (blk_read (s->blk,0 , s->storage, +DIV_ROUND_UP (s->size,BDRV_SECTOR_SIZE ))) {fprintf (stderr,"Failed to initialize SPI flash!\n" );return 1 ; }
hw/block/nand.c +25 -25
167 lines not on this page · raw message
hw/block/nvme.c +9 -8
@@ -24,6 +24,7 @@#include <hw/hw.h> #include <hw/pci/msix.h> #include <hw/pci/pci.h> +#include "sysemu/block-backend.h" #include "nvme.h"
@@ -197,7 +198,7 @@ static void nvme_rw_cb(void *opaque, int ret)NvmeCtrl *n = sq->ctrl;NvmeCQueue *cq = n->cq[sq->cqid]; -bdrv_acct_done (n->conf.bs, &req->acct); +blk_acct_done (n->conf.blk, &req->acct);if (!ret) { req->status =NVME_SUCCESS ; }else {
@@ -231,11 +232,11 @@ static uint16_t nvme_rw(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, }assert ((nlb << data_shift) == req->qsg.size); -dma_acct_start (n->conf.bs, &req->acct, &req->qsg, is_write ? +dma_acct_start (n->conf.blk, &req->acct, &req->qsg, is_write ?BDRV_ACCT_WRITE :BDRV_ACCT_READ ); req->aiocb = is_write ? -dma_bdrv_write (n->conf.bs, &req->qsg, aio_slba, nvme_rw_cb, req) : -dma_bdrv_read (n->conf.bs, &req->qsg, aio_slba, nvme_rw_cb, req); +dma_blk_write (n->conf.blk, &req->qsg, aio_slba, nvme_rw_cb, req) : +dma_blk_read (n->conf.blk, &req->qsg, aio_slba, nvme_rw_cb, req);return NVME_NO_COMPLETE ; }
@@ -288,7 +289,7 @@ static uint16_t nvme_del_sq(NvmeCtrl *n, NvmeCmd *cmd)while (!QTAILQ_EMPTY (&sq->out_req_list)) { req =QTAILQ_FIRST (&sq->out_req_list);assert (req->aiocb); -bdrv_aio_cancel (req->aiocb); +blk_aio_cancel (req->aiocb); }if (!nvme_check_cqid (n, sq->cqid)) { cq = n->cq[sq->cqid];
@@ -563,7 +564,7 @@ static void nvme_clear_ctrl(NvmeCtrl *n) } } -bdrv_flush (n->conf.bs); +blk_flush (n->conf.blk); n->bar.cc =0 ; }
@@ -748,11 +749,11 @@ static int nvme_init(PCIDevice *pci_dev)int64_t bs_size;uint8_t *pci_conf; -if (!(n->conf.bs)) { +if (!n->conf.blk) {return -1 ; } - bs_size =bdrv_getlength (n->conf.bs); + bs_size =blk_getlength (n->conf.blk);if (bs_size <0 ) {return -1 ; }
hw/block/onenand.c +35 -32
172 lines not on this page · raw message
hw/block/pflash_cfi01.c +12 -12
@@ -38,7 +38,7 @@#include "hw/hw.h" #include "hw/block/flash.h" -#include "block/block.h" +#include "sysemu/block-backend.h" #include "qemu/timer.h" #include "qemu/bitops.h" #include "exec/address-spaces.h"
@@ -69,7 +69,7 @@ struct pflash_t {SysBusDevice parent_obj;/*< public >*/ -BlockDriverState *bs; +BlockBackend *blk;uint32_t nb_blocs;uint64_t sector_len;uint8_t bank_width;
@@ -395,13 +395,13 @@ static void pflash_update(pflash_t *pfl, int offset, int size) {int offset_end; -if (pfl->bs) { +if (pfl->blk) { offset_end = offset + size;/* round to sectors */ offset = offset >>9 ; offset_end = (offset_end +511 ) >>9 ; -bdrv_write (pfl->bs, offset, pfl->storage + (offset <<9 ), - offset_end - offset); +blk_write (pfl->blk, offset, pfl->storage + (offset <<9 ), + offset_end - offset); } }
@@ -778,9 +778,9 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp) pfl->storage =memory_region_get_ram_ptr (&pfl->mem);sysbus_init_mmio (SYS_BUS_DEVICE (dev), &pfl->mem); -if (pfl->bs) { +if (pfl->blk) {/* read the initial flash content */ - ret =bdrv_read (pfl->bs,0 , pfl->storage, total_len >>9 ); + ret =blk_read (pfl->blk,0 , pfl->storage, total_len >>9 );if (ret <0 ) {vmstate_unregister_ram (&pfl->mem,DEVICE (pfl));
@@ -789,8 +789,8 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp) } } -if (pfl->bs) { - pfl->ro =bdrv_is_read_only (pfl->bs); +if (pfl->blk) { + pfl->ro =blk_is_read_only (pfl->blk); }else { pfl->ro =0 ; }
@@ -892,7 +892,7 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp) }static Property pflash_cfi01_properties[] = { - DEFINE_PROP_DRIVE("drive", struct pflash_t, bs), + DEFINE_PROP_DRIVE("drive", struct pflash_t, blk),/* num-blocks is the number of blocks actually visible to the guest, * ie the total size of the device divided by the sector length. * If we're emulating flash devices wired in parallel the actual
@@ -956,14 +956,14 @@ type_init(pflash_cfi01_register_types)pflash_t *pflash_cfi01_register (hwaddr base,DeviceState *qdev,const char *name,hwaddr size, -BlockDriverState *bs, +BlockBackend *blk,uint32_t sector_len,int nb_blocs,int bank_width,uint16_t id0,uint16_t id1,uint16_t id2,uint16_t id3,int be) {DeviceState *dev =qdev_create (NULL ,TYPE_CFI_PFLASH01 ); -if (bs &&qdev_prop_set_drive (dev,"drive" , bs)) { +if (blk &&qdev_prop_set_drive (dev,"drive" , blk)) {abort (); }qdev_prop_set_uint32 (dev,"num-blocks" , nb_blocs);
hw/block/pflash_cfi02.c +12 -12
@@ -38,7 +38,7 @@#include "hw/hw.h" #include "hw/block/flash.h" #include "qemu/timer.h" -#include "block/block.h" +#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "qemu/host-utils.h" #include "hw/sysbus.h"
@@ -63,7 +63,7 @@ struct pflash_t {SysBusDevice parent_obj;/*< public >*/ -BlockDriverState *bs; +BlockBackend *blk;uint32_t sector_len;uint32_t nb_blocs;uint32_t chip_len;
@@ -249,13 +249,13 @@ static void pflash_update(pflash_t *pfl, int offset, int size) {int offset_end; -if (pfl->bs) { +if (pfl->blk) { offset_end = offset + size;/* round to sectors */ offset = offset >>9 ; offset_end = (offset_end +511 ) >>9 ; -bdrv_write (pfl->bs, offset, pfl->storage + (offset <<9 ), - offset_end - offset); +blk_write (pfl->blk, offset, pfl->storage + (offset <<9 ), + offset_end - offset); } }
@@ -612,9 +612,9 @@ static void pflash_cfi02_realize(DeviceState *dev, Error **errp)vmstate_register_ram (&pfl->orig_mem,DEVICE (pfl)); pfl->storage =memory_region_get_ram_ptr (&pfl->orig_mem); pfl->chip_len = chip_len; -if (pfl->bs) { +if (pfl->blk) {/* read the initial flash content */ - ret =bdrv_read (pfl->bs,0 , pfl->storage, chip_len >>9 ); + ret =blk_read (pfl->blk,0 , pfl->storage, chip_len >>9 );if (ret <0 ) {vmstate_unregister_ram (&pfl->orig_mem,DEVICE (pfl));error_setg (errp,"failed to read the initial flash content" );
@@ -626,8 +626,8 @@ static void pflash_cfi02_realize(DeviceState *dev, Error **errp) pfl->rom_mode =1 ;sysbus_init_mmio (SYS_BUS_DEVICE (dev), &pfl->mem); -if (pfl->bs) { - pfl->ro =bdrv_is_read_only (pfl->bs); +if (pfl->blk) { + pfl->ro =blk_is_read_only (pfl->blk); }else { pfl->ro =0 ; }
@@ -716,7 +716,7 @@ static void pflash_cfi02_realize(DeviceState *dev, Error **errp) }static Property pflash_cfi02_properties[] = { - DEFINE_PROP_DRIVE("drive", struct pflash_t, bs), + DEFINE_PROP_DRIVE("drive", struct pflash_t, blk), DEFINE_PROP_UINT32("num-blocks", struct pflash_t, nb_blocs, 0), DEFINE_PROP_UINT32("sector-length", struct pflash_t, sector_len, 0), DEFINE_PROP_UINT8("width", struct pflash_t, width, 0),
@@ -757,7 +757,7 @@ type_init(pflash_cfi02_register_types) pflash_t *pflash_cfi02_register(hwaddr base, DeviceState *qdev, const char *name, hwaddr size, - BlockDriverState *bs, uint32_t sector_len, + BlockBackend *blk, uint32_t sector_len, int nb_blocs, int nb_mappings, int width, uint16_t id0, uint16_t id1, uint16_t id2, uint16_t id3,
@@ -766,7 +766,7 @@ pflash_t *pflash_cfi02_register(hwaddr base, {DeviceState *dev =qdev_create (NULL ,TYPE_CFI_PFLASH02 ); -if (bs &&qdev_prop_set_drive (dev,"drive" , bs)) { +if (blk &&qdev_prop_set_drive (dev,"drive" , blk)) {abort (); }qdev_prop_set_uint32 (dev,"num-blocks" , nb_blocs);
hw/block/virtio-blk.c +49 -46
279 lines not on this page · raw message
hw/block/xen_disk.c +42 -41
162 lines not on this page · raw message
hw/core/qdev-properties-system.c +13 -13
@@ -13,6 +13,7 @@#include "net/net.h" #include "hw/qdev.h" #include "qapi/qmp/qerror.h" +#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/block/block.h" #include "net/hub.h"
@@ -68,16 +69,16 @@ static void set_pointer(Object *obj, Visitor *v, Property *prop,static int parse_drive (DeviceState *dev,const char *str,void **ptr) { -BlockDriverState *bs; +BlockBackend *blk; - bs =bdrv_find (str); -if (bs ==NULL ) { + blk =blk_by_name (str); +if (!blk) {return -ENOENT ; } -if (bdrv_attach_dev (bs, dev) <0 ) { +if (blk_attach_dev (blk, dev) <0 ) {return -EEXIST ; } - *ptr = bs; + *ptr = blk;return 0 ; }
@@ -85,17 +86,17 @@ static void release_drive(Object *obj, const char *name, void *opaque) {DeviceState *dev =DEVICE (obj);Property *prop = opaque; -BlockDriverState **ptr =qdev_get_prop_ptr (dev, prop); +BlockBackend **ptr =qdev_get_prop_ptr (dev, prop);if (*ptr) { -bdrv_detach_dev (*ptr, dev); +blk_detach_dev (*ptr, dev);blockdev_auto_del (*ptr); } }static char *print_drive (void *ptr) { -return g_strdup (bdrv_get_device_name (ptr)); +return g_strdup (blk_name (ptr)); } static void get_drive(Object *obj, Visitor *v, void *opaque,
@@ -335,12 +336,11 @@ PropertyInfo qdev_prop_vlan = { };int qdev_prop_set_drive (DeviceState *dev,const char *name, -BlockDriverState *value) +BlockBackend *value) {Error *err =NULL ; -const char *bdrv_name = value ?bdrv_get_device_name (value) :"" ; -object_property_set_str (OBJECT (dev), bdrv_name, - name, &err); +object_property_set_str (OBJECT (dev), + value ?blk_name (value) :"" , name, &err);if (err) {qerror_report_err (err);error_free (err);
@@ -350,7 +350,7 @@ int qdev_prop_set_drive(DeviceState *dev, const char *name, }void qdev_prop_set_drive_nofail (DeviceState *dev,const char *name, -BlockDriverState *value) +BlockBackend *value) {if (qdev_prop_set_drive (dev, name, value) <0 ) {exit (1 );
hw/core/qdev-properties.c +1 -1
@@ -1,7 +1,7 @@#include "net/net.h" #include "hw/qdev.h" #include "qapi/qmp/qerror.h" -#include "sysemu/blockdev.h" +#include "sysemu/block-backend.h" #include "hw/block/block.h" #include "net/hub.h" #include "qapi/visitor.h"
hw/cris/axis_dev88.c +1 -2
@@ -31,7 +31,6 @@#include "elf.h" #include "boot.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h"
@@ -283,7 +282,7 @@ void axisdev88_init(MachineState *machine)/* Attach a NAND flash to CS1. */ nand =drive_get (IF_MTD ,0 ,0 ); - nand_state.nand =nand_init (nand ?blk_bs (blk_by_legacy_dinfo (nand)) :NULL , + nand_state.nand =nand_init (nand ?blk_by_legacy_dinfo (nand) :NULL ,NAND_MFR_STMICRO ,0x39 );memory_region_init_io (&nand_state.iomem,NULL , &nand_ops, &nand_state,"nand" ,0x05000000 );
hw/display/tc6393xb.c +1 -1
@@ -577,7 +577,7 @@ TC6393xbState *tc6393xb_init(MemoryRegion *sysmem, uint32_t base, qemu_irq irq) s->sub_irqs =qemu_allocate_irqs (tc6393xb_sub_irq, s,TC6393XB_NR_IRQS ); nand =drive_get (IF_MTD ,0 ,0 ); - s->flash =nand_init (nand ?blk_bs (blk_by_legacy_dinfo (nand)) :NULL , + s->flash =nand_init (nand ?blk_by_legacy_dinfo (nand) :NULL ,NAND_MFR_TOSHIBA ,0x76 );memory_region_init_io (&s->iomem,NULL , &tc6393xb_ops, s,"tc6393xb" ,0x10000 );
hw/i386/pc.c +1 -1
@@ -44,7 +44,7 @@#include "sysemu/kvm.h" #include "kvm_i386.h" #include "hw/xen/xen.h" -#include "sysemu/blockdev.h" +#include "sysemu/block-backend.h" #include "hw/block/block.h" #include "ui/qemu-spice.h" #include "exec/memory.h"
hw/i386/pc_piix.c +1 -1
@@ -41,7 +41,7 @@#include "hw/sysbus.h" #include "hw/cpu/icc_bus.h" #include "sysemu/arch_init.h" -#include "sysemu/blockdev.h" +#include "sysemu/block-backend.h" #include "hw/i2c/smbus.h" #include "hw/xen/xen.h" #include "exec/memory.h"
hw/i386/pc_sysfw.c +4 -5
@@ -24,7 +24,6 @@*/ #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "qemu/error-report.h" #include "hw/sysbus.h" #include "hw/hw.h"
@@ -103,7 +102,7 @@ static void pc_system_flash_init(MemoryRegion *rom_memory) {int unit;DriveInfo *pflash_drv; -BlockDriverState *bdrv; +BlockBackend *blk;int64_t size;char *fatal_errmsg =NULL ;hwaddr phys_addr =0x100000000ULL ;
@@ -119,8 +118,8 @@ static void pc_system_flash_init(MemoryRegion *rom_memory) (unit <FLASH_MAP_UNIT_MAX && (pflash_drv =drive_get (IF_PFLASH ,0 , unit)) !=NULL ); ++unit) { - bdrv =blk_bs (blk_by_legacy_dinfo (pflash_drv)); - size =bdrv_getlength (bdrv); + blk =blk_by_legacy_dinfo (pflash_drv); + size =blk_getlength (blk);if (size <0 ) { fatal_errmsg =g_strdup_printf ("failed to get backing file size" ); }else if (size ==0 ) {
@@ -156,7 +155,7 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)/* pflash_cfi01_register() creates a deep copy of the name */ snprintf (name,sizeof name,"system.flash%d" , unit); system_flash = pflash_cfi01_register(phys_addr, NULL /* qdev */, name, - size, bdrv, sector_size, + size, blk, sector_size, size >> sector_bits, 1 /* width */, 0x0000 /* id0 */,
hw/i386/xen/xen_platform.c +3 -2
@@ -34,6 +34,7 @@#include "hw/xen/xen_backend.h" #include "trace.h" #include "exec/address-spaces.h" +#include "sysemu/block-backend.h" #include <xenguest.h>
@@ -132,8 +133,8 @@ static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t vdevices, and bit 2 the non-primary-master IDE devices. */ if (val &UNPLUG_ALL_IDE_DISKS ) {DPRINTF ("unplug disks\n" ); -bdrv_drain_all (); -bdrv_flush_all (); +blk_drain_all (); +blk_flush_all ();pci_unplug_disks (pci_dev->bus); }if (val &UNPLUG_ALL_NICS ) {
hw/ide/ahci.c +16 -15
@@ -28,6 +28,7 @@#include <hw/sysbus.h> #include "monitor/monitor.h" +#include "sysemu/block-backend.h" #include "sysemu/dma.h" #include "internal.h" #include <hw/ide/pci.h>
@@ -85,7 +86,7 @@ static uint32_t ahci_port_read(AHCIState *s, int port, int offset) val = pr->sig;break ;case PORT_SCR_STAT : -if (s->dev[port].port.ifs[0 ].bs) { +if (s->dev[port].port.ifs[0 ].blk) { val =SATA_SCR_SSTATUS_DET_DEV_PRESENT_PHY_UP |SATA_SCR_SSTATUS_SPD_GEN1 |SATA_SCR_SSTATUS_IPM_ACTIVE ; }else {
@@ -501,7 +502,7 @@ static void ahci_reset_port(AHCIState *s, int port) d->init_d2h_sent = false; ide_state = &s->dev[port].port.ifs[0 ]; -if (!ide_state->bs) { +if (!ide_state->blk) {return ; }
@@ -513,11 +514,11 @@ static void ahci_reset_port(AHCIState *s, int port) }if (ncq_tfs->aiocb) { -bdrv_aio_cancel (ncq_tfs->aiocb); +blk_aio_cancel (ncq_tfs->aiocb); ncq_tfs->aiocb =NULL ; } -/* Maybe we just finished the request thanks to bdrv_aio_cancel() */ +/* Maybe we just finished the request thanks to blk_aio_cancel() */ if (!ncq_tfs->used) {continue ; }
@@ -527,7 +528,7 @@ static void ahci_reset_port(AHCIState *s, int port) } s->dev[port].port_state =STATE_RUN ; -if (!ide_state->bs) { +if (!ide_state->blk) { s->dev[port].port_regs.sig =0 ; ide_state->status =SEEK_STAT |WRERR_STAT ; }else if (ide_state->drive_kind ==IDE_CD ) {
@@ -809,7 +810,7 @@ static void ncq_cb(void *opaque, int ret)DPRINTF (ncq_tfs->drive->port_no,"NCQ transfer tag %d finished\n" , ncq_tfs->tag); -bdrv_acct_done (ncq_tfs->drive->port.ifs[0 ].bs, &ncq_tfs->acct); +blk_acct_done (ncq_tfs->drive->port.ifs[0 ].blk, &ncq_tfs->acct);qemu_sglist_destroy (&ncq_tfs->sglist); ncq_tfs->used =0 ; }
@@ -859,11 +860,11 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,DPRINTF (port,"tag %d aio read %" PRId64"\n" , ncq_tfs->tag, ncq_tfs->lba); -dma_acct_start (ncq_tfs->drive->port.ifs[0 ].bs, &ncq_tfs->acct, +dma_acct_start (ncq_tfs->drive->port.ifs[0 ].blk, &ncq_tfs->acct, &ncq_tfs->sglist,BDRV_ACCT_READ ); - ncq_tfs->aiocb =dma_bdrv_read (ncq_tfs->drive->port.ifs[0 ].bs, - &ncq_tfs->sglist, ncq_tfs->lba, - ncq_cb, ncq_tfs); + ncq_tfs->aiocb =dma_blk_read (ncq_tfs->drive->port.ifs[0 ].blk, + &ncq_tfs->sglist, ncq_tfs->lba, + ncq_cb, ncq_tfs);break ;case WRITE_FPDMA_QUEUED : DPRINTF(port, "NCQ writing %d sectors to LBA %"PRId64", tag %d\n",
@@ -872,11 +873,11 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,DPRINTF (port,"tag %d aio write %" PRId64"\n" , ncq_tfs->tag, ncq_tfs->lba); -dma_acct_start (ncq_tfs->drive->port.ifs[0 ].bs, &ncq_tfs->acct, +dma_acct_start (ncq_tfs->drive->port.ifs[0 ].blk, &ncq_tfs->acct, &ncq_tfs->sglist,BDRV_ACCT_WRITE ); - ncq_tfs->aiocb =dma_bdrv_write (ncq_tfs->drive->port.ifs[0 ].bs, - &ncq_tfs->sglist, ncq_tfs->lba, - ncq_cb, ncq_tfs); + ncq_tfs->aiocb =dma_blk_write (ncq_tfs->drive->port.ifs[0 ].blk, + &ncq_tfs->sglist, ncq_tfs->lba, + ncq_cb, ncq_tfs);break ;default :DPRINTF (port,"error: tried to process non-NCQ command as NCQ\n" );
@@ -925,7 +926,7 @@ static int handle_cmd(AHCIState *s, int port, int slot)/* The device we are working for */ ide_state = &s->dev[port].port.ifs[0 ]; -if (!ide_state->bs) { +if (!ide_state->blk) {DPRINTF (port,"error: guest accessed unused port" ); goto out; }
hw/ide/atapi.c +17 -16
@@ -25,6 +25,7 @@#include "hw/ide/internal.h" #include "hw/scsi/scsi.h" +#include "sysemu/block-backend.h" static void ide_atapi_cmd_read_dma_cb (void *opaque,int ret);
@@ -110,14 +111,14 @@ static int cd_read_sector(IDEState *s, int lba, uint8_t *buf, int sector_size)switch (sector_size) {case 2048 : -bdrv_acct_start (s->bs, &s->acct,4 *BDRV_SECTOR_SIZE ,BDRV_ACCT_READ ); - ret =bdrv_read (s->bs, (int64_t )lba <<2 , buf,4 ); -bdrv_acct_done (s->bs, &s->acct); +blk_acct_start (s->blk, &s->acct,4 *BDRV_SECTOR_SIZE ,BDRV_ACCT_READ ); + ret =blk_read (s->blk, (int64_t )lba <<2 , buf,4 ); +blk_acct_done (s->blk, &s->acct);break ;case 2352 : -bdrv_acct_start (s->bs, &s->acct,4 *BDRV_SECTOR_SIZE ,BDRV_ACCT_READ ); - ret =bdrv_read (s->bs, (int64_t )lba <<2 , buf +16 ,4 ); -bdrv_acct_done (s->bs, &s->acct); +blk_acct_start (s->blk, &s->acct,4 *BDRV_SECTOR_SIZE ,BDRV_ACCT_READ ); + ret =blk_read (s->blk, (int64_t )lba <<2 , buf +16 ,4 ); +blk_acct_done (s->blk, &s->acct);if (ret <0 )return ret;cd_data_to_raw (buf, lba);
@@ -253,7 +254,7 @@ static void ide_atapi_cmd_reply(IDEState *s, int size, int max_size) s->io_buffer_index =0 ;if (s->atapi_dma) { -bdrv_acct_start (s->bs, &s->acct, size,BDRV_ACCT_READ ); +blk_acct_start (s->blk, &s->acct, size,BDRV_ACCT_READ ); s->status =READY_STAT |SEEK_STAT |DRQ_STAT ;ide_start_dma (s, ide_atapi_cmd_read_dma_cb); }else {
@@ -348,13 +349,13 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret) s->bus->dma->iov.iov_len = n *4 *512 ;qemu_iovec_init_external (&s->bus->dma->qiov, &s->bus->dma->iov,1 ); - s->bus->dma->aiocb =bdrv_aio_readv (s->bs, (int64_t )s->lba <<2 , + s->bus->dma->aiocb =blk_aio_readv (s->blk, (int64_t )s->lba <<2 , &s->bus->dma->qiov, n *4 , ide_atapi_cmd_read_dma_cb, s);return ; eot: -bdrv_acct_done (s->bs, &s->acct); +blk_acct_done (s->blk, &s->acct);ide_set_inactive (s, false); }
@@ -369,7 +370,7 @@ static void ide_atapi_cmd_read_dma(IDEState *s, int lba, int nb_sectors, s->io_buffer_size =0 ; s->cd_sector_size = sector_size; -bdrv_acct_start (s->bs, &s->acct, s->packet_transfer_size,BDRV_ACCT_READ ); +blk_acct_start (s->blk, &s->acct, s->packet_transfer_size,BDRV_ACCT_READ );/* XXX: check if BUSY_STAT should be set */ s->status =READY_STAT |SEEK_STAT |DRQ_STAT |BUSY_STAT ;
@@ -501,7 +502,7 @@ static unsigned int event_status_media(IDEState *s, media_status =0 ;if (s->tray_open) { media_status =MS_TRAY_OPEN ; - }else if (bdrv_is_inserted (s->bs)) { + }else if (blk_is_inserted (s->blk)) { media_status =MS_MEDIA_PRESENT ; }
@@ -797,7 +798,7 @@ static void cmd_test_unit_ready(IDEState *s, uint8_t *buf)static void cmd_prevent_allow_medium_removal (IDEState *s,uint8_t * buf) { s->tray_locked = buf[4 ] &1 ; -bdrv_lock_medium (s->bs, buf[4 ] &1 ); +blk_lock_medium (s->blk, buf[4 ] &1 );ide_atapi_cmd_ok (s); }
@@ -881,14 +882,14 @@ static void cmd_start_stop_unit(IDEState *s, uint8_t* buf)if (loej) {if (!start && !s->tray_open && s->tray_locked) { - sense =bdrv_is_inserted (s->bs) + sense =blk_is_inserted (s->blk) ?NOT_READY :ILLEGAL_REQUEST ;ide_atapi_cmd_error (s, sense,ASC_MEDIA_REMOVAL_PREVENTED );return ; }if (s->tray_open != !start) { -bdrv_eject (s->bs, !start); +blk_eject (s->blk, !start); s->tray_open = !start; } }
@@ -1122,7 +1123,7 @@ void ide_atapi_cmd(IDEState *s)* states rely on this behavior. */ if (!(atapi_cmd_table[s->io_buffer[0 ]].flags &ALLOW_UA ) && - !s->tray_open &&bdrv_is_inserted (s->bs) && s->cdrom_changed) { + !s->tray_open &&blk_is_inserted (s->blk) && s->cdrom_changed) {if (s->cdrom_changed ==1 ) {ide_atapi_cmd_error (s,NOT_READY ,ASC_MEDIUM_NOT_PRESENT );
@@ -1137,7 +1138,7 @@ void ide_atapi_cmd(IDEState *s)/* Report a Not Ready condition if appropriate for the command */ if ((atapi_cmd_table[s->io_buffer[0 ]].flags &CHECK_READY ) && - (!media_present (s) || !bdrv_is_inserted (s->bs))) + (!media_present (s) || !blk_is_inserted (s->blk))) {ide_atapi_cmd_error (s,NOT_READY ,ASC_MEDIUM_NOT_PRESENT );return ;
hw/ide/cmd646.c +1 -1
@@ -26,7 +26,7 @@#include <hw/i386/pc.h> #include <hw/pci/pci.h> #include <hw/isa/isa.h> -#include "block/block.h" +#include "sysemu/block-backend.h" #include "sysemu/sysemu.h" #include "sysemu/dma.h"
hw/ide/core.c +100 -90
381 lines not on this page · raw message
hw/ide/macio.c +26 -26
52 lines not on this page · raw message
hw/microblaze/petalogix_s3adsp1800_mmu.c +1 -2
Lines of this file are not shown. View the raw message.
hw/scsi/scsi-disk.c +99 -93
192 lines not on this page · raw message
hw/sd/sd.c +30 -30
60 lines not on this page · raw message
include/sysemu/block-backend.h +78 -0
78 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.9.3
Part of the diff is not shown here. View the raw message.
PATCH 15/23 ide: Complete conversion from BlockDriverState to BlockBackend
In reply to Markus ArmbrusterAdd a BlockBackend member to TrimAIOCB, so ide_issue_trim_cb() can use blk_aio_discard() instead of bdrv_aio_discard().
--- hw/ide/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/ide/core.c +4 -2
@@ -362,6 +362,7 @@ static void ide_set_signature(IDEState *s) typedef struct TrimAIOCB { BlockAIOCB common; + BlockBackend *blk; QEMUBH *bh; int ret; QEMUIOVector *qiov;
@@ -423,8 +424,8 @@ static void ide_issue_trim_cb(void *opaque, int ret) }/* Got an entry! Submit and exit. */ - iocb->aiocb =bdrv_aio_discard (iocb->common.bs, sector, count, - ide_issue_trim_cb, opaque); + iocb->aiocb =blk_aio_discard (iocb->blk, sector, count, + ide_issue_trim_cb, opaque);return ; }
@@ -448,6 +449,7 @@ BlockAIOCB *ide_issue_trim(BlockBackend *blk,TrimAIOCB *iocb; iocb =blk_aio_get (&trim_aiocb_info, blk, cb, opaque); + iocb->blk = blk; iocb->bh =qemu_bh_new (ide_trim_bh_cb, iocb); iocb->ret =0 ; iocb->qiov = qiov;
Signature · 1 line
1.9.3
PATCH 16/23 pc87312: Drop unused members of PC87312State
In reply to Markus Armbruster--- include/hw/isa/pc87312.h | 3 --- 1 file changed, 3 deletions(-)
include/hw/isa/pc87312.h +0 -3
@@ -47,13 +47,10 @@ typedef struct PC87312State {struct {ISADevice *dev; -BlockDriverState *drive[2 ]; -uint32_t base; } fdc;struct {ISADevice *dev; -uint32_t base; } ide;MemoryRegion io;
Signature · 1 line
1.9.3
PATCH 17/23 blockdev: Drop superfluous DriveInfo member id
In reply to Markus Armbruster--- block/block-backend.c | 1 - blockdev.c | 3 +-- include/sysemu/blockdev.h | 1 - 3 files changed, 1 insertion(+), 4 deletions(-)
block/block-backend.c +0 -1
@@ -123,7 +123,6 @@ static void drive_info_del(DriveInfo *dinfo) {if (dinfo) {qemu_opts_del (dinfo->opts); -g_free (dinfo->id);g_free (dinfo->serial);g_free (dinfo); }
blockdev.c +1 -2
@@ -458,7 +458,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, } dinfo =g_malloc0 (sizeof (*dinfo)); - dinfo->id =g_strdup (qemu_opts_id (opts));blk_set_legacy_dinfo (blk, dinfo);if (!file || !*file) {
@@ -492,7 +491,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,if (ret <0 ) {error_setg (errp,"could not open disk image %s: %s" , - file ?: dinfo->id,error_get_pretty (error)); + file ?:blk_name (blk),error_get_pretty (error));error_free (error); goto err; }
include/sysemu/blockdev.h +0 -1
@@ -30,7 +30,6 @@ typedef enum { } BlockInterfaceType;struct DriveInfo { -char *id;const char *devaddr;BlockInterfaceType type;int bus;
Signature · 1 line
1.9.3
PATCH 18/23 blockdev: Fix blockdev-add not to create IDE drive (0, 0)
In reply to Markus Armbrusterblockdev_init() always creates a DriveInfo, but only drive_new() fills it in. qmp_blockdev_add() leaves it blank. This results in a drive with type = IF_IDE, bus = 0, unit = 0. Screwed up in commit ee13ed1c.
Board initialization code looking for IDE drive (0,0) can pick up one of these bogus drives. Not sure whether getting the QMP command executed early enough is likely in practice, though.
Fix by creating DriveInfo in drive_new(). Block backends created by blockdev-add don't get one.
A few places assume a block backend always has a DriveInfo. Fix them up.
--- blockdev.c | 10 ++-------- hw/block/block.c | 16 ++++++++++------ hw/ide/qdev.c | 2 +- hw/scsi/scsi-disk.c | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-)
blockdev.c +2 -8
@@ -285,7 +285,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,int on_read_error, on_write_error;BlockBackend *blk;BlockDriverState *bs; -DriveInfo *dinfo;ThrottleConfig cfg;int snapshot =0 ;bool copy_on_read;
@@ -457,9 +456,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,bdrv_set_io_limits (bs, &cfg); } - dinfo =g_malloc0 (sizeof (*dinfo)); -blk_set_legacy_dinfo (blk, dinfo); -if (!file || !*file) {if (has_driver_specific_opts) { file =NULL ;
@@ -902,21 +898,19 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) }/* Set legacy DriveInfo fields */ - dinfo =blk_legacy_dinfo (blk); + dinfo =g_malloc0 (sizeof (*dinfo)); dinfo->enable_auto_del = true; dinfo->opts = all_opts; - dinfo->cyls = cyls; dinfo->heads = heads; dinfo->secs = secs; dinfo->trans = translation; - dinfo->type = type; dinfo->bus = bus_id; dinfo->unit = unit_id; dinfo->devaddr = devaddr; - dinfo->serial =g_strdup (serial); +blk_set_legacy_dinfo (blk, dinfo);switch (type) {case IF_IDE :
hw/block/block.c +10 -6
@@ -19,7 +19,9 @@ void blkconf_serial(BlockConf *conf, char **serial)if (!*serial) {/* try to fall back to value set with legacy -drive serial=... */ dinfo =blk_legacy_dinfo (conf->blk); - *serial =g_strdup (dinfo->serial); +if (dinfo) { + *serial =g_strdup (dinfo->serial); + } } }
@@ -32,11 +34,13 @@ void blkconf_geometry(BlockConf *conf, int *ptrans,if (!conf->cyls && !conf->heads && !conf->secs) {/* try to fall back to value set with legacy -drive cyls=... */ dinfo =blk_legacy_dinfo (conf->blk); - conf->cyls = dinfo->cyls; - conf->heads = dinfo->heads; - conf->secs = dinfo->secs; -if (ptrans) { - *ptrans = dinfo->trans; +if (dinfo) { + conf->cyls = dinfo->cyls; + conf->heads = dinfo->heads; + conf->secs = dinfo->secs; +if (ptrans) { + *ptrans = dinfo->trans; + } } }if (!conf->cyls && !conf->heads && !conf->secs) {
hw/ide/qdev.c +1 -1
@@ -206,7 +206,7 @@ static int ide_drive_initfn(IDEDevice *dev) {DriveInfo *dinfo =blk_legacy_dinfo (dev->conf.blk); -return ide_dev_initfn (dev, dinfo->media_cd ?IDE_CD :IDE_HD ); +return ide_dev_initfn (dev, dinfo && dinfo->media_cd ?IDE_CD :IDE_HD ); }#define DEFINE_IDE_DEV_PROPERTIES () \
hw/scsi/scsi-disk.c +1 -1
@@ -2331,7 +2331,7 @@ static void scsi_disk_realize(SCSIDevice *dev, Error **errp) } dinfo =blk_legacy_dinfo (dev->conf.blk); -if (dinfo->media_cd) { +if (dinfo && dinfo->media_cd) {scsi_cd_realize (dev, errp); }else {scsi_hd_realize (dev, errp);
Signature · 1 line
1.9.3
PATCH 19/23 blockdev: Drop DriveInfo member enable_auto_del
In reply to Markus ArmbrusterCommit 2d246f0 introduced DriveInfo member enable_auto_del to distinguish DriveInfo created via drive_new() from DriveInfo created via qmp_blockdev_add(). The latter no longer exist. Drop enable_auto_del.
--- blockdev.c | 7 ++----- include/sysemu/blockdev.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-)
blockdev.c +2 -5
@@ -90,16 +90,14 @@ void blockdev_mark_auto_del(BlockBackend *blk)DriveInfo *dinfo =blk_legacy_dinfo (blk);BlockDriverState *bs =blk_bs (blk); -if (dinfo && !dinfo->enable_auto_del) { +if (!dinfo) {return ; }if (bs->job) {block_job_cancel (bs->job); } -if (dinfo) { - dinfo->auto_del =1 ; - } + dinfo->auto_del =1 ; }void blockdev_auto_del (BlockBackend *blk)
@@ -899,7 +897,6 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)/* Set legacy DriveInfo fields */ dinfo =g_malloc0 (sizeof (*dinfo)); - dinfo->enable_auto_del = true; dinfo->opts = all_opts; dinfo->cyls = cyls; dinfo->heads = heads;
include/sysemu/blockdev.h +0 -1
@@ -35,7 +35,6 @@ struct DriveInfo {int bus;int unit;int auto_del;/* see blockdev_mark_auto_del() */ -bool enable_auto_del;/* Only for legacy drive_new() */ int media_cd;int cyls, heads, secs, trans;QemuOpts *opts;
Signature · 1 line
1.9.3
PATCH 20/23 block/qapi: Convert qmp_query_block() to BlockBackend
In reply to Markus ArmbrusterMuch more command code needs conversion. I start with this one because it's using bdrv_dev_* functions, which I'm about to lift into BlockBackend.
While there, give bdrv_query_info() internal linkage.
--- block/qapi.c | 15 ++++++++------- include/block/qapi.h | 3 --- 2 files changed, 8 insertions(+), 10 deletions(-)
block/qapi.c +8 -7
@@ -28,6 +28,7 @@#include "qapi-visit.h" #include "qapi/qmp-output-visitor.h" #include "qapi/qmp/types.h" +#include "sysemu/block-backend.h" #ifdef __linux__#include <linux/fs.h> #include <sys/ioctl.h>
@@ -264,15 +265,15 @@ void bdrv_query_image_info(BlockDriverState *bs, }/* @p_info will be set only on success. */ -void bdrv_query_info (BlockDriverState *bs, -BlockInfo **p_info, -Error **errp) +static void bdrv_query_info (BlockBackend *blk,BlockInfo **p_info, +Error **errp) {BlockInfo *info =g_malloc0 (sizeof (*info)); +BlockDriverState *bs =blk_bs (blk);BlockDriverState *bs0;ImageInfo **p_image_info;Error *local_err =NULL ; - info->device =g_strdup (bdrv_get_device_name (bs)); + info->device =g_strdup (blk_name (blk)); info->type =g_strdup ("unknown" ); info->locked =bdrv_dev_is_medium_locked (bs); info->removable =bdrv_dev_has_removable_media (bs);
@@ -359,12 +360,12 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs)BlockInfoList *qmp_query_block (Error **errp) {BlockInfoList *head =NULL , **p_next = &head; -BlockDriverState *bs =NULL ; +BlockBackend *blk;Error *local_err =NULL ; -while ((bs =bdrv_next (bs))) { +for (blk =blk_next (NULL ); blk; blk =blk_next (blk)) {BlockInfoList *info =g_malloc0 (sizeof (*info)); -bdrv_query_info (bs, &info->value, &local_err); +bdrv_query_info (blk, &info->value, &local_err);if (local_err) {error_propagate (errp, local_err); goto err;
include/block/qapi.h +0 -3
@@ -36,9 +36,6 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs,void bdrv_query_image_info (BlockDriverState *bs,ImageInfo **p_info,Error **errp); -void bdrv_query_info (BlockDriverState *bs, -BlockInfo **p_info, -Error **errp);void bdrv_snapshot_dump (fprintf_function func_fprintf,void *f,QEMUSnapshotInfo *sn);
Signature · 1 line
1.9.3
PATCH 21/23 blockdev: Convert qmp_eject(), qmp_change_blockdev() to BlockBackend
In reply to Markus ArmbrusterMuch more command code needs conversion. I'm converting these now because they's using bdrv_dev_* functions, which I'm about to lift into BlockBackend.
--- blockdev.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
blockdev.c +12 -8
@@ -1501,8 +1501,10 @@ exit: } -static void eject_device (BlockDriverState *bs,int force,Error **errp) +static void eject_device (BlockBackend *blk,int force,Error **errp) { +BlockDriverState *bs =blk_bs (blk); +if (bdrv_op_is_blocked (bs,BLOCK_OP_TYPE_EJECT , errp)) {return ; }
@@ -1526,15 +1528,15 @@ static void eject_device(BlockDriverState *bs, int force, Error **errp)void qmp_eject (const char *device,bool has_force,bool force,Error **errp) { -BlockDriverState *bs; +BlockBackend *blk; - bs =bdrv_find (device); -if (!bs) { + blk =blk_by_name (device); +if (!blk) {error_set (errp,QERR_DEVICE_NOT_FOUND , device);return ; } -eject_device (bs, force, errp); +eject_device (blk, force, errp); } void qmp_block_passwd(bool has_device, const char *device,
@@ -1593,16 +1595,18 @@ static void qmp_bdrv_open_encrypted(BlockDriverState *bs, const char *filename,void qmp_change_blockdev (const char *device,const char *filename,const char *format,Error **errp) { +BlockBackend *blk;BlockDriverState *bs;BlockDriver *drv =NULL ;int bdrv_flags;Error *err =NULL ; - bs =bdrv_find (device); -if (!bs) { + blk =blk_by_name (device); +if (!blk) {error_set (errp,QERR_DEVICE_NOT_FOUND , device);return ; } + bs =blk_bs (blk);if (format) { drv =bdrv_find_whitelisted_format (format, bs->read_only);
@@ -1612,7 +1616,7 @@ void qmp_change_blockdev(const char *device, const char *filename, } } -eject_device (bs,0 , &err); +eject_device (blk,0 , &err);if (err) {error_propagate (errp, err);return ;
Signature · 1 line
1.9.3
PATCH 22/23 block: Lift device model API into BlockBackend
In reply to Markus ArmbrusterMove device model attachment / detachment and the BlockDevOps device model callbacks and their wrappers from BlockDriverState to BlockBackend.
--- block.c | 126 +++++------------------------------------ block/block-backend.c | 107 ++++++++++++++++++++++++++++++---- block/qapi.c | 8 +-- blockdev.c | 8 +-- include/block/block.h | 45 --------------- include/block/block_int.h | 12 ++-- include/sysemu/block-backend.h | 35 ++++++++++++ 7 files changed, 159 insertions(+), 182 deletions(-)
block.c +13 -113
@@ -58,9 +58,6 @@ struct BdrvDirtyBitmap {#define NOT_DONE 0x7fffffff/* used while emulated sync operation in progress */ -#define COROUTINE_POOL_RESERVATION 64/* number of coroutines to reserve */ - -static void bdrv_dev_change_media_cb (BlockDriverState *bs,bool load);static BlockAIOCB *bdrv_aio_readv_em (BlockDriverState *bs,int64_t sector_num,QEMUIOVector *qiov,int nb_sectors,BlockCompletionFunc *cb,void *opaque);
@@ -1516,7 +1513,9 @@ int bdrv_open(BlockDriverState **pbs, const char *filename, }if (!bdrv_key_required (bs)) { -bdrv_dev_change_media_cb (bs, true); +if (bs->blk) { +blk_dev_change_media_cb (bs->blk, true); + } }else if (!runstate_check (RUN_STATE_PRELAUNCH ) && !runstate_check (RUN_STATE_INMIGRATE ) && !runstate_check (RUN_STATE_PAUSED )) {/* HACK */
@@ -1841,7 +1840,9 @@ void bdrv_close(BlockDriverState *bs) } } -bdrv_dev_change_media_cb (bs, false); +if (bs->blk) { +blk_dev_change_media_cb (bs->blk, false); + }/*throttling disk I/O limits*/ if (bs->io_limits_enabled) {
@@ -1949,9 +1950,6 @@ static void bdrv_move_feature_fields(BlockDriverState *bs_dest,/* move some fields that need to stay attached to the device */ /* dev info */ - bs_dest->dev_ops = bs_src->dev_ops; - bs_dest->dev_opaque = bs_src->dev_opaque; - bs_dest->dev = bs_src->dev; bs_dest->guest_block_size = bs_src->guest_block_size; bs_dest->copy_on_read = bs_src->copy_on_read;
@@ -2017,7 +2015,6 @@ void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old)assert (!bs_new->blk);assert (QLIST_EMPTY (&bs_new->dirty_bitmaps));assert (bs_new->job ==NULL ); -assert (bs_new->dev ==NULL );assert (bs_new->io_limits_enabled == false);assert (!throttle_have_timer (&bs_new->throttle_state));
@@ -2034,7 +2031,6 @@ void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old)assert (!bs_new->blk);/* Check a few fields that should remain attached to the device */ -assert (bs_new->dev ==NULL );assert (bs_new->job ==NULL );assert (bs_new->io_limits_enabled == false);assert (!throttle_have_timer (&bs_new->throttle_state));
@@ -2073,7 +2069,6 @@ void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top)static void bdrv_delete (BlockDriverState *bs) { -assert (!bs->dev);assert (!bs->job);assert (bdrv_op_blocker_is_empty (bs));assert (!bs->refcnt);
@@ -2087,105 +2082,6 @@ static void bdrv_delete(BlockDriverState *bs)g_free (bs); } -int bdrv_attach_dev (BlockDriverState *bs,void *dev) -/* TODO change to DeviceState *dev when all users are qdevified */ -{ -if (bs->dev) { -return -EBUSY ; - } - bs->dev = dev; -bdrv_iostatus_reset (bs); - -/* We're expecting I/O from the device so bump up coroutine pool size */ -qemu_coroutine_adjust_pool_size (COROUTINE_POOL_RESERVATION ); -return 0 ; -} - -/* TODO qdevified devices don't use this, remove when devices are qdevified */ -void bdrv_attach_dev_nofail (BlockDriverState *bs,void *dev) -{ -if (bdrv_attach_dev (bs, dev) <0 ) { -abort (); - } -} - -void bdrv_detach_dev (BlockDriverState *bs,void *dev) -/* TODO change to DeviceState *dev when all users are qdevified */ -{ -assert (bs->dev == dev); - bs->dev =NULL ; - bs->dev_ops =NULL ; - bs->dev_opaque =NULL ; - bs->guest_block_size =512 ; -qemu_coroutine_adjust_pool_size (-COROUTINE_POOL_RESERVATION ); -} - -/* TODO change to return DeviceState * when all users are qdevified */ -void *bdrv_get_attached_dev (BlockDriverState *bs) -{ -return bs->dev; -} - -void bdrv_set_dev_ops (BlockDriverState *bs,const BlockDevOps *ops, -void *opaque) -{ - bs->dev_ops = ops; - bs->dev_opaque = opaque; -} - -static void bdrv_dev_change_media_cb (BlockDriverState *bs,bool load) -{ -if (bs->dev_ops && bs->dev_ops->change_media_cb) { -bool tray_was_closed = !bdrv_dev_is_tray_open (bs); - bs->dev_ops->change_media_cb (bs->dev_opaque, load); -if (tray_was_closed) { -/* tray open */ -qapi_event_send_device_tray_moved (bdrv_get_device_name (bs), - true, &error_abort); - } -if (load) { -/* tray close */ -qapi_event_send_device_tray_moved (bdrv_get_device_name (bs), - false, &error_abort); - } - } -} - -bool bdrv_dev_has_removable_media (BlockDriverState *bs) -{ -return !bs->dev || (bs->dev_ops && bs->dev_ops->change_media_cb); -} - -void bdrv_dev_eject_request (BlockDriverState *bs,bool force) -{ -if (bs->dev_ops && bs->dev_ops->eject_request_cb) { - bs->dev_ops->eject_request_cb (bs->dev_opaque, force); - } -} - -bool bdrv_dev_is_tray_open (BlockDriverState *bs) -{ -if (bs->dev_ops && bs->dev_ops->is_tray_open) { -return bs->dev_ops->is_tray_open (bs->dev_opaque); - } -return false; -} - -static void bdrv_dev_resize_cb (BlockDriverState *bs) -{ -if (bs->dev_ops && bs->dev_ops->resize_cb) { - bs->dev_ops->resize_cb (bs->dev_opaque); - } -} - -bool bdrv_dev_is_medium_locked (BlockDriverState *bs) -{ -if (bs->dev_ops && bs->dev_ops->is_medium_locked) { -return bs->dev_ops->is_medium_locked (bs->dev_opaque); - } -return false; -} -/* * Run consistency checks on an image *
@@ -3520,7 +3416,9 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset) ret = drv->bdrv_truncate (bs, offset);if (ret ==0 ) { ret =refresh_total_sectors (bs, offset >>BDRV_SECTOR_BITS ); -bdrv_dev_resize_cb (bs); +if (bs->blk) { +blk_dev_resize_cb (bs->blk); + } }return ret; }
@@ -3714,8 +3612,10 @@ int bdrv_set_key(BlockDriverState *bs, const char *key) bs->valid_key =0 ; }else if (!bs->valid_key) { bs->valid_key =1 ; -/* call the change callback now, we skipped it on open */ -bdrv_dev_change_media_cb (bs, true); +if (bs->blk) { +/* call the change callback now, we skipped it on open */ +blk_dev_change_media_cb (bs->blk, true); + } }return ret; }
block/block-backend.c +96 -11
148 lines not on this page · raw message
block/qapi.c +4 -4
@@ -275,12 +275,12 @@ static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info,Error *local_err =NULL ; info->device =g_strdup (blk_name (blk)); info->type =g_strdup ("unknown" ); - info->locked =bdrv_dev_is_medium_locked (bs); - info->removable =bdrv_dev_has_removable_media (bs); + info->locked =blk_dev_is_medium_locked (blk); + info->removable =blk_dev_has_removable_media (blk); -if (bdrv_dev_has_removable_media (bs)) { +if (blk_dev_has_removable_media (blk)) { info->has_tray_open = true; - info->tray_open =bdrv_dev_is_tray_open (bs); + info->tray_open =blk_dev_is_tray_open (blk); }if (bdrv_iostatus_is_enabled (bs)) {
blockdev.c +4 -4
@@ -1508,14 +1508,14 @@ static void eject_device(BlockBackend *blk, int force, Error **errp)if (bdrv_op_is_blocked (bs,BLOCK_OP_TYPE_EJECT , errp)) {return ; } -if (!bdrv_dev_has_removable_media (bs)) { +if (!blk_dev_has_removable_media (blk)) {error_setg (errp,"Device '%s' is not removable" ,bdrv_get_device_name (bs));return ; } -if (bdrv_dev_is_medium_locked (bs) && !bdrv_dev_is_tray_open (bs)) { -bdrv_dev_eject_request (bs, force); +if (blk_dev_is_medium_locked (blk) && !blk_dev_is_tray_open (blk)) { +blk_dev_eject_request (blk, force);if (!force) {error_setg (errp,"Device '%s' is locked" ,bdrv_get_device_name (bs));
@@ -1746,7 +1746,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)* can be removed. If this is a drive with no device backing * then we can just get rid of the block driver state right here. */ -if (bdrv_get_attached_dev (bs)) { +if (blk_get_attached_dev (blk)) {blk_make_anon (blk);/* Further I/O must not pause the guest */ bdrv_set_on_error(bs, BLOCKDEV_ON_ERROR_REPORT,
include/block/block.h +0 -45
57 lines not on this page · raw message
include/block/block_int.h +7 -5
@@ -325,11 +325,6 @@ struct BlockDriverState {BlockBackend *blk;/* owning backend, if any */ -void *dev;/* attached device model, if any */ -/* TODO change to DeviceState when all users are qdevified */ -const BlockDevOps *dev_ops; -void *dev_opaque; -AioContext *aio_context;/* event loop used for fd handlers, timers, etc */ /* long-running tasks intended to always use the same AioContext as this * BDS may register themselves in this list to be notified of changes
@@ -587,4 +582,11 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, BlockCompletionFunc *cb, void *opaque, Error **errp); +void blk_dev_change_media_cb (BlockBackend *blk,bool load); +bool blk_dev_has_removable_media (BlockBackend *blk); +void blk_dev_eject_request (BlockBackend *blk,bool force); +bool blk_dev_is_tray_open (BlockBackend *blk); +bool blk_dev_is_medium_locked (BlockBackend *blk); +void blk_dev_resize_cb (BlockBackend *blk); +#endif /* BLOCK_INT_H */
include/sysemu/block-backend.h +35 -0
@@ -25,6 +25,41 @@*/ #include "block/block.h" +/* Callbacks for block device models */ +typedef struct BlockDevOps { +/* +* Runs when virtual media changed (monitor commands eject, change) +* Argument load is true on load and false on eject. +* Beware: doesn't run when a host device's physical media +* changes. Sure would be useful if it did. +* Device models with removable media must implement this callback. +*/ +void (*change_media_cb)(void *opaque,bool load); +/* +* Runs when an eject request is issued from the monitor, the tray +* is closed, and the medium is locked. +* Device models that do not implement is_medium_locked will not need +* this callback. Device models that can lock the medium or tray might +* want to implement the callback and unlock the tray when "force" is +* true, even if they do not support eject requests. +*/ +void (*eject_request_cb)(void *opaque,bool force); +/* +* Is the virtual tray open? +* Device models implement this only when the device has a tray. +*/ +bool (*is_tray_open)(void *opaque); +/* +* Is the virtual medium locked into the device? +* Device models implement this only when device has such a lock. +*/ +bool (*is_medium_locked)(void *opaque); +/* +* Runs when the size changed (e.g. monitor command block_resize) +*/ +void (*resize_cb)(void *opaque); +}BlockDevOps ; +BlockBackend *blk_new (const char *name,Error **errp);BlockBackend *blk_new_with_bs (const char *name,Error **errp);void blk_ref (BlockBackend *blk);
Signature · 1 line
1.9.3
PATCH 23/23 block: Make device model's references to BlockBackend strong
In reply to Markus ArmbrusterDoesn't make a difference just yet, but it's the right thing to do.
--- block/block-backend.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
block/block-backend.c +3 -1
@@ -253,6 +253,7 @@ int blk_attach_dev(BlockBackend *blk, void *dev)if (blk->dev) {return -EBUSY ; } +blk_ref (blk); blk->dev = dev;bdrv_iostatus_reset (blk->bs);
@@ -273,9 +274,10 @@ void blk_detach_dev(BlockBackend *blk, void *dev)/* TODO change to DeviceState *dev when all users are qdevified */ {assert (blk->dev == dev); - blk->dev =NULL ; blk->dev_ops =NULL ; blk->dev_opaque =NULL ; + blk->dev =NULL ; +blk_unref (blk);bdrv_set_guest_block_size (blk->bs,512 );qemu_coroutine_adjust_pool_size (-COROUTINE_POOL_RESERVATION ); }
Signature · 1 line
1.9.3
Review led to a couple of changes with ripple effects on later patches. I suggest y'all await my v2 before you continue.
Thanks a lot for the review so far!