aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-07-15 17:22:54 -0600
committerStefan Hajnoczi <stefanha@redhat.com>2016-07-20 14:11:55 +0100
commit1c6c4bb7f0a4cc3987e58880ef96159985dc1228 (patch)
tree701615001a4bdce0a17e1d892c127da44ad21d8e /hw
parent60ebac16bca3e3bf07c7ae67a69a7730aaa48712 (diff)
downloadqemu-1c6c4bb7f0a4cc3987e58880ef96159985dc1228.zip
qemu-1c6c4bb7f0a4cc3987e58880ef96159985dc1228.tar.gz
qemu-1c6c4bb7f0a4cc3987e58880ef96159985dc1228.tar.bz2
block: Convert BB interface to byte-based discards
Change sector-based blk_discard(), blk_co_discard(), and blk_aio_discard() to instead be byte-based blk_pdiscard(), blk_co_pdiscard(), and blk_aio_pdiscard(). NBD gets a lot simpler now that ignoring the unaligned portion of a byte-based discard request is handled under the hood by the block layer. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1468624988-423-6-git-send-email-eblake@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/block/xen_disk.c7
-rw-r--r--hw/ide/core.c6
-rw-r--r--hw/scsi/scsi-disk.c8
3 files changed, 12 insertions, 9 deletions
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 90aca73..3b8ad33 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -574,9 +574,10 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
{
struct blkif_request_discard *discard_req = (void *)&ioreq->req;
ioreq->aio_inflight++;
- blk_aio_discard(blkdev->blk,
- discard_req->sector_number, discard_req->nr_sectors,
- qemu_aio_complete, ioreq);
+ blk_aio_pdiscard(blkdev->blk,
+ discard_req->sector_number << BDRV_SECTOR_BITS,
+ discard_req->nr_sectors << BDRV_SECTOR_BITS,
+ qemu_aio_complete, ioreq);
break;
}
default:
diff --git a/hw/ide/core.c b/hw/ide/core.c
index b1daf96..081c9eb 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -423,8 +423,10 @@ static void ide_issue_trim_cb(void *opaque, int ret)
}
/* Got an entry! Submit and exit. */
- iocb->aiocb = blk_aio_discard(iocb->blk, sector, count,
- ide_issue_trim_cb, opaque);
+ iocb->aiocb = blk_aio_pdiscard(iocb->blk,
+ sector << BDRV_SECTOR_BITS,
+ count << BDRV_SECTOR_BITS,
+ ide_issue_trim_cb, opaque);
return;
}
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 8dbfc10..836a155 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1609,10 +1609,10 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret)
goto done;
}
- r->req.aiocb = blk_aio_discard(s->qdev.conf.blk,
- sector_num * (s->qdev.blocksize / 512),
- nb_sectors * (s->qdev.blocksize / 512),
- scsi_unmap_complete, data);
+ r->req.aiocb = blk_aio_pdiscard(s->qdev.conf.blk,
+ sector_num * s->qdev.blocksize,
+ nb_sectors * s->qdev.blocksize,
+ scsi_unmap_complete, data);
data->count--;
data->inbuf += 16;
return;