diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2017-06-14 10:29:30 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2017-06-29 14:31:16 +0100 |
commit | a576ceac393b8d7490224bf2be65e0eb8f44f556 (patch) | |
tree | 280981a4163a174a4551bb16f3ab05914161369f /hw/block/virtio-blk.c | |
parent | 464588675455afda2899e20a0b120e4075de50c7 (diff) |
virtio-blk: trace vdev so devices can be distinguished
It is hard to analyze trace logs with multiple virtio-blk devices
because none of the trace events include the VirtIODevice *vdev.
This patch adds vdev so it's clear which device a request is associated
with.
I considered using VirtIOBlock *s instead but VirtIODevice *vdev is more
general and may be correlated with generic virtio trace events like
virtio_set_status.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 20170614092930.11234-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/block/virtio-blk.c')
-rw-r--r-- | hw/block/virtio-blk.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 604d37dfc8..c0bd247b37 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -50,7 +50,7 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status) VirtIOBlock *s = req->dev; VirtIODevice *vdev = VIRTIO_DEVICE(s); - trace_virtio_blk_req_complete(req, status); + trace_virtio_blk_req_complete(vdev, req, status); stb_p(&req->in->status, status); virtqueue_push(req->vq, &req->elem, req->in_len); @@ -88,12 +88,13 @@ static void virtio_blk_rw_complete(void *opaque, int ret) { VirtIOBlockReq *next = opaque; VirtIOBlock *s = next->dev; + VirtIODevice *vdev = VIRTIO_DEVICE(s); aio_context_acquire(blk_get_aio_context(s->conf.conf.blk)); while (next) { VirtIOBlockReq *req = next; next = req->mr_next; - trace_virtio_blk_rw_complete(req, ret); + trace_virtio_blk_rw_complete(vdev, req, ret); if (req->qiov.nalloc != -1) { /* If nalloc is != 1 req->qiov is a local copy of the original @@ -355,7 +356,8 @@ static inline void submit_requests(BlockBackend *blk, MultiReqBuffer *mrb, mrb->reqs[i - 1]->mr_next = mrb->reqs[i]; } - trace_virtio_blk_submit_multireq(mrb, start, num_reqs, + trace_virtio_blk_submit_multireq(VIRTIO_DEVICE(mrb->reqs[start]->dev), + mrb, start, num_reqs, sector_num << BDRV_SECTOR_BITS, qiov->size, is_write); block_acct_merge_done(blk_get_stats(blk), @@ -526,11 +528,11 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) if (is_write) { qemu_iovec_init_external(&req->qiov, iov, out_num); - trace_virtio_blk_handle_write(req, req->sector_num, + trace_virtio_blk_handle_write(vdev, req, req->sector_num, req->qiov.size / BDRV_SECTOR_SIZE); } else { qemu_iovec_init_external(&req->qiov, in_iov, in_num); - trace_virtio_blk_handle_read(req, req->sector_num, + trace_virtio_blk_handle_read(vdev, req, req->sector_num, req->qiov.size / BDRV_SECTOR_SIZE); } |