Block layer patches
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJWn6nVAAoJEH8JsnLIjy/WrvcP/1+v+5xtO/isl/sBnQGVwDAt kufea4dveMQ0r1lK9YhSmGb5yVBjGwry2LCH3YFkaYkKvRJ/gU+kVjB1V1Vw9YAD eHmF9EPxJ8PUhMaFFYzT7Rp7fHPyqVrmFpAGIB4PRZVX2dBeIuFKQAI0K9AD6FdM FZGTDZRFOa8fJdxlttfSzD6q0Auwgs+BBZ2SCOk/l66cELvug94AlJzdnG7L83FR /49jYCN5IOBAI00Xo2wCeLIR33juJorD3ePHD/+RgM51/1hpd9+mX6wwcMSJNOTH pMpDVgByyuV1ozsy/QrHHzdaKnasoco9p24KxDvgtHSdVj2wR2trh5A4UUyXetEn WNorSaaNSx1mtKlxjquzqPGALFKugTdgCOLJ2Gj4c8rbvNkvzHZq25dTndgJqCvb 40xCuDolByGzju5Q0SVQZ8u9eD0O5IB1jB7hawcA92U2HQb9LQx4QrP/hrzwh3zC 6eoRDAsbrrnZW+oU3EiIGs1RQQ9/GeaJ3XK4rqLfLj53gQORjLVz7/pjL07ZbArR NqyAD1NVFwtGJ9C7yf3tCiX4qYNQSFQgj394fSfigwnonzKetcqmZayILtH4NAoC bljfPDhgGuwRMo7vOJYW77Gc3MhWFiwo/nDZ7qGT1JtP/ATxTphXY2SW8G7dkl+7 aVjYcGd10VgUm4wvmKVG =Me52 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Block layer patches # gpg: Signature made Wed 20 Jan 2016 15:37:57 GMT using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: iotests: Test that throttle values ranges blockdev: Error out on negative throttling option values vmdk: Create streamOptimized as version 3 qcow2: Make image inaccessible after failed qcow2_invalidate_cache() qcow2: Fix BDRV_O_INACTIVE handling in qcow2_invalidate_cache() qcow2: Implement .bdrv_inactivate block: Inactivate BDS when migration completes block: Rename BDRV_O_INCOMING to BDRV_O_INACTIVE block: Fix error path in bdrv_invalidate_cache() block: Assert no write requests under BDRV_O_INCOMING qcow2: Write full header on image creation qcow2: Write feature table only for v3 images block: Clean up includes qemu-iotests: Reduce racy output in 028 qemu-img: Speed up comparing empty/zero images block/raw-posix: avoid bogus fixup for cylinders on DASD disks block: Fix .bdrv_open flags Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
3c9331c47f
55
block.c
55
block.c
@ -905,7 +905,7 @@ static QemuOptsList bdrv_runtime_opts = {
|
|||||||
* Removes all processed options from *options.
|
* Removes all processed options from *options.
|
||||||
*/
|
*/
|
||||||
static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
|
static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
|
||||||
QDict *options, int flags, Error **errp)
|
QDict *options, Error **errp)
|
||||||
{
|
{
|
||||||
int ret, open_flags;
|
int ret, open_flags;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
@ -943,7 +943,8 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
|
|||||||
goto fail_opts;
|
goto fail_opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace_bdrv_open_common(bs, filename ?: "", flags, drv->format_name);
|
trace_bdrv_open_common(bs, filename ?: "", bs->open_flags,
|
||||||
|
drv->format_name);
|
||||||
|
|
||||||
node_name = qemu_opt_get(opts, "node-name");
|
node_name = qemu_opt_get(opts, "node-name");
|
||||||
bdrv_assign_node_name(bs, node_name, &local_err);
|
bdrv_assign_node_name(bs, node_name, &local_err);
|
||||||
@ -955,8 +956,7 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
|
|||||||
|
|
||||||
bs->request_alignment = 512;
|
bs->request_alignment = 512;
|
||||||
bs->zero_beyond_eof = true;
|
bs->zero_beyond_eof = true;
|
||||||
open_flags = bdrv_open_flags(bs, flags);
|
bs->read_only = !(bs->open_flags & BDRV_O_RDWR);
|
||||||
bs->read_only = !(open_flags & BDRV_O_RDWR);
|
|
||||||
|
|
||||||
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) {
|
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) {
|
||||||
error_setg(errp,
|
error_setg(errp,
|
||||||
@ -969,7 +969,7 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(bs->copy_on_read == 0); /* bdrv_new() and bdrv_close() make it so */
|
assert(bs->copy_on_read == 0); /* bdrv_new() and bdrv_close() make it so */
|
||||||
if (flags & BDRV_O_COPY_ON_READ) {
|
if (bs->open_flags & BDRV_O_COPY_ON_READ) {
|
||||||
if (!bs->read_only) {
|
if (!bs->read_only) {
|
||||||
bdrv_enable_copy_on_read(bs);
|
bdrv_enable_copy_on_read(bs);
|
||||||
} else {
|
} else {
|
||||||
@ -994,6 +994,7 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
|
|||||||
bdrv_set_enable_write_cache(bs, bs->open_flags & BDRV_O_CACHE_WB);
|
bdrv_set_enable_write_cache(bs, bs->open_flags & BDRV_O_CACHE_WB);
|
||||||
|
|
||||||
/* Open the image, either directly or using a protocol */
|
/* Open the image, either directly or using a protocol */
|
||||||
|
open_flags = bdrv_open_flags(bs, bs->open_flags);
|
||||||
if (drv->bdrv_file_open) {
|
if (drv->bdrv_file_open) {
|
||||||
assert(file == NULL);
|
assert(file == NULL);
|
||||||
assert(!drv->bdrv_needs_filename || filename != NULL);
|
assert(!drv->bdrv_needs_filename || filename != NULL);
|
||||||
@ -1190,7 +1191,7 @@ static int bdrv_fill_options(QDict **options, const char *filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (runstate_check(RUN_STATE_INMIGRATE)) {
|
if (runstate_check(RUN_STATE_INMIGRATE)) {
|
||||||
*flags |= BDRV_O_INCOMING;
|
*flags |= BDRV_O_INACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1656,7 +1657,7 @@ static int bdrv_open_inherit(BlockDriverState **pbs, const char *filename,
|
|||||||
assert(!(flags & BDRV_O_PROTOCOL) || !file);
|
assert(!(flags & BDRV_O_PROTOCOL) || !file);
|
||||||
|
|
||||||
/* Open the image */
|
/* Open the image */
|
||||||
ret = bdrv_open_common(bs, file, options, flags, &local_err);
|
ret = bdrv_open_common(bs, file, options, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -3260,10 +3261,10 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(bs->open_flags & BDRV_O_INCOMING)) {
|
if (!(bs->open_flags & BDRV_O_INACTIVE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs->open_flags &= ~BDRV_O_INCOMING;
|
bs->open_flags &= ~BDRV_O_INACTIVE;
|
||||||
|
|
||||||
if (bs->drv->bdrv_invalidate_cache) {
|
if (bs->drv->bdrv_invalidate_cache) {
|
||||||
bs->drv->bdrv_invalidate_cache(bs, &local_err);
|
bs->drv->bdrv_invalidate_cache(bs, &local_err);
|
||||||
@ -3271,12 +3272,14 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp)
|
|||||||
bdrv_invalidate_cache(bs->file->bs, &local_err);
|
bdrv_invalidate_cache(bs->file->bs, &local_err);
|
||||||
}
|
}
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
|
bs->open_flags |= BDRV_O_INACTIVE;
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = refresh_total_sectors(bs, bs->total_sectors);
|
ret = refresh_total_sectors(bs, bs->total_sectors);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
bs->open_flags |= BDRV_O_INACTIVE;
|
||||||
error_setg_errno(errp, -ret, "Could not refresh total sector count");
|
error_setg_errno(errp, -ret, "Could not refresh total sector count");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3300,6 +3303,40 @@ void bdrv_invalidate_cache_all(Error **errp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int bdrv_inactivate(BlockDriverState *bs)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (bs->drv->bdrv_inactivate) {
|
||||||
|
ret = bs->drv->bdrv_inactivate(bs);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bs->open_flags |= BDRV_O_INACTIVE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bdrv_inactivate_all(void)
|
||||||
|
{
|
||||||
|
BlockDriverState *bs;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
|
||||||
|
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||||
|
|
||||||
|
aio_context_acquire(aio_context);
|
||||||
|
ret = bdrv_inactivate(bs);
|
||||||
|
aio_context_release(aio_context);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/* removable device support */
|
/* removable device support */
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "block/accounting.h"
|
#include "block/accounting.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
@ -59,7 +60,6 @@
|
|||||||
#include "qapi/qmp/qjson.h"
|
#include "qapi/qmp/qjson.h"
|
||||||
#include "qemu/atomic.h"
|
#include "qemu/atomic.h"
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <xseg/xseg.h>
|
#include <xseg/xseg.h>
|
||||||
#include <xseg/protocol.h>
|
#include <xseg/protocol.h>
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "qemu/osdep.h"
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "block/block.h"
|
#include "block/block.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* See the COPYING file in the top-level directory.
|
* See the COPYING file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
|
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qapi/qmp/qdict.h"
|
#include "qapi/qmp/qdict.h"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
* or later. See the COPYING.LIB file in the top-level directory.
|
* or later. See the COPYING.LIB file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/bswap.h"
|
#include "qemu/bswap.h"
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* See the COPYING file in the top-level directory.
|
* See the COPYING file in the top-level directory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include <glusterfs/api/glfs.h>
|
#include <glusterfs/api/glfs.h>
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/uri.h"
|
#include "qemu/uri.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
@ -1300,6 +1301,7 @@ static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs,
|
|||||||
if (bs->read_only) {
|
if (bs->read_only) {
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
assert(!(bs->open_flags & BDRV_O_INACTIVE));
|
||||||
|
|
||||||
ret = bdrv_check_byte_request(bs, offset, bytes);
|
ret = bdrv_check_byte_request(bs, offset, bytes);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -2461,6 +2463,7 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num,
|
|||||||
} else if (bs->read_only) {
|
} else if (bs->read_only) {
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
assert(!(bs->open_flags & BDRV_O_INACTIVE));
|
||||||
|
|
||||||
/* Do nothing if disabled. */
|
/* Do nothing if disabled. */
|
||||||
if (!(bs->open_flags & BDRV_O_UNMAP)) {
|
if (!(bs->open_flags & BDRV_O_UNMAP)) {
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config-host.h"
|
#include "qemu/osdep.h"
|
||||||
|
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||||
* See the COPYING file in the top-level directory.
|
* See the COPYING file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/aio.h"
|
#include "block/aio.h"
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "nbd-client.h"
|
#include "nbd-client.h"
|
||||||
#include "qemu/sockets.h"
|
#include "qemu/sockets.h"
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "block/nbd-client.h"
|
#include "block/nbd-client.h"
|
||||||
#include "qemu/uri.h"
|
#include "qemu/uri.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
@ -36,8 +37,6 @@
|
|||||||
#include "qapi/qmp/qint.h"
|
#include "qapi/qmp/qint.h"
|
||||||
#include "qapi/qmp/qstring.h"
|
#include "qapi/qmp/qstring.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#define EN_OPTSTR ":exportname="
|
#define EN_OPTSTR ":exportname="
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config-host.h"
|
#include "qemu/osdep.h"
|
||||||
|
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
* See the COPYING file in the top-level directory.
|
* See the COPYING file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
|
||||||
#define NULL_OPT_LATENCY "latency-ns"
|
#define NULL_OPT_LATENCY "latency-ns"
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "block/qapi.h"
|
#include "block/qapi.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/throttle-groups.h"
|
#include "block/throttle-groups.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Needed for CONFIG_MADVISE */
|
/* Needed for CONFIG_MADVISE */
|
||||||
#include "config-host.h"
|
#include "qemu/osdep.h"
|
||||||
|
|
||||||
#if defined(CONFIG_MADVISE) || defined(CONFIG_POSIX_MADVISE)
|
#if defined(CONFIG_MADVISE) || defined(CONFIG_POSIX_MADVISE)
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/osdep.h"
|
|
||||||
#include "qcow2.h"
|
#include "qcow2.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/qcow2.h"
|
#include "block/qcow2.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/qcow2.h"
|
#include "block/qcow2.h"
|
||||||
|
111
block/qcow2.c
111
block/qcow2.c
@ -21,6 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
@ -1140,7 +1141,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clear unknown autoclear feature bits */
|
/* Clear unknown autoclear feature bits */
|
||||||
if (!bs->read_only && !(flags & BDRV_O_INCOMING) && s->autoclear_features) {
|
if (!bs->read_only && !(flags & BDRV_O_INACTIVE) && s->autoclear_features) {
|
||||||
s->autoclear_features = 0;
|
s->autoclear_features = 0;
|
||||||
ret = qcow2_update_header(bs);
|
ret = qcow2_update_header(bs);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -1153,7 +1154,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
qemu_co_mutex_init(&s->lock);
|
qemu_co_mutex_init(&s->lock);
|
||||||
|
|
||||||
/* Repair image if dirty */
|
/* Repair image if dirty */
|
||||||
if (!(flags & (BDRV_O_CHECK | BDRV_O_INCOMING)) && !bs->read_only &&
|
if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only &&
|
||||||
(s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {
|
(s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {
|
||||||
BdrvCheckResult result = {0};
|
BdrvCheckResult result = {0};
|
||||||
|
|
||||||
@ -1685,6 +1686,32 @@ fail:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int qcow2_inactivate(BlockDriverState *bs)
|
||||||
|
{
|
||||||
|
BDRVQcow2State *s = bs->opaque;
|
||||||
|
int ret, result = 0;
|
||||||
|
|
||||||
|
ret = qcow2_cache_flush(bs, s->l2_table_cache);
|
||||||
|
if (ret) {
|
||||||
|
result = ret;
|
||||||
|
error_report("Failed to flush the L2 table cache: %s",
|
||||||
|
strerror(-ret));
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = qcow2_cache_flush(bs, s->refcount_block_cache);
|
||||||
|
if (ret) {
|
||||||
|
result = ret;
|
||||||
|
error_report("Failed to flush the refcount block cache: %s",
|
||||||
|
strerror(-ret));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
qcow2_mark_clean(bs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static void qcow2_close(BlockDriverState *bs)
|
static void qcow2_close(BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
BDRVQcow2State *s = bs->opaque;
|
BDRVQcow2State *s = bs->opaque;
|
||||||
@ -1692,24 +1719,8 @@ static void qcow2_close(BlockDriverState *bs)
|
|||||||
/* else pre-write overlap checks in cache_destroy may crash */
|
/* else pre-write overlap checks in cache_destroy may crash */
|
||||||
s->l1_table = NULL;
|
s->l1_table = NULL;
|
||||||
|
|
||||||
if (!(bs->open_flags & BDRV_O_INCOMING)) {
|
if (!(s->flags & BDRV_O_INACTIVE)) {
|
||||||
int ret1, ret2;
|
qcow2_inactivate(bs);
|
||||||
|
|
||||||
ret1 = qcow2_cache_flush(bs, s->l2_table_cache);
|
|
||||||
ret2 = qcow2_cache_flush(bs, s->refcount_block_cache);
|
|
||||||
|
|
||||||
if (ret1) {
|
|
||||||
error_report("Failed to flush the L2 table cache: %s",
|
|
||||||
strerror(-ret1));
|
|
||||||
}
|
|
||||||
if (ret2) {
|
|
||||||
error_report("Failed to flush the refcount block cache: %s",
|
|
||||||
strerror(-ret2));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ret1 && !ret2) {
|
|
||||||
qcow2_mark_clean(bs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_clean_timer_del(bs);
|
cache_clean_timer_del(bs);
|
||||||
@ -1753,20 +1764,24 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
|
|||||||
bdrv_invalidate_cache(bs->file->bs, &local_err);
|
bdrv_invalidate_cache(bs->file->bs, &local_err);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
|
bs->drv = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(s, 0, sizeof(BDRVQcow2State));
|
memset(s, 0, sizeof(BDRVQcow2State));
|
||||||
options = qdict_clone_shallow(bs->options);
|
options = qdict_clone_shallow(bs->options);
|
||||||
|
|
||||||
|
flags &= ~BDRV_O_INACTIVE;
|
||||||
ret = qcow2_open(bs, options, flags, &local_err);
|
ret = qcow2_open(bs, options, flags, &local_err);
|
||||||
QDECREF(options);
|
QDECREF(options);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
error_prepend(errp, "Could not reopen qcow2 layer: ");
|
error_prepend(errp, "Could not reopen qcow2 layer: ");
|
||||||
|
bs->drv = NULL;
|
||||||
return;
|
return;
|
||||||
} else if (ret < 0) {
|
} else if (ret < 0) {
|
||||||
error_setg_errno(errp, -ret, "Could not reopen qcow2 layer");
|
error_setg_errno(errp, -ret, "Could not reopen qcow2 layer");
|
||||||
|
bs->drv = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1894,31 +1909,33 @@ int qcow2_update_header(BlockDriverState *bs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Feature table */
|
/* Feature table */
|
||||||
Qcow2Feature features[] = {
|
if (s->qcow_version >= 3) {
|
||||||
{
|
Qcow2Feature features[] = {
|
||||||
.type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
|
{
|
||||||
.bit = QCOW2_INCOMPAT_DIRTY_BITNR,
|
.type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
|
||||||
.name = "dirty bit",
|
.bit = QCOW2_INCOMPAT_DIRTY_BITNR,
|
||||||
},
|
.name = "dirty bit",
|
||||||
{
|
},
|
||||||
.type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
|
{
|
||||||
.bit = QCOW2_INCOMPAT_CORRUPT_BITNR,
|
.type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
|
||||||
.name = "corrupt bit",
|
.bit = QCOW2_INCOMPAT_CORRUPT_BITNR,
|
||||||
},
|
.name = "corrupt bit",
|
||||||
{
|
},
|
||||||
.type = QCOW2_FEAT_TYPE_COMPATIBLE,
|
{
|
||||||
.bit = QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR,
|
.type = QCOW2_FEAT_TYPE_COMPATIBLE,
|
||||||
.name = "lazy refcounts",
|
.bit = QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR,
|
||||||
},
|
.name = "lazy refcounts",
|
||||||
};
|
},
|
||||||
|
};
|
||||||
|
|
||||||
ret = header_ext_add(buf, QCOW2_EXT_MAGIC_FEATURE_TABLE,
|
ret = header_ext_add(buf, QCOW2_EXT_MAGIC_FEATURE_TABLE,
|
||||||
features, sizeof(features), buflen);
|
features, sizeof(features), buflen);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
|
buf += ret;
|
||||||
|
buflen -= ret;
|
||||||
}
|
}
|
||||||
buf += ret;
|
|
||||||
buflen -= ret;
|
|
||||||
|
|
||||||
/* Keep unknown header extensions */
|
/* Keep unknown header extensions */
|
||||||
QLIST_FOREACH(uext, &s->unknown_header_ext, next) {
|
QLIST_FOREACH(uext, &s->unknown_header_ext, next) {
|
||||||
@ -2236,6 +2253,13 @@ static int qcow2_create2(const char *filename, int64_t total_size,
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create a full header (including things like feature table) */
|
||||||
|
ret = qcow2_update_header(bs);
|
||||||
|
if (ret < 0) {
|
||||||
|
error_setg_errno(errp, -ret, "Could not update qcow2 header");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* Okay, now that we have a valid image, let's give it the right size */
|
/* Okay, now that we have a valid image, let's give it the right size */
|
||||||
ret = bdrv_truncate(bs, total_size);
|
ret = bdrv_truncate(bs, total_size);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -3330,6 +3354,7 @@ BlockDriver bdrv_qcow2 = {
|
|||||||
|
|
||||||
.bdrv_refresh_limits = qcow2_refresh_limits,
|
.bdrv_refresh_limits = qcow2_refresh_limits,
|
||||||
.bdrv_invalidate_cache = qcow2_invalidate_cache,
|
.bdrv_invalidate_cache = qcow2_invalidate_cache,
|
||||||
|
.bdrv_inactivate = qcow2_inactivate,
|
||||||
|
|
||||||
.create_opts = &qcow2_create_opts,
|
.create_opts = &qcow2_create_opts,
|
||||||
.bdrv_check = qcow2_check,
|
.bdrv_check = qcow2_check,
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qed.h"
|
#include "qed.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qed.h"
|
#include "qed.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qed.h"
|
#include "qed.h"
|
||||||
|
|
||||||
void *gencb_alloc(size_t len, BlockCompletionFunc *cb, void *opaque)
|
void *gencb_alloc(size_t len, BlockCompletionFunc *cb, void *opaque)
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
* table will be deleted in favor of the existing cache entry.
|
* table will be deleted in favor of the existing cache entry.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qed.h"
|
#include "qed.h"
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
|
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
|
||||||
#include "qed.h"
|
#include "qed.h"
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qed.h"
|
#include "qed.h"
|
||||||
@ -477,7 +478,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
* feature is no longer valid.
|
* feature is no longer valid.
|
||||||
*/
|
*/
|
||||||
if ((s->header.autoclear_features & ~QED_AUTOCLEAR_FEATURE_MASK) != 0 &&
|
if ((s->header.autoclear_features & ~QED_AUTOCLEAR_FEATURE_MASK) != 0 &&
|
||||||
!bdrv_is_read_only(bs->file->bs) && !(flags & BDRV_O_INCOMING)) {
|
!bdrv_is_read_only(bs->file->bs) && !(flags & BDRV_O_INACTIVE)) {
|
||||||
s->header.autoclear_features &= QED_AUTOCLEAR_FEATURE_MASK;
|
s->header.autoclear_features &= QED_AUTOCLEAR_FEATURE_MASK;
|
||||||
|
|
||||||
ret = qed_write_header_sync(s);
|
ret = qed_write_header_sync(s);
|
||||||
@ -505,7 +506,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
* aid data recovery from an otherwise inconsistent image.
|
* aid data recovery from an otherwise inconsistent image.
|
||||||
*/
|
*/
|
||||||
if (!bdrv_is_read_only(bs->file->bs) &&
|
if (!bdrv_is_read_only(bs->file->bs) &&
|
||||||
!(flags & BDRV_O_INCOMING)) {
|
!(flags & BDRV_O_INACTIVE)) {
|
||||||
BdrvCheckResult result = {0};
|
BdrvCheckResult result = {0};
|
||||||
|
|
||||||
ret = qed_check(s, &result, true);
|
ret = qed_check(s, &result, true);
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* See the COPYING file in the top-level directory.
|
* See the COPYING file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qapi/qmp/qbool.h"
|
#include "qapi/qmp/qbool.h"
|
||||||
#include "qapi/qmp/qdict.h"
|
#include "qapi/qmp/qdict.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
@ -51,8 +52,6 @@
|
|||||||
#include <sys/dkio.h>
|
#include <sys/dkio.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <linux/cdrom.h>
|
#include <linux/cdrom.h>
|
||||||
@ -779,7 +778,6 @@ static int hdev_probe_geometry(BlockDriverState *bs, HDGeometry *geo)
|
|||||||
{
|
{
|
||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
struct hd_geometry ioctl_geo = {0};
|
struct hd_geometry ioctl_geo = {0};
|
||||||
uint32_t blksize;
|
|
||||||
|
|
||||||
/* If DASD, get its geometry */
|
/* If DASD, get its geometry */
|
||||||
if (check_for_dasd(s->fd) < 0) {
|
if (check_for_dasd(s->fd) < 0) {
|
||||||
@ -799,12 +797,6 @@ static int hdev_probe_geometry(BlockDriverState *bs, HDGeometry *geo)
|
|||||||
}
|
}
|
||||||
geo->heads = ioctl_geo.heads;
|
geo->heads = ioctl_geo.heads;
|
||||||
geo->sectors = ioctl_geo.sectors;
|
geo->sectors = ioctl_geo.sectors;
|
||||||
if (!probe_physical_blocksize(s->fd, &blksize)) {
|
|
||||||
/* overwrite cyls: HDIO_GETGEO result is incorrect for big drives */
|
|
||||||
geo->cylinders = bdrv_nb_sectors(bs) / (blksize / BDRV_SECTOR_SIZE)
|
|
||||||
/ (geo->heads * geo->sectors);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
geo->cylinders = ioctl_geo.cylinders;
|
geo->cylinders = ioctl_geo.cylinders;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/option.h"
|
#include "qemu/option.h"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* GNU GPL, version 2 or (at your option) any later version.
|
* GNU GPL, version 2 or (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include "qemu/osdep.h"
|
||||||
|
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
* GNU GPL, version 2 or (at your option) any later version.
|
* GNU GPL, version 2 or (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/uri.h"
|
#include "qemu/uri.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "block/snapshot.h"
|
#include "block/snapshot.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
#include "qapi/qmp/qerror.h"
|
||||||
|
@ -22,9 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "qemu/osdep.h"
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "block/throttle-groups.h"
|
#include "block/throttle-groups.h"
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qemu/thread.h"
|
#include "qemu/thread.h"
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
* so this seems to be reasonable.
|
* so this seems to be reasonable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/vhdx.h"
|
#include "block/vhdx.h"
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* See the COPYING.LIB file in the top-level directory.
|
* See the COPYING.LIB file in the top-level directory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
#include "qapi/qmp/qerror.h"
|
||||||
@ -1662,7 +1663,13 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
|||||||
}
|
}
|
||||||
magic = cpu_to_be32(VMDK4_MAGIC);
|
magic = cpu_to_be32(VMDK4_MAGIC);
|
||||||
memset(&header, 0, sizeof(header));
|
memset(&header, 0, sizeof(header));
|
||||||
header.version = zeroed_grain ? 2 : 1;
|
if (compress) {
|
||||||
|
header.version = 3;
|
||||||
|
} else if (zeroed_grain) {
|
||||||
|
header.version = 2;
|
||||||
|
} else {
|
||||||
|
header.version = 1;
|
||||||
|
}
|
||||||
header.flags = VMDK4_FLAG_RGD | VMDK4_FLAG_NL_DETECT
|
header.flags = VMDK4_FLAG_RGD | VMDK4_FLAG_NL_DETECT
|
||||||
| (compress ? VMDK4_FLAG_COMPRESS | VMDK4_FLAG_MARKER : 0)
|
| (compress ? VMDK4_FLAG_COMPRESS | VMDK4_FLAG_MARKER : 0)
|
||||||
| (zeroed_grain ? VMDK4_FLAG_ZERO_GRAIN : 0);
|
| (zeroed_grain ? VMDK4_FLAG_ZERO_GRAIN : 0);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include <sys/stat.h>
|
#include "qemu/osdep.h"
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
* See the COPYING.LIB file in the top-level directory.
|
* See the COPYING.LIB file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/coroutine.h"
|
#include "qemu/coroutine.h"
|
||||||
#include "block/write-threshold.h"
|
#include "block/write-threshold.h"
|
||||||
|
@ -348,7 +348,8 @@ static bool check_throttle_config(ThrottleConfig *cfg, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!throttle_is_valid(cfg)) {
|
if (!throttle_is_valid(cfg)) {
|
||||||
error_setg(errp, "bps/iops/maxs values must be 0 or greater");
|
error_setg(errp, "bps/iops/max values must be within [0, %lld]",
|
||||||
|
THROTTLE_VALUE_MAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* later. See the COPYING file in the top-level directory.
|
* later. See the COPYING file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "sysemu/blockdev.h"
|
#include "sysemu/blockdev.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "hw/block/block.h"
|
#include "hw/block/block.h"
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
/* ??? Most of the ATAPI emulation is still in ide.c. It should be moved
|
/* ??? Most of the ATAPI emulation is still in ide.c. It should be moved
|
||||||
here. */
|
here. */
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "hw/scsi/scsi.h"
|
#include "hw/scsi/scsi.h"
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qemu/iov.h"
|
#include "qemu/iov.h"
|
||||||
#include "qemu/thread.h"
|
#include "qemu/thread.h"
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
* GNU GPL, version 2 or (at your option) any later version.
|
* GNU GPL, version 2 or (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/block/flash.h"
|
#include "hw/block/flash.h"
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* way. There are changes in DOR register and DMA is not available.
|
* way. There are changes in DOR register and DMA is not available.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/block/fdc.h"
|
#include "hw/block/fdc.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "hw/block/block.h"
|
#include "hw/block/block.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "sysemu/blockdev.h"
|
#include "sysemu/blockdev.h"
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
* -device nvme,drive=<drive_id>,serial=<serial>,id=<id[optional]>
|
* -device nvme,drive=<drive_id>,serial=<serial>,id=<id[optional]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include <hw/block/block.h>
|
#include <hw/block/block.h>
|
||||||
#include <hw/hw.h>
|
#include <hw/hw.h>
|
||||||
#include <hw/pci/msix.h>
|
#include <hw/pci/msix.h>
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/block/flash.h"
|
#include "hw/block/flash.h"
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
* It does not implement much more ...
|
* It does not implement much more ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/block/flash.h"
|
#include "hw/block/flash.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
* It does not implement multiple sectors erase
|
* It does not implement multiple sectors erase
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/block/flash.h"
|
#include "hw/block/flash.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "qemu/osdep.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/sh4/sh.h"
|
#include "hw/sh4/sh.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/iov.h"
|
#include "qemu/iov.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
@ -19,18 +19,8 @@
|
|||||||
* GNU GPL, version 2 or (at your option) any later version.
|
* GNU GPL, version 2 or (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "qemu/osdep.h"
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ typedef struct HDGeometry {
|
|||||||
#define BDRV_O_NO_BACKING 0x0100 /* don't open the backing file */
|
#define BDRV_O_NO_BACKING 0x0100 /* don't open the backing file */
|
||||||
#define BDRV_O_NO_FLUSH 0x0200 /* disable flushing on this disk */
|
#define BDRV_O_NO_FLUSH 0x0200 /* disable flushing on this disk */
|
||||||
#define BDRV_O_COPY_ON_READ 0x0400 /* copy read backing sectors into image */
|
#define BDRV_O_COPY_ON_READ 0x0400 /* copy read backing sectors into image */
|
||||||
#define BDRV_O_INCOMING 0x0800 /* consistency hint for incoming migration */
|
#define BDRV_O_INACTIVE 0x0800 /* consistency hint for migration handoff */
|
||||||
#define BDRV_O_CHECK 0x1000 /* open solely for consistency check */
|
#define BDRV_O_CHECK 0x1000 /* open solely for consistency check */
|
||||||
#define BDRV_O_ALLOW_RDWR 0x2000 /* allow reopen to change from r/o to r/w */
|
#define BDRV_O_ALLOW_RDWR 0x2000 /* allow reopen to change from r/o to r/w */
|
||||||
#define BDRV_O_UNMAP 0x4000 /* execute guest UNMAP/TRIM operations */
|
#define BDRV_O_UNMAP 0x4000 /* execute guest UNMAP/TRIM operations */
|
||||||
@ -369,6 +369,7 @@ BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs,
|
|||||||
/* Invalidate any cached metadata used by image formats */
|
/* Invalidate any cached metadata used by image formats */
|
||||||
void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp);
|
void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp);
|
||||||
void bdrv_invalidate_cache_all(Error **errp);
|
void bdrv_invalidate_cache_all(Error **errp);
|
||||||
|
int bdrv_inactivate_all(void);
|
||||||
|
|
||||||
/* Ensure contents are flushed to disk. */
|
/* Ensure contents are flushed to disk. */
|
||||||
int bdrv_flush(BlockDriverState *bs);
|
int bdrv_flush(BlockDriverState *bs);
|
||||||
|
@ -172,6 +172,7 @@ struct BlockDriver {
|
|||||||
* Invalidate any cached meta-data.
|
* Invalidate any cached meta-data.
|
||||||
*/
|
*/
|
||||||
void (*bdrv_invalidate_cache)(BlockDriverState *bs, Error **errp);
|
void (*bdrv_invalidate_cache)(BlockDriverState *bs, Error **errp);
|
||||||
|
int (*bdrv_inactivate)(BlockDriverState *bs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flushes all data that was already written to the OS all the way down to
|
* Flushes all data that was already written to the OS all the way down to
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
|
|
||||||
|
#define THROTTLE_VALUE_MAX 1000000000000000LL
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
THROTTLE_BPS_TOTAL,
|
THROTTLE_BPS_TOTAL,
|
||||||
THROTTLE_BPS_READ,
|
THROTTLE_BPS_READ,
|
||||||
|
@ -1422,7 +1422,11 @@ static int postcopy_start(MigrationState *ms, bool *old_vm_running)
|
|||||||
*old_vm_running = runstate_is_running();
|
*old_vm_running = runstate_is_running();
|
||||||
global_state_store();
|
global_state_store();
|
||||||
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
||||||
|
if (ret < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = bdrv_inactivate_all();
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -1541,6 +1545,9 @@ static void migration_completion(MigrationState *s, int current_active_state,
|
|||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
||||||
|
if (ret >= 0) {
|
||||||
|
ret = bdrv_inactivate_all();
|
||||||
|
}
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
qemu_file_set_rate_limit(s->file, INT64_MAX);
|
qemu_file_set_rate_limit(s->file, INT64_MAX);
|
||||||
qemu_savevm_state_complete_precopy(s->file, false);
|
qemu_savevm_state_complete_precopy(s->file, false);
|
||||||
|
@ -668,7 +668,7 @@ NBDExport *nbd_export_new(BlockBackend *blk, off_t dev_offset, off_t size,
|
|||||||
blk_add_aio_context_notifier(blk, blk_aio_attached, blk_aio_detach, exp);
|
blk_add_aio_context_notifier(blk, blk_aio_attached, blk_aio_detach, exp);
|
||||||
/*
|
/*
|
||||||
* NBD exports are used for non-shared storage migration. Make sure
|
* NBD exports are used for non-shared storage migration. Make sure
|
||||||
* that BDRV_O_INCOMING is cleared and the image is ready for write
|
* that BDRV_O_INACTIVE is cleared and the image is ready for write
|
||||||
* access since the export could be available before migration handover.
|
* access since the export could be available before migration handover.
|
||||||
*/
|
*/
|
||||||
blk_invalidate_cache(blk, NULL);
|
blk_invalidate_cache(blk, NULL);
|
||||||
|
47
qemu-img.c
47
qemu-img.c
@ -21,6 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qapi-visit.h"
|
#include "qapi-visit.h"
|
||||||
#include "qapi/qmp-output-visitor.h"
|
#include "qapi/qmp-output-visitor.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
#include "qapi/qmp/qerror.h"
|
||||||
@ -28,7 +29,6 @@
|
|||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/option.h"
|
#include "qemu/option.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/osdep.h"
|
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
@ -1071,28 +1071,50 @@ static int img_compare(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
int64_t status1, status2;
|
||||||
nb_sectors = sectors_to_process(total_sectors, sector_num);
|
nb_sectors = sectors_to_process(total_sectors, sector_num);
|
||||||
if (nb_sectors <= 0) {
|
if (nb_sectors <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
allocated1 = bdrv_is_allocated_above(bs1, NULL, sector_num, nb_sectors,
|
status1 = bdrv_get_block_status_above(bs1, NULL, sector_num,
|
||||||
&pnum1);
|
total_sectors1 - sector_num,
|
||||||
if (allocated1 < 0) {
|
&pnum1);
|
||||||
|
if (status1 < 0) {
|
||||||
ret = 3;
|
ret = 3;
|
||||||
error_report("Sector allocation test failed for %s", filename1);
|
error_report("Sector allocation test failed for %s", filename1);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
allocated1 = status1 & BDRV_BLOCK_ALLOCATED;
|
||||||
|
|
||||||
allocated2 = bdrv_is_allocated_above(bs2, NULL, sector_num, nb_sectors,
|
status2 = bdrv_get_block_status_above(bs2, NULL, sector_num,
|
||||||
&pnum2);
|
total_sectors2 - sector_num,
|
||||||
if (allocated2 < 0) {
|
&pnum2);
|
||||||
|
if (status2 < 0) {
|
||||||
ret = 3;
|
ret = 3;
|
||||||
error_report("Sector allocation test failed for %s", filename2);
|
error_report("Sector allocation test failed for %s", filename2);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
nb_sectors = MIN(pnum1, pnum2);
|
allocated2 = status2 & BDRV_BLOCK_ALLOCATED;
|
||||||
|
if (pnum1) {
|
||||||
|
nb_sectors = MIN(nb_sectors, pnum1);
|
||||||
|
}
|
||||||
|
if (pnum2) {
|
||||||
|
nb_sectors = MIN(nb_sectors, pnum2);
|
||||||
|
}
|
||||||
|
|
||||||
if (allocated1 == allocated2) {
|
if (strict) {
|
||||||
|
if ((status1 & ~BDRV_BLOCK_OFFSET_MASK) !=
|
||||||
|
(status2 & ~BDRV_BLOCK_OFFSET_MASK)) {
|
||||||
|
ret = 1;
|
||||||
|
qprintf(quiet, "Strict mode: Offset %" PRId64
|
||||||
|
" block status mismatch!\n",
|
||||||
|
sectors_to_bytes(sector_num));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((status1 & BDRV_BLOCK_ZERO) && (status2 & BDRV_BLOCK_ZERO)) {
|
||||||
|
nb_sectors = MIN(pnum1, pnum2);
|
||||||
|
} else if (allocated1 == allocated2) {
|
||||||
if (allocated1) {
|
if (allocated1) {
|
||||||
ret = blk_read(blk1, sector_num, buf1, nb_sectors);
|
ret = blk_read(blk1, sector_num, buf1, nb_sectors);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -1120,13 +1142,6 @@ static int img_compare(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (strict) {
|
|
||||||
ret = 1;
|
|
||||||
qprintf(quiet, "Strict mode: Offset %" PRId64
|
|
||||||
" allocation mismatch!\n",
|
|
||||||
sectors_to_bytes(sector_num));
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allocated1) {
|
if (allocated1) {
|
||||||
ret = check_empty_sectors(blk1, sector_num, nb_sectors,
|
ret = check_empty_sectors(blk1, sector_num, nb_sectors,
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
* See the COPYING file in the top-level directory.
|
* See the COPYING file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-io.h"
|
#include "qemu-io.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "block/block.h"
|
#include "block/block.h"
|
||||||
|
@ -7,10 +7,7 @@
|
|||||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||||
* See the COPYING file in the top-level directory.
|
* See the COPYING file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
#include <sys/time.h>
|
#include "qemu/osdep.h"
|
||||||
#include <sys/types.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
|
|
||||||
|
12
qmp.c
12
qmp.c
@ -192,6 +192,18 @@ void qmp_cont(Error **errp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Continuing after completed migration. Images have been inactivated to
|
||||||
|
* allow the destination to take control. Need to get control back now. */
|
||||||
|
if (runstate_check(RUN_STATE_FINISH_MIGRATE) ||
|
||||||
|
runstate_check(RUN_STATE_POSTMIGRATE))
|
||||||
|
{
|
||||||
|
bdrv_invalidate_cache_all(&local_err);
|
||||||
|
if (local_err) {
|
||||||
|
error_propagate(errp, local_err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (runstate_check(RUN_STATE_INMIGRATE)) {
|
if (runstate_check(RUN_STATE_INMIGRATE)) {
|
||||||
autostart = 1;
|
autostart = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -114,10 +114,12 @@ h=$QEMU_HANDLE
|
|||||||
QEMU_COMM_TIMEOUT=1
|
QEMU_COMM_TIMEOUT=1
|
||||||
|
|
||||||
# Silence output since it contains the disk image path and QEMU's readline
|
# Silence output since it contains the disk image path and QEMU's readline
|
||||||
# character echoing makes it very hard to filter the output
|
# character echoing makes it very hard to filter the output. Plus, there
|
||||||
|
# is no telling how many times the command will repeat before succeeding.
|
||||||
_send_qemu_cmd $h "drive_backup disk ${TEST_IMG}.copy" "(qemu)" >/dev/null
|
_send_qemu_cmd $h "drive_backup disk ${TEST_IMG}.copy" "(qemu)" >/dev/null
|
||||||
_send_qemu_cmd $h "" "Formatting" | _filter_img_create
|
_send_qemu_cmd $h "" "Formatting" | _filter_img_create
|
||||||
qemu_cmd_repeat=20 _send_qemu_cmd $h "info block-jobs" "No active jobs"
|
qemu_cmd_repeat=20 _send_qemu_cmd $h "info block-jobs" "No active jobs" >/dev/null
|
||||||
|
_send_qemu_cmd $h "info block-jobs" "No active jobs"
|
||||||
_send_qemu_cmd $h 'quit' ""
|
_send_qemu_cmd $h 'quit' ""
|
||||||
|
|
||||||
# Base image sectors
|
# Base image sectors
|
||||||
|
@ -469,10 +469,7 @@ No errors were found on the image.
|
|||||||
block-backup
|
block-backup
|
||||||
|
|
||||||
Formatting 'TEST_DIR/t.IMGFMT.copy', fmt=IMGFMT size=4294968832 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
|
Formatting 'TEST_DIR/t.IMGFMT.copy', fmt=IMGFMT size=4294968832 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
|
||||||
(qemu)
|
|
||||||
(qemu) i[K[Din[K[D[Dinf[K[D[D[Dinfo[K[D[D[D[Dinfo [K[D[D[D[D[Dinfo b[K[D[D[D[D[D[Dinfo bl[K[D[D[D[D[D[D[Dinfo blo[K[D[D[D[D[D[D[D[Dinfo bloc[K[D[D[D[D[D[D[D[D[Dinfo block[K[D[D[D[D[D[D[D[D[D[Dinfo block-[K[D[D[D[D[D[D[D[D[D[D[Dinfo block-j[K[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-jo[K[D[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-job[K[D[D[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-jobs[K
|
(qemu) i[K[Din[K[D[Dinf[K[D[D[Dinfo[K[D[D[D[Dinfo [K[D[D[D[D[Dinfo b[K[D[D[D[D[D[Dinfo bl[K[D[D[D[D[D[D[Dinfo blo[K[D[D[D[D[D[D[D[Dinfo bloc[K[D[D[D[D[D[D[D[D[Dinfo block[K[D[D[D[D[D[D[D[D[D[Dinfo block-[K[D[D[D[D[D[D[D[D[D[D[Dinfo block-j[K[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-jo[K[D[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-job[K[D[D[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-jobs[K
|
||||||
Type backup, device disk: Completed 0 of 4294968832 bytes, speed limit 0 bytes/s
|
|
||||||
i[K[Din[K[D[Dinf[K[D[D[Dinfo[K[D[D[D[Dinfo [K[D[D[D[D[Dinfo b[K[D[D[D[D[D[Dinfo bl[K[D[D[D[D[D[D[Dinfo blo[K[D[D[D[D[D[D[D[Dinfo bloc[K[D[D[D[D[D[D[D[D[Dinfo block[K[D[D[D[D[D[D[D[D[D[Dinfo block-[K[D[D[D[D[D[D[D[D[D[D[Dinfo block-j[K[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-jo[K[D[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-job[K[D[D[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-jobs[K
|
|
||||||
No active jobs
|
No active jobs
|
||||||
=== IO: pattern 195
|
=== IO: pattern 195
|
||||||
read 512/512 bytes at offset 3221194240
|
read 512/512 bytes at offset 3221194240
|
||||||
|
@ -52,11 +52,6 @@ autoclear_features 0x0
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 72
|
header_length 72
|
||||||
|
|
||||||
Header extension:
|
|
||||||
magic 0x6803f857
|
|
||||||
length 144
|
|
||||||
data <binary>
|
|
||||||
|
|
||||||
Header extension:
|
Header extension:
|
||||||
magic 0x12345678
|
magic 0x12345678
|
||||||
length 31
|
length 31
|
||||||
@ -68,7 +63,7 @@ No errors were found on the image.
|
|||||||
|
|
||||||
magic 0x514649fb
|
magic 0x514649fb
|
||||||
version 2
|
version 2
|
||||||
backing_file_offset 0x128
|
backing_file_offset 0x90
|
||||||
backing_file_size 0x17
|
backing_file_size 0x17
|
||||||
cluster_bits 16
|
cluster_bits 16
|
||||||
size 67108864
|
size 67108864
|
||||||
@ -90,11 +85,6 @@ magic 0xe2792aca
|
|||||||
length 11
|
length 11
|
||||||
data 'host_device'
|
data 'host_device'
|
||||||
|
|
||||||
Header extension:
|
|
||||||
magic 0x6803f857
|
|
||||||
length 144
|
|
||||||
data <binary>
|
|
||||||
|
|
||||||
Header extension:
|
Header extension:
|
||||||
magic 0x12345678
|
magic 0x12345678
|
||||||
length 31
|
length 31
|
||||||
@ -125,6 +115,11 @@ autoclear_features 0x0
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 104
|
header_length 104
|
||||||
|
|
||||||
|
Header extension:
|
||||||
|
magic 0x6803f857
|
||||||
|
length 144
|
||||||
|
data <binary>
|
||||||
|
|
||||||
Header extension:
|
Header extension:
|
||||||
magic 0x12345678
|
magic 0x12345678
|
||||||
length 31
|
length 31
|
||||||
|
@ -57,6 +57,7 @@ _make_test_img 64M
|
|||||||
$PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 63
|
$PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 63
|
||||||
|
|
||||||
# Without feature table
|
# Without feature table
|
||||||
|
$PYTHON qcow2.py "$TEST_IMG" del-header-ext 0x6803f857
|
||||||
$PYTHON qcow2.py "$TEST_IMG" dump-header
|
$PYTHON qcow2.py "$TEST_IMG" dump-header
|
||||||
_img_info
|
_img_info
|
||||||
|
|
||||||
@ -73,6 +74,7 @@ $PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 62
|
|||||||
$PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 63
|
$PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 63
|
||||||
|
|
||||||
# Without feature table
|
# Without feature table
|
||||||
|
$PYTHON qcow2.py "$TEST_IMG" del-header-ext 0x6803f857
|
||||||
_img_info
|
_img_info
|
||||||
|
|
||||||
# With feature table containing bit 63
|
# With feature table containing bit 63
|
||||||
|
@ -56,6 +56,11 @@ autoclear_features 0x8000000000000000
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 104
|
header_length 104
|
||||||
|
|
||||||
|
Header extension:
|
||||||
|
magic 0x6803f857
|
||||||
|
length 144
|
||||||
|
data <binary>
|
||||||
|
|
||||||
|
|
||||||
=== Repair image ===
|
=== Repair image ===
|
||||||
|
|
||||||
|
@ -262,6 +262,24 @@ run_qemu -drive file="$TEST_IMG",bps_wr_max=1234,throttling.bps-write-max=5678
|
|||||||
run_qemu -drive file="$TEST_IMG",iops_size=1234,throttling.iops-size=5678
|
run_qemu -drive file="$TEST_IMG",iops_size=1234,throttling.iops-size=5678
|
||||||
run_qemu -drive file="$TEST_IMG",readonly=on,read-only=off
|
run_qemu -drive file="$TEST_IMG",readonly=on,read-only=off
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo === Catching negative/large throttling values ===
|
||||||
|
echo
|
||||||
|
|
||||||
|
run_qemu -drive file="$TEST_IMG",iops=-1
|
||||||
|
run_qemu -drive file="$TEST_IMG",bps=-2
|
||||||
|
run_qemu -drive file="$TEST_IMG",bps_rd=-3
|
||||||
|
run_qemu -drive file="$TEST_IMG",bps_rd_max=-3
|
||||||
|
run_qemu -drive file="$TEST_IMG",throttling.iops-total=-4
|
||||||
|
run_qemu -drive file="$TEST_IMG",throttling.bps-total=-5
|
||||||
|
# These are accepted
|
||||||
|
run_qemu -drive file="$TEST_IMG",bps=0
|
||||||
|
run_qemu -drive file="$TEST_IMG",bps=1
|
||||||
|
run_qemu -drive file="$TEST_IMG",bps=1000000000000000
|
||||||
|
# While these are not
|
||||||
|
run_qemu -drive file="$TEST_IMG",bps=1000000000000001
|
||||||
|
run_qemu -drive file="$TEST_IMG",bps=9999999999999999
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo === Parsing protocol from file name ===
|
echo === Parsing protocol from file name ===
|
||||||
echo
|
echo
|
||||||
|
@ -285,6 +285,45 @@ Testing: -drive file=TEST_DIR/t.qcow2,readonly=on,read-only=off
|
|||||||
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,readonly=on,read-only=off: 'read-only' and its alias 'readonly' can't be used at the same time
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,readonly=on,read-only=off: 'read-only' and its alias 'readonly' can't be used at the same time
|
||||||
|
|
||||||
|
|
||||||
|
=== Catching negative/large throttling values ===
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,iops=-1
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,iops=-1: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=-2
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=-2: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps_rd=-3
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps_rd=-3: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps_rd_max=-3
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps_rd_max=-3: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,throttling.iops-total=-4
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,throttling.iops-total=-4: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=0
|
||||||
|
QEMU X.Y.Z monitor - type 'help' for more information
|
||||||
|
(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=1
|
||||||
|
QEMU X.Y.Z monitor - type 'help' for more information
|
||||||
|
(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000000
|
||||||
|
QEMU X.Y.Z monitor - type 'help' for more information
|
||||||
|
(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=9999999999999999
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=9999999999999999: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
|
||||||
=== Parsing protocol from file name ===
|
=== Parsing protocol from file name ===
|
||||||
|
|
||||||
Testing: -hda foo:bar
|
Testing: -hda foo:bar
|
||||||
|
@ -379,6 +379,45 @@ Testing: -drive file=TEST_DIR/t.qcow2,readonly=on,read-only=off
|
|||||||
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,readonly=on,read-only=off: 'read-only' and its alias 'readonly' can't be used at the same time
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,readonly=on,read-only=off: 'read-only' and its alias 'readonly' can't be used at the same time
|
||||||
|
|
||||||
|
|
||||||
|
=== Catching negative/large throttling values ===
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,iops=-1
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,iops=-1: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=-2
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=-2: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps_rd=-3
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps_rd=-3: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps_rd_max=-3
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps_rd_max=-3: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,throttling.iops-total=-4
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,throttling.iops-total=-4: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=0
|
||||||
|
QEMU X.Y.Z monitor - type 'help' for more information
|
||||||
|
(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=1
|
||||||
|
QEMU X.Y.Z monitor - type 'help' for more information
|
||||||
|
(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000000
|
||||||
|
QEMU X.Y.Z monitor - type 'help' for more information
|
||||||
|
(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
Testing: -drive file=TEST_DIR/t.qcow2,bps=9999999999999999
|
||||||
|
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=9999999999999999: bps/iops/max values must be within [0, 1000000000000000]
|
||||||
|
|
||||||
|
|
||||||
=== Parsing protocol from file name ===
|
=== Parsing protocol from file name ===
|
||||||
|
|
||||||
Testing: -hda foo:bar
|
Testing: -hda foo:bar
|
||||||
|
@ -24,6 +24,11 @@ autoclear_features 0x0
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 104
|
header_length 104
|
||||||
|
|
||||||
|
Header extension:
|
||||||
|
magic 0x6803f857
|
||||||
|
length 144
|
||||||
|
data <binary>
|
||||||
|
|
||||||
magic 0x514649fb
|
magic 0x514649fb
|
||||||
version 2
|
version 2
|
||||||
backing_file_offset 0x0
|
backing_file_offset 0x0
|
||||||
@ -43,11 +48,6 @@ autoclear_features 0x0
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 72
|
header_length 72
|
||||||
|
|
||||||
Header extension:
|
|
||||||
magic 0x6803f857
|
|
||||||
length 144
|
|
||||||
data <binary>
|
|
||||||
|
|
||||||
read 131072/131072 bytes at offset 0
|
read 131072/131072 bytes at offset 0
|
||||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||||
No errors were found on the image.
|
No errors were found on the image.
|
||||||
@ -81,6 +81,11 @@ autoclear_features 0x0
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 104
|
header_length 104
|
||||||
|
|
||||||
|
Header extension:
|
||||||
|
magic 0x6803f857
|
||||||
|
length 144
|
||||||
|
data <binary>
|
||||||
|
|
||||||
ERROR cluster 5 refcount=0 reference=1
|
ERROR cluster 5 refcount=0 reference=1
|
||||||
ERROR cluster 6 refcount=0 reference=1
|
ERROR cluster 6 refcount=0 reference=1
|
||||||
Rebuilding refcount structure
|
Rebuilding refcount structure
|
||||||
@ -105,11 +110,6 @@ autoclear_features 0x0
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 72
|
header_length 72
|
||||||
|
|
||||||
Header extension:
|
|
||||||
magic 0x6803f857
|
|
||||||
length 144
|
|
||||||
data <binary>
|
|
||||||
|
|
||||||
read 131072/131072 bytes at offset 0
|
read 131072/131072 bytes at offset 0
|
||||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||||
No errors were found on the image.
|
No errors were found on the image.
|
||||||
@ -136,6 +136,11 @@ autoclear_features 0x40000000000
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 104
|
header_length 104
|
||||||
|
|
||||||
|
Header extension:
|
||||||
|
magic 0x6803f857
|
||||||
|
length 144
|
||||||
|
data <binary>
|
||||||
|
|
||||||
magic 0x514649fb
|
magic 0x514649fb
|
||||||
version 2
|
version 2
|
||||||
backing_file_offset 0x0
|
backing_file_offset 0x0
|
||||||
@ -155,11 +160,6 @@ autoclear_features 0x0
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 72
|
header_length 72
|
||||||
|
|
||||||
Header extension:
|
|
||||||
magic 0x6803f857
|
|
||||||
length 144
|
|
||||||
data <binary>
|
|
||||||
|
|
||||||
No errors were found on the image.
|
No errors were found on the image.
|
||||||
|
|
||||||
=== Testing version upgrade and resize ===
|
=== Testing version upgrade and resize ===
|
||||||
@ -243,6 +243,11 @@ autoclear_features 0x0
|
|||||||
refcount_order 4
|
refcount_order 4
|
||||||
header_length 104
|
header_length 104
|
||||||
|
|
||||||
|
Header extension:
|
||||||
|
magic 0x6803f857
|
||||||
|
length 144
|
||||||
|
data <binary>
|
||||||
|
|
||||||
ERROR cluster 5 refcount=0 reference=1
|
ERROR cluster 5 refcount=0 reference=1
|
||||||
ERROR cluster 6 refcount=0 reference=1
|
ERROR cluster 6 refcount=0 reference=1
|
||||||
Rebuilding refcount structure
|
Rebuilding refcount structure
|
||||||
|
@ -282,22 +282,18 @@ bool throttle_conflicting(ThrottleConfig *cfg)
|
|||||||
*/
|
*/
|
||||||
bool throttle_is_valid(ThrottleConfig *cfg)
|
bool throttle_is_valid(ThrottleConfig *cfg)
|
||||||
{
|
{
|
||||||
bool invalid = false;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < BUCKETS_COUNT; i++) {
|
for (i = 0; i < BUCKETS_COUNT; i++) {
|
||||||
if (cfg->buckets[i].avg < 0) {
|
if (cfg->buckets[i].avg < 0 ||
|
||||||
invalid = true;
|
cfg->buckets[i].max < 0 ||
|
||||||
|
cfg->buckets[i].avg > THROTTLE_VALUE_MAX ||
|
||||||
|
cfg->buckets[i].max > THROTTLE_VALUE_MAX) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < BUCKETS_COUNT; i++) {
|
return true;
|
||||||
if (cfg->buckets[i].max < 0) {
|
|
||||||
invalid = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return !invalid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if bps_max/iops_max is used without bps/iops
|
/* check if bps_max/iops_max is used without bps/iops
|
||||||
|
Loading…
Reference in New Issue
Block a user