From 4be746345f13e99e468c60acbd3a355e8183e3ce Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 7 Oct 2014 13:59:18 +0200 Subject: hw: Convert from BlockDriverState to BlockBackend, mostly Device models should access their block backends only through the block-backend.h API. Convert them, and drop direct includes of inappropriate headers. Just 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. Signed-off-by: Markus Armbruster Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- hw/scsi/virtio-scsi.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'hw/scsi/virtio-scsi.c') diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 8547ea0475..a1725b8f48 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -16,6 +16,7 @@ #include "hw/virtio/virtio-scsi.h" #include "qemu/error-report.h" #include "qemu/iov.h" +#include "sysemu/block-backend.h" #include #include #include @@ -236,9 +237,9 @@ static int virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req) int target; int ret = 0; - if (s->dataplane_started && bdrv_get_aio_context(d->conf.bs) != s->ctx) { + if (s->dataplane_started && blk_get_aio_context(d->conf.blk) != s->ctx) { aio_context_acquire(s->ctx); - bdrv_set_aio_context(d->conf.bs, s->ctx); + blk_set_aio_context(d->conf.blk, s->ctx); aio_context_release(s->ctx); } /* Here VIRTIO_SCSI_S_OK means "FUNCTION COMPLETE". */ @@ -522,9 +523,9 @@ bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req) virtio_scsi_complete_cmd_req(req); return false; } - if (s->dataplane_started && bdrv_get_aio_context(d->conf.bs) != s->ctx) { + if (s->dataplane_started && blk_get_aio_context(d->conf.blk) != s->ctx) { aio_context_acquire(s->ctx); - bdrv_set_aio_context(d->conf.bs, s->ctx); + blk_set_aio_context(d->conf.blk, s->ctx); aio_context_release(s->ctx); } req->sreq = scsi_req_new(d, req->req.cmd.tag, @@ -539,7 +540,7 @@ bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req) return false; } scsi_req_ref(req->sreq); - bdrv_io_plug(d->conf.bs); + blk_io_plug(d->conf.blk); return true; } @@ -549,7 +550,7 @@ void virtio_scsi_handle_cmd_req_submit(VirtIOSCSI *s, VirtIOSCSIReq *req) if (scsi_req_enqueue(sreq)) { scsi_req_continue(sreq); } - bdrv_io_unplug(sreq->dev->conf.bs); + blk_io_unplug(sreq->dev->conf.blk); scsi_req_unref(sreq); } @@ -832,7 +833,7 @@ static void virtio_scsi_migration_state_changed(Notifier *notifier, void *data) if (s->dataplane_started) { return; } - bdrv_drain_all(); /* complete in-flight non-dataplane requests */ + blk_drain_all(); /* complete in-flight non-dataplane requests */ s->dataplane_disabled = false; } } -- cgit v1.2.3-55-g7522