block: Use BdrvChild to discard

Other I/O functions are already using a BdrvChild pointer in the API, so
make discard do the same. It makes it possible to initiate the same
permission checks before doing I/O, and much easier to share the
helper functions for this, which will be added and used by write,
truncate and copy range paths.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Fam Zheng 2018-07-10 14:31:17 +08:00 committed by Kevin Wolf
parent ecc983a507
commit 0b9fd3f467
11 changed files with 20 additions and 20 deletions

View file

@ -734,7 +734,7 @@ void qcow2_process_discards(BlockDriverState *bs, int ret)
/* Discard is optional, ignore the return value */
if (ret >= 0) {
bdrv_pdiscard(bs->file->bs, d->offset, d->bytes);
bdrv_pdiscard(bs->file, d->offset, d->bytes);
}
g_free(d);