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>
This commit is contained in:
Eric Blake 2016-07-15 17:22:54 -06:00 committed by Stefan Hajnoczi
parent 60ebac16bc
commit 1c6c4bb7f0
8 changed files with 36 additions and 46 deletions

View file

@ -1696,8 +1696,7 @@ static int discard_f(BlockBackend *blk, int argc, char **argv)
}
gettimeofday(&t1, NULL);
ret = blk_discard(blk, offset >> BDRV_SECTOR_BITS,
count >> BDRV_SECTOR_BITS);
ret = blk_pdiscard(blk, offset, count);
gettimeofday(&t2, NULL);
if (ret < 0) {