block: Convert bdrv_co_discard() to byte-based
commit9f1963b3f72521f75a549f8afd61b19e7da63c6f
authorEric Blake <eblake@redhat.com>
Fri, 15 Jul 2016 23:22:50 +0000 (15 17:22 -0600)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 20 Jul 2016 13:11:54 +0000 (20 14:11 +0100)
tree9679b0c2ebd1648b295048a58587bbfdad0039cb
parent6bd01f14dbef06dc22c0400f12dfbef06ab6b766
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>
block/blkreplay.c
block/block-backend.c
block/io.c
block/raw_bsd.c
include/block/block.h