aboutsummaryrefslogtreecommitdiff
path: root/block/mirror.c
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 /block/mirror.c
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 'block/mirror.c')
-rw-r--r--block/mirror.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/mirror.c b/block/mirror.c
index b1e633e..617bb18 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -303,8 +303,9 @@ static void mirror_do_zero_or_discard(MirrorBlockJob *s,
s->in_flight++;
s->sectors_in_flight += nb_sectors;
if (is_discard) {
- blk_aio_discard(s->target, sector_num, op->nb_sectors,
- mirror_write_complete, op);
+ blk_aio_pdiscard(s->target, sector_num << BDRV_SECTOR_BITS,
+ op->nb_sectors << BDRV_SECTOR_BITS,
+ mirror_write_complete, op);
} else {
blk_aio_pwrite_zeroes(s->target, sector_num * BDRV_SECTOR_SIZE,
op->nb_sectors * BDRV_SECTOR_SIZE,