aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorAnton Nefedov <anton.nefedov@virtuozzo.com>2019-09-23 15:17:33 +0300
committerMax Reitz <mreitz@redhat.com>2019-10-10 10:56:18 +0200
commit6d0680823c829b2d59f6b5488401b7c817d220b9 (patch)
treedd1f0f8e2d576e9ede64089eb52b575761952be2 /hw/scsi
parent99f18035b5e0d4f90a35e29022f1b4697fbe2835 (diff)
downloadqemu-6d0680823c829b2d59f6b5488401b7c817d220b9.zip
qemu-6d0680823c829b2d59f6b5488401b7c817d220b9.tar.gz
qemu-6d0680823c829b2d59f6b5488401b7c817d220b9.tar.bz2
scsi: store unmap offset and nb_sectors in request struct
it allows to report it in the error handler Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Message-id: 20190923121737.83281-6-anton.nefedov@virtuozzo.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/scsi-disk.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 915641a..b3dd218 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1608,8 +1608,6 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret)
{
SCSIDiskReq *r = data->r;
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
- uint64_t sector_num;
- uint32_t nb_sectors;
assert(r->req.aiocb == NULL);
if (scsi_disk_req_check_error(r, ret, false)) {
@@ -1617,16 +1615,18 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret)
}
if (data->count > 0) {
- sector_num = ldq_be_p(&data->inbuf[0]);
- nb_sectors = ldl_be_p(&data->inbuf[8]) & 0xffffffffULL;
- if (!check_lba_range(s, sector_num, nb_sectors)) {
+ r->sector = ldq_be_p(&data->inbuf[0])
+ * (s->qdev.blocksize / BDRV_SECTOR_SIZE);
+ r->sector_count = (ldl_be_p(&data->inbuf[8]) & 0xffffffffULL)
+ * (s->qdev.blocksize / BDRV_SECTOR_SIZE);
+ if (!check_lba_range(s, r->sector, r->sector_count)) {
scsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE));
goto done;
}
r->req.aiocb = blk_aio_pdiscard(s->qdev.conf.blk,
- sector_num * s->qdev.blocksize,
- nb_sectors * s->qdev.blocksize,
+ r->sector * BDRV_SECTOR_SIZE,
+ r->sector_count * BDRV_SECTOR_SIZE,
scsi_unmap_complete, data);
data->count--;
data->inbuf += 16;