summaryrefslogtreecommitdiffstats
path: root/hw/block
diff options
context:
space:
mode:
authorEric Blake2016-07-16 01:22:54 +0200
committerStefan Hajnoczi2016-07-20 15:11:55 +0200
commit1c6c4bb7f0a4cc3987e58880ef96159985dc1228 (patch)
tree701615001a4bdce0a17e1d892c127da44ad21d8e /hw/block
parentblock: Convert bdrv_aio_discard() to byte-based (diff)
downloadqemu-1c6c4bb7f0a4cc3987e58880ef96159985dc1228.tar.gz
qemu-1c6c4bb7f0a4cc3987e58880ef96159985dc1228.tar.xz
qemu-1c6c4bb7f0a4cc3987e58880ef96159985dc1228.zip
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/block')
-rw-r--r--hw/block/xen_disk.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 90aca73121..3b8ad33fc5 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: