aboutsummaryrefslogtreecommitdiff
path: root/block/blkreplay.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-07-15 17:22:50 -0600
committerStefan Hajnoczi <stefanha@redhat.com>2016-07-20 14:11:54 +0100
commit9f1963b3f72521f75a549f8afd61b19e7da63c6f (patch)
tree9679b0c2ebd1648b295048a58587bbfdad0039cb /block/blkreplay.c
parent6bd01f14dbef06dc22c0400f12dfbef06ab6b766 (diff)
block: Convert bdrv_co_discard() to byte-based
Another step towards byte-based interfaces everywhere. Replace the sector-based bdrv_co_discard() with a new byte-based bdrv_co_pdiscard(), which silently ignores any unaligned head or tail. Driver callbacks will be converted in followup patches. By calculating the alignment outside of the loop, and clamping the max discard to an aligned value, we can simplify the actions done within the loop. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1468624988-423-2-git-send-email-eblake@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/blkreplay.c')
-rwxr-xr-xblock/blkreplay.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blkreplay.c b/block/blkreplay.c
index 3368c8c98d..c69e5a57a0 100755
--- a/block/blkreplay.c
+++ b/block/blkreplay.c
@@ -118,7 +118,8 @@ static int coroutine_fn blkreplay_co_discard(BlockDriverState *bs,
int64_t sector_num, int nb_sectors)
{
uint64_t reqid = request_id++;
- int ret = bdrv_co_discard(bs->file->bs, sector_num, nb_sectors);
+ int ret = bdrv_co_pdiscard(bs->file->bs, sector_num << BDRV_SECTOR_BITS,
+ nb_sectors << BDRV_SECTOR_BITS);
block_request_create(reqid, bs, qemu_coroutine_self());
qemu_coroutine_yield();