mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
block: Add PreallocMode to bdrv_truncate()
For block drivers that just pass a truncate request to the underlying protocol, we can now pass the preallocation mode instead of aborting if it is not PREALLOC_MODE_OFF. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170613202107.10125-3-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
8243ccb743
commit
7ea37c3066
12 changed files with 26 additions and 36 deletions
|
@ -357,12 +357,6 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset,
|
|||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
if (s->has_size) {
|
||||
error_setg(errp, "Cannot resize fixed-size raw disks");
|
||||
return -ENOTSUP;
|
||||
|
@ -375,7 +369,7 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset,
|
|||
|
||||
s->size = offset;
|
||||
offset += s->offset;
|
||||
return bdrv_truncate(bs->file, offset, errp);
|
||||
return bdrv_truncate(bs->file, offset, prealloc, errp);
|
||||
}
|
||||
|
||||
static int raw_media_changed(BlockDriverState *bs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue