qcow2.c (d874bc081600528f0400977460b4f98f21e156a1) qcow2.c (307261b243df2edde538f3ed5c9d80e168529355)
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

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

1718 ret = qcow2_read_snapshots(bs, errp);
1719 if (ret < 0) {
1720 goto fail;
1721 }
1722 }
1723
1724 /* Clear unknown autoclear feature bits */
1725 update_header |= s->autoclear_features & ~QCOW2_AUTOCLEAR_MASK;
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

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

1718 ret = qcow2_read_snapshots(bs, errp);
1719 if (ret < 0) {
1720 goto fail;
1721 }
1722 }
1723
1724 /* Clear unknown autoclear feature bits */
1725 update_header |= s->autoclear_features & ~QCOW2_AUTOCLEAR_MASK;
1726 update_header =
1727 update_header && !bs->read_only && !(flags & BDRV_O_INACTIVE);
1726 update_header = update_header && bdrv_is_writable(bs);
1728 if (update_header) {
1729 s->autoclear_features &= QCOW2_AUTOCLEAR_MASK;
1730 }
1731
1732 /* == Handle persistent dirty bitmaps ==
1733 *
1734 * We want load dirty bitmaps in three cases:
1735 *

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

1806 }
1807 }
1808
1809 bs->supported_zero_flags = header.version >= 3 ?
1810 BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK : 0;
1811 bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
1812
1813 /* Repair image if dirty */
1727 if (update_header) {
1728 s->autoclear_features &= QCOW2_AUTOCLEAR_MASK;
1729 }
1730
1731 /* == Handle persistent dirty bitmaps ==
1732 *
1733 * We want load dirty bitmaps in three cases:
1734 *

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

1805 }
1806 }
1807
1808 bs->supported_zero_flags = header.version >= 3 ?
1809 BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK : 0;
1810 bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
1811
1812 /* Repair image if dirty */
1814 if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only &&
1813 if (!(flags & BDRV_O_CHECK) && bdrv_is_writable(bs) &&
1815 (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {
1816 BdrvCheckResult result = {0};
1817
1818 ret = qcow2_co_check_locked(bs, &result,
1819 BDRV_FIX_ERRORS | BDRV_FIX_LEAKS);
1820 if (ret < 0 || result.check_errors) {
1821 if (ret >= 0) {
1822 ret = -EIO;

--- 4158 unchanged lines hidden ---
1814 (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {
1815 BdrvCheckResult result = {0};
1816
1817 ret = qcow2_co_check_locked(bs, &result,
1818 BDRV_FIX_ERRORS | BDRV_FIX_LEAKS);
1819 if (ret < 0 || result.check_errors) {
1820 if (ret >= 0) {
1821 ret = -EIO;

--- 4158 unchanged lines hidden ---