qcow2.c (1fafcd93681c5370ecf899e096a58642fa68a292) qcow2.c (2b148f392b2bfeba76d3e6d9607c3bd072350e8c)
1/*
2 * Block driver for the QCOW version 2 format
3 *
4 * Copyright (c) 2004-2006 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 2128 unchanged lines hidden (view full) ---

2137 g_free(s->image_backing_format);
2138
2139 g_free(s->cluster_cache);
2140 qemu_vfree(s->cluster_data);
2141 qcow2_refcount_close(bs);
2142 qcow2_free_snapshots(bs);
2143}
2144
1/*
2 * Block driver for the QCOW version 2 format
3 *
4 * Copyright (c) 2004-2006 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 2128 unchanged lines hidden (view full) ---

2137 g_free(s->image_backing_format);
2138
2139 g_free(s->cluster_cache);
2140 qemu_vfree(s->cluster_data);
2141 qcow2_refcount_close(bs);
2142 qcow2_free_snapshots(bs);
2143}
2144
2145static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
2145static void coroutine_fn qcow2_co_invalidate_cache(BlockDriverState *bs,
2146 Error **errp)
2146{
2147 BDRVQcow2State *s = bs->opaque;
2148 int flags = s->flags;
2149 QCryptoBlock *crypto = NULL;
2150 QDict *options;
2151 Error *local_err = NULL;
2152 int ret;
2153

--- 6 unchanged lines hidden (view full) ---

2160 s->crypto = NULL;
2161
2162 qcow2_close(bs);
2163
2164 memset(s, 0, sizeof(BDRVQcow2State));
2165 options = qdict_clone_shallow(bs->options);
2166
2167 flags &= ~BDRV_O_INACTIVE;
2147{
2148 BDRVQcow2State *s = bs->opaque;
2149 int flags = s->flags;
2150 QCryptoBlock *crypto = NULL;
2151 QDict *options;
2152 Error *local_err = NULL;
2153 int ret;
2154

--- 6 unchanged lines hidden (view full) ---

2161 s->crypto = NULL;
2162
2163 qcow2_close(bs);
2164
2165 memset(s, 0, sizeof(BDRVQcow2State));
2166 options = qdict_clone_shallow(bs->options);
2167
2168 flags &= ~BDRV_O_INACTIVE;
2169 qemu_co_mutex_lock(&s->lock);
2168 ret = qcow2_do_open(bs, options, flags, &local_err);
2170 ret = qcow2_do_open(bs, options, flags, &local_err);
2171 qemu_co_mutex_unlock(&s->lock);
2169 QDECREF(options);
2170 if (local_err) {
2171 error_propagate(errp, local_err);
2172 error_prepend(errp, "Could not reopen qcow2 layer: ");
2173 bs->drv = NULL;
2174 return;
2175 } else if (ret < 0) {
2176 error_setg_errno(errp, -ret, "Could not reopen qcow2 layer");

--- 2224 unchanged lines hidden (view full) ---

4401
4402 .bdrv_save_vmstate = qcow2_save_vmstate,
4403 .bdrv_load_vmstate = qcow2_load_vmstate,
4404
4405 .supports_backing = true,
4406 .bdrv_change_backing_file = qcow2_change_backing_file,
4407
4408 .bdrv_refresh_limits = qcow2_refresh_limits,
2172 QDECREF(options);
2173 if (local_err) {
2174 error_propagate(errp, local_err);
2175 error_prepend(errp, "Could not reopen qcow2 layer: ");
2176 bs->drv = NULL;
2177 return;
2178 } else if (ret < 0) {
2179 error_setg_errno(errp, -ret, "Could not reopen qcow2 layer");

--- 2224 unchanged lines hidden (view full) ---

4404
4405 .bdrv_save_vmstate = qcow2_save_vmstate,
4406 .bdrv_load_vmstate = qcow2_load_vmstate,
4407
4408 .supports_backing = true,
4409 .bdrv_change_backing_file = qcow2_change_backing_file,
4410
4411 .bdrv_refresh_limits = qcow2_refresh_limits,
4409 .bdrv_invalidate_cache = qcow2_invalidate_cache,
4412 .bdrv_co_invalidate_cache = qcow2_co_invalidate_cache,
4410 .bdrv_inactivate = qcow2_inactivate,
4411
4412 .create_opts = &qcow2_create_opts,
4413 .bdrv_check = qcow2_check,
4414 .bdrv_amend_options = qcow2_amend_options,
4415
4416 .bdrv_detach_aio_context = qcow2_detach_aio_context,
4417 .bdrv_attach_aio_context = qcow2_attach_aio_context,

--- 12 unchanged lines hidden ---
4413 .bdrv_inactivate = qcow2_inactivate,
4414
4415 .create_opts = &qcow2_create_opts,
4416 .bdrv_check = qcow2_check,
4417 .bdrv_amend_options = qcow2_amend_options,
4418
4419 .bdrv_detach_aio_context = qcow2_detach_aio_context,
4420 .bdrv_attach_aio_context = qcow2_attach_aio_context,

--- 12 unchanged lines hidden ---