[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v4 4/8] scsi: store unmap offset and nb_sectors in r
From: |
Anton Nefedov |
Subject: |
[Qemu-block] [PATCH v4 4/8] scsi: store unmap offset and nb_sectors in request struct |
Date: |
Tue, 21 Aug 2018 12:46:15 +0300 |
it allows to report it in the error handler
Signed-off-by: Anton Nefedov <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
---
hw/scsi/scsi-disk.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 5ae7baa..d41eea1 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1653,8 +1653,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)) {
@@ -1662,16 +1660,16 @@ 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]);
+ r->sector_count = ldl_be_p(&data->inbuf[8]) & 0xffffffffULL;
+ 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 * s->qdev.blocksize,
+ r->sector_count * s->qdev.blocksize,
scsi_unmap_complete, data);
data->count--;
data->inbuf += 16;
--
2.7.4
- [Qemu-block] [PATCH v4 0/8] discard blockstats, Anton Nefedov, 2018/08/21
- [Qemu-block] [PATCH v4 3/8] ide: account UNMAP (TRIM) operations, Anton Nefedov, 2018/08/21
- [Qemu-block] [PATCH v4 1/8] qapi: group BlockDeviceStats fields, Anton Nefedov, 2018/08/21
- [Qemu-block] [PATCH v4 2/8] qapi: add unmap to BlockDeviceStats, Anton Nefedov, 2018/08/21
- [Qemu-block] [PATCH v4 6/8] scsi: account unmap operations, Anton Nefedov, 2018/08/21
- [Qemu-block] [PATCH v4 5/8] scsi: move unmap error checking to the complete callback, Anton Nefedov, 2018/08/21
- [Qemu-block] [PATCH v4 4/8] scsi: store unmap offset and nb_sectors in request struct,
Anton Nefedov <=
- [Qemu-block] [PATCH v4 7/8] file-posix: account discard operations, Anton Nefedov, 2018/08/21
- [Qemu-block] [PATCH v4 8/8] qapi: query-blockstat: add driver specific file-posix stats, Anton Nefedov, 2018/08/21