qcow2.c (b527c9b392a87abff698ca435da0dfa2bd6324a2) | qcow2.c (04c01a5c8f006b6e45fa5be8ea857efe7d9c41f9) |
---|---|
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 --- 1127 unchanged lines hidden (view full) --- 1136 1137 ret = qcow2_read_snapshots(bs); 1138 if (ret < 0) { 1139 error_setg_errno(errp, -ret, "Could not read snapshots"); 1140 goto fail; 1141 } 1142 1143 /* Clear unknown autoclear feature bits */ | 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 --- 1127 unchanged lines hidden (view full) --- 1136 1137 ret = qcow2_read_snapshots(bs); 1138 if (ret < 0) { 1139 error_setg_errno(errp, -ret, "Could not read snapshots"); 1140 goto fail; 1141 } 1142 1143 /* Clear unknown autoclear feature bits */ |
1144 if (!bs->read_only && !(flags & BDRV_O_INCOMING) && s->autoclear_features) { | 1144 if (!bs->read_only && !(flags & BDRV_O_INACTIVE) && s->autoclear_features) { |
1145 s->autoclear_features = 0; 1146 ret = qcow2_update_header(bs); 1147 if (ret < 0) { 1148 error_setg_errno(errp, -ret, "Could not update qcow2 header"); 1149 goto fail; 1150 } 1151 } 1152 1153 /* Initialise locks */ 1154 qemu_co_mutex_init(&s->lock); 1155 1156 /* Repair image if dirty */ | 1145 s->autoclear_features = 0; 1146 ret = qcow2_update_header(bs); 1147 if (ret < 0) { 1148 error_setg_errno(errp, -ret, "Could not update qcow2 header"); 1149 goto fail; 1150 } 1151 } 1152 1153 /* Initialise locks */ 1154 qemu_co_mutex_init(&s->lock); 1155 1156 /* Repair image if dirty */ |
1157 if (!(flags & (BDRV_O_CHECK | BDRV_O_INCOMING)) && !bs->read_only && | 1157 if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only && |
1158 (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { 1159 BdrvCheckResult result = {0}; 1160 1161 ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS); 1162 if (ret < 0) { 1163 error_setg_errno(errp, -ret, "Could not repair dirty image"); 1164 goto fail; 1165 } --- 522 unchanged lines hidden (view full) --- 1688 1689static void qcow2_close(BlockDriverState *bs) 1690{ 1691 BDRVQcow2State *s = bs->opaque; 1692 qemu_vfree(s->l1_table); 1693 /* else pre-write overlap checks in cache_destroy may crash */ 1694 s->l1_table = NULL; 1695 | 1158 (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { 1159 BdrvCheckResult result = {0}; 1160 1161 ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS); 1162 if (ret < 0) { 1163 error_setg_errno(errp, -ret, "Could not repair dirty image"); 1164 goto fail; 1165 } --- 522 unchanged lines hidden (view full) --- 1688 1689static void qcow2_close(BlockDriverState *bs) 1690{ 1691 BDRVQcow2State *s = bs->opaque; 1692 qemu_vfree(s->l1_table); 1693 /* else pre-write overlap checks in cache_destroy may crash */ 1694 s->l1_table = NULL; 1695 |
1696 if (!(bs->open_flags & BDRV_O_INCOMING)) { | 1696 if (!(bs->open_flags & BDRV_O_INACTIVE)) { |
1697 int ret1, ret2; 1698 1699 ret1 = qcow2_cache_flush(bs, s->l2_table_cache); 1700 ret2 = qcow2_cache_flush(bs, s->refcount_block_cache); 1701 1702 if (ret1) { 1703 error_report("Failed to flush the L2 table cache: %s", 1704 strerror(-ret1)); --- 1653 unchanged lines hidden --- | 1697 int ret1, ret2; 1698 1699 ret1 = qcow2_cache_flush(bs, s->l2_table_cache); 1700 ret2 = qcow2_cache_flush(bs, s->refcount_block_cache); 1701 1702 if (ret1) { 1703 error_report("Failed to flush the L2 table cache: %s", 1704 strerror(-ret1)); --- 1653 unchanged lines hidden --- |