[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 32/35] qcow2: Emit errp when truncating the image tai
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 32/35] qcow2: Emit errp when truncating the image tail |
Date: |
Thu, 26 Oct 2017 15:17:38 +0200 |
From: Max Reitz <address@hidden>
bdrv_truncate() has an errp parameter which is always set when an error
occurs. Let's use that instead of a plain strerror().
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Pavel Butsykin <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow2.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index f77b490cc6..d3e114bce5 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -3145,12 +3145,13 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t
offset,
return last_cluster;
}
if ((last_cluster + 1) * s->cluster_size < old_file_size) {
- ret = bdrv_truncate(bs->file, (last_cluster + 1) * s->cluster_size,
- PREALLOC_MODE_OFF, NULL);
- if (ret < 0) {
- warn_report("Failed to truncate the tail of the image: %s",
- strerror(-ret));
- ret = 0;
+ Error *local_err = NULL;
+
+ bdrv_truncate(bs->file, (last_cluster + 1) * s->cluster_size,
+ PREALLOC_MODE_OFF, &local_err);
+ if (local_err) {
+ warn_reportf_err(local_err,
+ "Failed to truncate the tail of the image: ");
}
}
} else {
--
2.13.6
- [Qemu-devel] [PULL 25/35] qcow2: Reduce is_zero() rounding, (continued)
- [Qemu-devel] [PULL 25/35] qcow2: Reduce is_zero() rounding, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 21/35] qemu-img: Change img_rebase() to be byte-based, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 20/35] qemu-img: Change compare_sectors() to be byte-based, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 23/35] block: Align block status requests, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 26/35] qemu-io: Relax 'alloc' now that block-status doesn't assert, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 28/35] qcow2: Use BDRV_SECTOR_BITS instead of its literal value, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 27/35] qemu-img.1: Image invalidation on qemu-img commit, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 30/35] iotests: Pull _filter_actual_image_size from 67/87, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 29/35] iotests: Add test for dataplane mirroring, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 31/35] iotests: Filter actual image size in 184 and 191, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 32/35] qcow2: Emit errp when truncating the image tail,
Kevin Wolf <=
- [Qemu-devel] [PULL 33/35] qcow2: Fix unaligned preallocated truncation, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 34/35] qcow2: Always execute preallocate() in a coroutine, Kevin Wolf, 2017/10/26
- [Qemu-devel] [PULL 35/35] iotests: Add cluster_size=64k to 125, Kevin Wolf, 2017/10/26
- Re: [Qemu-devel] [PULL 00/35] Block layer patches, Peter Maydell, 2017/10/27