diff options
author | Max Reitz <mreitz@redhat.com> | 2019-09-18 11:51:40 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2019-10-28 12:00:07 +0100 |
commit | c80d8b06cfa59f5d8229379c85dcb2c3bb9c881b (patch) | |
tree | 0e30acba1187e0e5ccfaaf6324dc46431b6691af /block/raw-format.c | |
parent | 26536c7fc25917d1bd13781f81fe3ab039643bff (diff) | |
download | qemu-c80d8b06cfa59f5d8229379c85dcb2c3bb9c881b.zip |
block: Add @exact parameter to bdrv_co_truncate()
We have two drivers (iscsi and file-posix) that (in some cases) return
success from their .bdrv_co_truncate() implementation if the block
device is larger than the requested offset, but cannot be shrunk. Some
callers do not want that behavior, so this patch adds a new parameter
that they can use to turn off that behavior.
This patch just adds the parameter and lets the block/io.c and
block/block-backend.c functions pass it around. All other callers
always pass false and none of the implementations evaluate it, so that
this patch does not change existing behavior. Future patches take care
of that.
Suggested-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190918095144.955-5-mreitz@redhat.com
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/raw-format.c')
-rw-r--r-- | block/raw-format.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/block/raw-format.c b/block/raw-format.c index 42c28cc29a..57d84d0bae 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -370,7 +370,8 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp) } static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset, - PreallocMode prealloc, Error **errp) + bool exact, PreallocMode prealloc, + Error **errp) { BDRVRawState *s = bs->opaque; @@ -386,7 +387,7 @@ static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset, s->size = offset; offset += s->offset; - return bdrv_co_truncate(bs->file, offset, prealloc, errp); + return bdrv_co_truncate(bs->file, offset, false, prealloc, errp); } static void raw_eject(BlockDriverState *bs, bool eject_flag) |