X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvhost_blk%2Fblk.c;h=f8c8549b3acc7baf53af57422dbfea60ee44311e;hb=4460ed1482d6e0f48f145d6300d547b24b99fad6;hp=0d1e0387411fc73137d7f15127c03cedc3dd1d15;hpb=39f59f37ee410bbc43e88b3595108d9e2cffc132;p=dpdk.git diff --git a/examples/vhost_blk/blk.c b/examples/vhost_blk/blk.c index 0d1e038741..f8c8549b3a 100644 --- a/examples/vhost_blk/blk.c +++ b/examples/vhost_blk/blk.c @@ -50,7 +50,10 @@ vhost_bdev_blk_readwrite(struct vhost_block_dev *bdev, offset = lba_512 * 512; - for (i = 0; i < task->iovs_cnt; i++) { + /* iovs[0] is the head and iovs[iovs_cnt - 1] is the tail + * Middle is the data range + */ + for (i = 1; i < task->iovs_cnt - 1; i++) { if (task->dxfer_dir == BLK_DIR_TO_DEV) memcpy(bdev->data + offset, task->iovs[i].iov_base, task->iovs[i].iov_len); @@ -83,7 +86,7 @@ vhost_bdev_process_blk_commands(struct vhost_block_dev *bdev, "%s - passed IO buffer is not multiple of 512b" "(req_idx = %"PRIu16").\n", task->req->type ? "WRITE" : "READ", - task->head_idx); + task->req_idx); return VIRTIO_BLK_S_UNSUPP; } @@ -98,14 +101,10 @@ vhost_bdev_process_blk_commands(struct vhost_block_dev *bdev, "%s - passed IO buffer is not multiple of 512b" "(req_idx = %"PRIu16").\n", task->req->type ? "WRITE" : "READ", - task->head_idx); + task->req_idx); return VIRTIO_BLK_S_UNSUPP; } - if (task->readtype) { - fprintf(stderr, "type isn't right\n"); - return VIRTIO_BLK_S_IOERR; - } task->dxfer_dir = BLK_DIR_TO_DEV; vhost_bdev_blk_readwrite(bdev, task, task->req->sector, task->data_len);