qed.c (80c71a241ae3cd3b89527865ba730b2fa1f9e46f) qed.c (04c01a5c8f006b6e45fa5be8ea857efe7d9c41f9)
1/*
2 * QEMU Enhanced Disk Format
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
8 * Anthony Liguori <aliguori@us.ibm.com>

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

473
474 /* Reset unknown autoclear feature bits. This is a backwards
475 * compatibility mechanism that allows images to be opened by older
476 * programs, which "knock out" unknown feature bits. When an image is
477 * opened by a newer program again it can detect that the autoclear
478 * feature is no longer valid.
479 */
480 if ((s->header.autoclear_features & ~QED_AUTOCLEAR_FEATURE_MASK) != 0 &&
1/*
2 * QEMU Enhanced Disk Format
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
8 * Anthony Liguori <aliguori@us.ibm.com>

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

473
474 /* Reset unknown autoclear feature bits. This is a backwards
475 * compatibility mechanism that allows images to be opened by older
476 * programs, which "knock out" unknown feature bits. When an image is
477 * opened by a newer program again it can detect that the autoclear
478 * feature is no longer valid.
479 */
480 if ((s->header.autoclear_features & ~QED_AUTOCLEAR_FEATURE_MASK) != 0 &&
481 !bdrv_is_read_only(bs->file->bs) && !(flags & BDRV_O_INCOMING)) {
481 !bdrv_is_read_only(bs->file->bs) && !(flags & BDRV_O_INACTIVE)) {
482 s->header.autoclear_features &= QED_AUTOCLEAR_FEATURE_MASK;
483
484 ret = qed_write_header_sync(s);
485 if (ret) {
486 return ret;
487 }
488
489 /* From here on only known autoclear feature bits are valid */

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

501 /* If image was not closed cleanly, check consistency */
502 if (!(flags & BDRV_O_CHECK) && (s->header.features & QED_F_NEED_CHECK)) {
503 /* Read-only images cannot be fixed. There is no risk of corruption
504 * since write operations are not possible. Therefore, allow
505 * potentially inconsistent images to be opened read-only. This can
506 * aid data recovery from an otherwise inconsistent image.
507 */
508 if (!bdrv_is_read_only(bs->file->bs) &&
482 s->header.autoclear_features &= QED_AUTOCLEAR_FEATURE_MASK;
483
484 ret = qed_write_header_sync(s);
485 if (ret) {
486 return ret;
487 }
488
489 /* From here on only known autoclear feature bits are valid */

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

501 /* If image was not closed cleanly, check consistency */
502 if (!(flags & BDRV_O_CHECK) && (s->header.features & QED_F_NEED_CHECK)) {
503 /* Read-only images cannot be fixed. There is no risk of corruption
504 * since write operations are not possible. Therefore, allow
505 * potentially inconsistent images to be opened read-only. This can
506 * aid data recovery from an otherwise inconsistent image.
507 */
508 if (!bdrv_is_read_only(bs->file->bs) &&
509 !(flags & BDRV_O_INCOMING)) {
509 !(flags & BDRV_O_INACTIVE)) {
510 BdrvCheckResult result = {0};
511
512 ret = qed_check(s, &result, true);
513 if (ret) {
514 goto out;
515 }
516 }
517 }

--- 1182 unchanged lines hidden ---
510 BdrvCheckResult result = {0};
511
512 ret = qed_check(s, &result, true);
513 if (ret) {
514 goto out;
515 }
516 }
517 }

--- 1182 unchanged lines hidden ---