[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/36] scsi: store unmap offset and nb_sectors in request struct
From: |
Max Reitz |
Subject: |
[PULL 21/36] scsi: store unmap offset and nb_sectors in request struct |
Date: |
Thu, 10 Oct 2019 13:42:45 +0200 |
From: Anton Nefedov <address@hidden>
it allows to report it in the error handler
Signed-off-by: Anton Nefedov <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
hw/scsi/scsi-disk.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 915641a0f1..b3dd21800d 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;
--
2.21.0
- [PULL 13/36] block: teach bdrv_debug_breakpoint skip filters with backing, (continued)
- [PULL 13/36] block: teach bdrv_debug_breakpoint skip filters with backing, Max Reitz, 2019/10/10
- [PULL 12/36] block: move block_copy from block/backup.c to separate file, Max Reitz, 2019/10/10
- [PULL 10/36] block/backup: introduce BlockCopyState, Max Reitz, 2019/10/10
- [PULL 15/36] iotests: 257: drop unused Drive.device field, Max Reitz, 2019/10/10
- [PULL 17/36] qapi: group BlockDeviceStats fields, Max Reitz, 2019/10/10
- [PULL 16/36] iotests: 257: drop device_add, Max Reitz, 2019/10/10
- [PULL 19/36] block: add empty account cookie type, Max Reitz, 2019/10/10
- [PULL 18/36] qapi: add unmap to BlockDeviceStats, Max Reitz, 2019/10/10
- [PULL 20/36] ide: account UNMAP (TRIM) operations, Max Reitz, 2019/10/10
- [PULL 14/36] iotests: prepare 124 and 257 bitmap querying for backup-top filter, Max Reitz, 2019/10/10
- [PULL 21/36] scsi: store unmap offset and nb_sectors in request struct,
Max Reitz <=
- [PULL 22/36] scsi: move unmap error checking to the complete callback, Max Reitz, 2019/10/10
- [PULL 23/36] scsi: account unmap operations, Max Reitz, 2019/10/10
- [PULL 24/36] file-posix: account discard operations, Max Reitz, 2019/10/10
- [PULL 25/36] qapi: query-blockstat: add driver specific file-posix stats, Max Reitz, 2019/10/10
- [PULL 26/36] iotests: Fix 125 for growth_mode = metadata, Max Reitz, 2019/10/10
- [PULL 27/36] iotests: Disable 125 on broken XFS versions, Max Reitz, 2019/10/10
- [PULL 28/36] iotests: Use stat -c %b in 125, Max Reitz, 2019/10/10
- [PULL 29/36] block/backup: move in-flight requests handling from backup to block-copy, Max Reitz, 2019/10/10
- [PULL 30/36] block/backup: move write_flags calculation inside backup_job_create, Max Reitz, 2019/10/10
- [PULL 31/36] block/block-copy: split block_copy_set_callbacks function, Max Reitz, 2019/10/10