From ba4e72bd0a83812d2ca51c9f1e7d308a004a5ad6 Mon Sep 17 00:00:00 2001 From: Peter Fang Date: Tue, 9 Oct 2018 15:50:21 -0700 Subject: [PATCH] dm: virtio: add debugging information in virtio-blk Output debugging message when virtio-blk completes with error. v1 -> v2: - fix coding style - refine debugging message Tracked-On: #1422 Signed-off-by: Peter Fang Acked-by: Yu Wang --- devicemodel/hw/pci/virtio/virtio_block.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/devicemodel/hw/pci/virtio/virtio_block.c b/devicemodel/hw/pci/virtio/virtio_block.c index f5502c7bb..4dd0a60d1 100644 --- a/devicemodel/hw/pci/virtio/virtio_block.c +++ b/devicemodel/hw/pci/virtio/virtio_block.c @@ -171,6 +171,9 @@ virtio_blk_done(struct blockif_req *br, int err) struct virtio_blk_ioreq *io = br->param; struct virtio_blk *blk = io->blk; + if (err) + DPRINTF(("virtio_blk: done with error = %d\n\r", err)); + /* convert errno into a virtio block error return */ if (err == EOPNOTSUPP || err == ENOSYS) *io->status = VIRTIO_BLK_S_UNSUPP; @@ -245,7 +248,7 @@ virtio_blk_proc(struct virtio_blk *blk, struct virtio_vq_info *vq) } io->req.resid = iolen; - DPRINTF(("virtio-block: %s op, %zd bytes, %d segs, offset %ld\n\r", + DPRINTF(("virtio_blk: %s op, %zd bytes, %d segs, offset %ld\n\r", writeop ? "write" : "read/ident", iolen, i - 1, io->req.offset)); @@ -309,7 +312,7 @@ virtio_blk_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) int rc; if (opts == NULL) { - printf("virtio-block: backing device required\n"); + printf("virtio_blk: backing device required\n"); return -1; }