cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
958e1b
From c21689e9b457b3790a5d0294c2815f2df561dece Mon Sep 17 00:00:00 2001
958e1b
Message-Id: <c21689e9b457b3790a5d0294c2815f2df561dece.1420654015.git.jen@redhat.com>
958e1b
From: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
Date: Thu, 18 Dec 2014 11:11:06 -0600
958e1b
Subject: [CHANGE] block: delete cow block driver
958e1b
To: rhvirt-patches@redhat.com,
958e1b
    jen@redhat.com
958e1b
958e1b
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
Message-id: <1418901066-25891-1-git-send-email-stefanha@redhat.com>
958e1b
Patchwork-id: 62969
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH RESEND] block: delete cow block driver
958e1b
Bugzilla: 1175325
958e1b
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
958e1b
RH-Acked-by: Fam Zheng <famz@redhat.com>
958e1b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
958e1b
958e1b
This patch removes support for the cow file format.
958e1b
958e1b
Normally we do not break backwards compatibility but in this case there
958e1b
is no impact and it is the most logical option.  Extraordinary claims
958e1b
require extraordinary evidence so I will show why removing the cow block
958e1b
driver is the right thing to do.
958e1b
958e1b
The cow file format is the disk image format for Usermode Linux, a way
958e1b
of running a Linux system in userspace.  The performance of UML was
958e1b
never great and it was hacky, but it enjoyed some popularity before
958e1b
hardware virtualization support became mainstream.
958e1b
958e1b
QEMU's block/cow.c is supposed to read this image file format.
958e1b
Unfortunately the file format was underspecified:
958e1b
958e1b
1. Earlier Linux versions used the MAXPATHLEN constant for the backing
958e1b
   filename field.  The value of MAXPATHLEN can change, so Linux
958e1b
   switched to a 4096 literal but QEMU has a 1024 literal.
958e1b
958e1b
2. Padding was not used on the header struct (both in the Linux kernel
958e1b
   and in QEMU) so the struct layout varied across architectures.  In
958e1b
   particular, i386 and x86_64 were different due to int64_t alignment
958e1b
   differences.  Linux now uses __attribute__((packed)), QEMU does not.
958e1b
958e1b
Therefore:
958e1b
958e1b
1. QEMU cow images do not conform to the Linux cow image file format.
958e1b
958e1b
2. cow images cannot be shared between different host architectures.
958e1b
958e1b
This means QEMU cow images are useless and QEMU has not had bug reports
958e1b
from users actually hitting these issues.
958e1b
958e1b
Let's get rid of this thing, it serves no purpose and no one will be
958e1b
affected.
958e1b
958e1b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
Reviewed-by: Markus Armbruster <armbru@redhat.com>
958e1b
Message-id: 1410877464-20481-1-git-send-email-stefanha@redhat.com
958e1b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
(cherry picked from commit 550830f9351291c585c963204ad9127998b1c1ce)
958e1b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
Signed-off-by: Jeff E. Nelson <jen@redhat.com>
958e1b
958e1b
Conflicts:
958e1b
	block/Makefile.objs
958e1b
958e1b
Context conflict, easy to resolve.
958e1b
958e1b
	block/cow.c
958e1b
958e1b
No problem, we're deleting this file anyway.
958e1b
958e1b
	qapi/block-core.json
958e1b
958e1b
Downstream still uses qapi-schema.json.
958e1b
958e1b
	tests/image-fuzzer/runner.py
958e1b
958e1b
Not present downstream, skip it.
958e1b
958e1b
	tests/qemu-iotests/069
958e1b
958e1b
Context conflict, easy to resolve.
958e1b
958e1b
	tests/qemu-iotests/072
958e1b
	tests/qemu-iotests/099
958e1b
958e1b
Not present downstream, skip these tests.
958e1b
958e1b
	ui/cocoa.m
958e1b
958e1b
We just want to drop "cow", the context conflict does not matter.
958e1b
958e1b
Signed-off-by: Jeff E. Nelson <jen@redhat.com>
958e1b
---
958e1b
 block/Makefile.objs       |   2 +-
958e1b
 block/cow.c               | 402 ----------------------------------------------
958e1b
 qapi-schema.json          |   2 +-
958e1b
 qemu-doc.texi             |   9 --
958e1b
 qemu-img.texi             |   4 +-
958e1b
 qmp-commands.hx           |   2 +-
958e1b
 tests/qemu-iotests/069    |   2 +-
958e1b
 tests/qemu-iotests/common |   6 -
958e1b
 ui/cocoa.m                |   2 +-
958e1b
 9 files changed, 7 insertions(+), 424 deletions(-)
958e1b
 delete mode 100644 block/cow.c
958e1b
958e1b
diff --git a/block/Makefile.objs b/block/Makefile.objs
958e1b
index 0be180f..ebc350b 100644
958e1b
--- a/block/Makefile.objs
958e1b
+++ b/block/Makefile.objs
958e1b
@@ -1,4 +1,4 @@
958e1b
-block-obj-y += raw.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
958e1b
+block-obj-y += raw.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
958e1b
 block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o
958e1b
 block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
958e1b
 block-obj-y += qed-check.o
958e1b
diff --git a/block/cow.c b/block/cow.c
958e1b
deleted file mode 100644
958e1b
index c75668b..0000000
958e1b
--- a/block/cow.c
958e1b
+++ /dev/null
958e1b
@@ -1,402 +0,0 @@
958e1b
-/*
958e1b
- * Block driver for the COW format
958e1b
- *
958e1b
- * Copyright (c) 2004 Fabrice Bellard
958e1b
- *
958e1b
- * Permission is hereby granted, free of charge, to any person obtaining a copy
958e1b
- * of this software and associated documentation files (the "Software"), to deal
958e1b
- * in the Software without restriction, including without limitation the rights
958e1b
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
958e1b
- * copies of the Software, and to permit persons to whom the Software is
958e1b
- * furnished to do so, subject to the following conditions:
958e1b
- *
958e1b
- * The above copyright notice and this permission notice shall be included in
958e1b
- * all copies or substantial portions of the Software.
958e1b
- *
958e1b
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
958e1b
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
958e1b
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
958e1b
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
958e1b
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
958e1b
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
958e1b
- * THE SOFTWARE.
958e1b
- */
958e1b
-#include "qemu-common.h"
958e1b
-#include "block/block_int.h"
958e1b
-#include "qemu/module.h"
958e1b
-
958e1b
-/**************************************************************/
958e1b
-/* COW block driver using file system holes */
958e1b
-
958e1b
-/* user mode linux compatible COW file */
958e1b
-#define COW_MAGIC 0x4f4f4f4d  /* MOOO */
958e1b
-#define COW_VERSION 2
958e1b
-
958e1b
-struct cow_header_v2 {
958e1b
-    uint32_t magic;
958e1b
-    uint32_t version;
958e1b
-    char backing_file[1024];
958e1b
-    int32_t mtime;
958e1b
-    uint64_t size;
958e1b
-    uint32_t sectorsize;
958e1b
-};
958e1b
-
958e1b
-typedef struct BDRVCowState {
958e1b
-    CoMutex lock;
958e1b
-    int64_t cow_sectors_offset;
958e1b
-} BDRVCowState;
958e1b
-
958e1b
-static int cow_probe(const uint8_t *buf, int buf_size, const char *filename)
958e1b
-{
958e1b
-    const struct cow_header_v2 *cow_header = (const void *)buf;
958e1b
-
958e1b
-    if (buf_size >= sizeof(struct cow_header_v2) &&
958e1b
-        be32_to_cpu(cow_header->magic) == COW_MAGIC &&
958e1b
-        be32_to_cpu(cow_header->version) == COW_VERSION)
958e1b
-        return 100;
958e1b
-    else
958e1b
-        return 0;
958e1b
-}
958e1b
-
958e1b
-static int cow_open(BlockDriverState *bs, QDict *options, int flags,
958e1b
-                    Error **errp)
958e1b
-{
958e1b
-    BDRVCowState *s = bs->opaque;
958e1b
-    struct cow_header_v2 cow_header;
958e1b
-    int bitmap_size;
958e1b
-    int64_t size;
958e1b
-    int ret;
958e1b
-
958e1b
-    /* see if it is a cow image */
958e1b
-    ret = bdrv_pread(bs->file, 0, &cow_header, sizeof(cow_header));
958e1b
-    if (ret < 0) {
958e1b
-        goto fail;
958e1b
-    }
958e1b
-
958e1b
-    if (be32_to_cpu(cow_header.magic) != COW_MAGIC) {
958e1b
-        error_setg(errp, "Image not in COW format");
958e1b
-        ret = -EINVAL;
958e1b
-        goto fail;
958e1b
-    }
958e1b
-
958e1b
-    if (be32_to_cpu(cow_header.version) != COW_VERSION) {
958e1b
-        char version[64];
958e1b
-        snprintf(version, sizeof(version),
958e1b
-               "COW version %" PRIu32, cow_header.version);
958e1b
-        error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
958e1b
-            bs->device_name, "cow", version);
958e1b
-        ret = -ENOTSUP;
958e1b
-        goto fail;
958e1b
-    }
958e1b
-
958e1b
-    /* cow image found */
958e1b
-    size = be64_to_cpu(cow_header.size);
958e1b
-    bs->total_sectors = size / 512;
958e1b
-
958e1b
-    pstrcpy(bs->backing_file, sizeof(bs->backing_file),
958e1b
-            cow_header.backing_file);
958e1b
-
958e1b
-    bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header);
958e1b
-    s->cow_sectors_offset = (bitmap_size + 511) & ~511;
958e1b
-    qemu_co_mutex_init(&s->lock);
958e1b
-    return 0;
958e1b
- fail:
958e1b
-    return ret;
958e1b
-}
958e1b
-
958e1b
-/*
958e1b
- * XXX(hch): right now these functions are extremely inefficient.
958e1b
- * We should just read the whole bitmap we'll need in one go instead.
958e1b
- */
958e1b
-static inline int cow_set_bit(BlockDriverState *bs, int64_t bitnum, bool *first)
958e1b
-{
958e1b
-    uint64_t offset = sizeof(struct cow_header_v2) + bitnum / 8;
958e1b
-    uint8_t bitmap;
958e1b
-    int ret;
958e1b
-
958e1b
-    ret = bdrv_pread(bs->file, offset, &bitmap, sizeof(bitmap));
958e1b
-    if (ret < 0) {
958e1b
-       return ret;
958e1b
-    }
958e1b
-
958e1b
-    if (bitmap & (1 << (bitnum % 8))) {
958e1b
-        return 0;
958e1b
-    }
958e1b
-
958e1b
-    if (*first) {
958e1b
-        ret = bdrv_flush(bs->file);
958e1b
-        if (ret < 0) {
958e1b
-            return ret;
958e1b
-        }
958e1b
-        *first = false;
958e1b
-    }
958e1b
-
958e1b
-    bitmap |= (1 << (bitnum % 8));
958e1b
-
958e1b
-    ret = bdrv_pwrite(bs->file, offset, &bitmap, sizeof(bitmap));
958e1b
-    if (ret < 0) {
958e1b
-       return ret;
958e1b
-    }
958e1b
-    return 0;
958e1b
-}
958e1b
-
958e1b
-#define BITS_PER_BITMAP_SECTOR (512 * 8)
958e1b
-
958e1b
-/* Cannot use bitmap.c on big-endian machines.  */
958e1b
-static int cow_test_bit(int64_t bitnum, const uint8_t *bitmap)
958e1b
-{
958e1b
-    return (bitmap[bitnum / 8] & (1 << (bitnum & 7))) != 0;
958e1b
-}
958e1b
-
958e1b
-static int cow_find_streak(const uint8_t *bitmap, int value, int start, int nb_sectors)
958e1b
-{
958e1b
-    int streak_value = value ? 0xFF : 0;
958e1b
-    int last = MIN(start + nb_sectors, BITS_PER_BITMAP_SECTOR);
958e1b
-    int bitnum = start;
958e1b
-    while (bitnum < last) {
958e1b
-        if ((bitnum & 7) == 0 && bitmap[bitnum / 8] == streak_value) {
958e1b
-            bitnum += 8;
958e1b
-            continue;
958e1b
-        }
958e1b
-        if (cow_test_bit(bitnum, bitmap) == value) {
958e1b
-            bitnum++;
958e1b
-            continue;
958e1b
-        }
958e1b
-        break;
958e1b
-    }
958e1b
-    return MIN(bitnum, last) - start;
958e1b
-}
958e1b
-
958e1b
-/* Return true if first block has been changed (ie. current version is
958e1b
- * in COW file).  Set the number of continuous blocks for which that
958e1b
- * is true. */
958e1b
-static int coroutine_fn cow_co_is_allocated(BlockDriverState *bs,
958e1b
-        int64_t sector_num, int nb_sectors, int *num_same)
958e1b
-{
958e1b
-    int64_t bitnum = sector_num + sizeof(struct cow_header_v2) * 8;
958e1b
-    uint64_t offset = (bitnum / 8) & -BDRV_SECTOR_SIZE;
958e1b
-    uint8_t bitmap[BDRV_SECTOR_SIZE];
958e1b
-    int ret;
958e1b
-    int changed;
958e1b
-
958e1b
-    ret = bdrv_pread(bs->file, offset, &bitmap, sizeof(bitmap));
958e1b
-    if (ret < 0) {
958e1b
-        return ret;
958e1b
-    }
958e1b
-
958e1b
-    bitnum &= BITS_PER_BITMAP_SECTOR - 1;
958e1b
-    changed = cow_test_bit(bitnum, bitmap);
958e1b
-    *num_same = cow_find_streak(bitmap, changed, bitnum, nb_sectors);
958e1b
-    return changed;
958e1b
-}
958e1b
-
958e1b
-static int64_t coroutine_fn cow_co_get_block_status(BlockDriverState *bs,
958e1b
-        int64_t sector_num, int nb_sectors, int *num_same)
958e1b
-{
958e1b
-    BDRVCowState *s = bs->opaque;
958e1b
-    int ret = cow_co_is_allocated(bs, sector_num, nb_sectors, num_same);
958e1b
-    int64_t offset = s->cow_sectors_offset + (sector_num << BDRV_SECTOR_BITS);
958e1b
-    if (ret < 0) {
958e1b
-        return ret;
958e1b
-    }
958e1b
-    return (ret ? BDRV_BLOCK_DATA : 0) | offset | BDRV_BLOCK_OFFSET_VALID;
958e1b
-}
958e1b
-
958e1b
-static int cow_update_bitmap(BlockDriverState *bs, int64_t sector_num,
958e1b
-        int nb_sectors)
958e1b
-{
958e1b
-    int error = 0;
958e1b
-    int i;
958e1b
-    bool first = true;
958e1b
-
958e1b
-    for (i = 0; i < nb_sectors; i++) {
958e1b
-        error = cow_set_bit(bs, sector_num + i, &first);
958e1b
-        if (error) {
958e1b
-            break;
958e1b
-        }
958e1b
-    }
958e1b
-
958e1b
-    return error;
958e1b
-}
958e1b
-
958e1b
-static int coroutine_fn cow_read(BlockDriverState *bs, int64_t sector_num,
958e1b
-                                 uint8_t *buf, int nb_sectors)
958e1b
-{
958e1b
-    BDRVCowState *s = bs->opaque;
958e1b
-    int ret, n;
958e1b
-
958e1b
-    while (nb_sectors > 0) {
958e1b
-        ret = cow_co_is_allocated(bs, sector_num, nb_sectors, &n);
958e1b
-        if (ret < 0) {
958e1b
-            return ret;
958e1b
-        }
958e1b
-        if (ret) {
958e1b
-            ret = bdrv_pread(bs->file,
958e1b
-                        s->cow_sectors_offset + sector_num * 512,
958e1b
-                        buf, n * 512);
958e1b
-            if (ret < 0) {
958e1b
-                return ret;
958e1b
-            }
958e1b
-        } else {
958e1b
-            if (bs->backing_hd) {
958e1b
-                /* read from the base image */
958e1b
-                ret = bdrv_read(bs->backing_hd, sector_num, buf, n);
958e1b
-                if (ret < 0) {
958e1b
-                    return ret;
958e1b
-                }
958e1b
-            } else {
958e1b
-                memset(buf, 0, n * 512);
958e1b
-            }
958e1b
-        }
958e1b
-        nb_sectors -= n;
958e1b
-        sector_num += n;
958e1b
-        buf += n * 512;
958e1b
-    }
958e1b
-    return 0;
958e1b
-}
958e1b
-
958e1b
-static coroutine_fn int cow_co_read(BlockDriverState *bs, int64_t sector_num,
958e1b
-                                    uint8_t *buf, int nb_sectors)
958e1b
-{
958e1b
-    int ret;
958e1b
-    BDRVCowState *s = bs->opaque;
958e1b
-    qemu_co_mutex_lock(&s->lock);
958e1b
-    ret = cow_read(bs, sector_num, buf, nb_sectors);
958e1b
-    qemu_co_mutex_unlock(&s->lock);
958e1b
-    return ret;
958e1b
-}
958e1b
-
958e1b
-static int cow_write(BlockDriverState *bs, int64_t sector_num,
958e1b
-                     const uint8_t *buf, int nb_sectors)
958e1b
-{
958e1b
-    BDRVCowState *s = bs->opaque;
958e1b
-    int ret;
958e1b
-
958e1b
-    ret = bdrv_pwrite(bs->file, s->cow_sectors_offset + sector_num * 512,
958e1b
-                      buf, nb_sectors * 512);
958e1b
-    if (ret < 0) {
958e1b
-        return ret;
958e1b
-    }
958e1b
-
958e1b
-    return cow_update_bitmap(bs, sector_num, nb_sectors);
958e1b
-}
958e1b
-
958e1b
-static coroutine_fn int cow_co_write(BlockDriverState *bs, int64_t sector_num,
958e1b
-                                     const uint8_t *buf, int nb_sectors)
958e1b
-{
958e1b
-    int ret;
958e1b
-    BDRVCowState *s = bs->opaque;
958e1b
-    qemu_co_mutex_lock(&s->lock);
958e1b
-    ret = cow_write(bs, sector_num, buf, nb_sectors);
958e1b
-    qemu_co_mutex_unlock(&s->lock);
958e1b
-    return ret;
958e1b
-}
958e1b
-
958e1b
-static void cow_close(BlockDriverState *bs)
958e1b
-{
958e1b
-}
958e1b
-
958e1b
-static int cow_create(const char *filename, QEMUOptionParameter *options,
958e1b
-                      Error **errp)
958e1b
-{
958e1b
-    struct cow_header_v2 cow_header;
958e1b
-    struct stat st;
958e1b
-    int64_t image_sectors = 0;
958e1b
-    const char *image_filename = NULL;
958e1b
-    Error *local_err = NULL;
958e1b
-    int ret;
958e1b
-    BlockDriverState *cow_bs;
958e1b
-
958e1b
-    /* Read out options */
958e1b
-    while (options && options->name) {
958e1b
-        if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
958e1b
-            image_sectors = options->value.n / 512;
958e1b
-        } else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) {
958e1b
-            image_filename = options->value.s;
958e1b
-        }
958e1b
-        options++;
958e1b
-    }
958e1b
-
958e1b
-    ret = bdrv_create_file(filename, options, &local_err);
958e1b
-    if (ret < 0) {
958e1b
-        error_propagate(errp, local_err);
958e1b
-        return ret;
958e1b
-    }
958e1b
-
958e1b
-    ret = bdrv_file_open(&cow_bs, filename, NULL, BDRV_O_RDWR, &local_err);
958e1b
-    if (ret < 0) {
958e1b
-        error_propagate(errp, local_err);
958e1b
-        return ret;
958e1b
-    }
958e1b
-
958e1b
-    memset(&cow_header, 0, sizeof(cow_header));
958e1b
-    cow_header.magic = cpu_to_be32(COW_MAGIC);
958e1b
-    cow_header.version = cpu_to_be32(COW_VERSION);
958e1b
-    if (image_filename) {
958e1b
-        /* Note: if no file, we put a dummy mtime */
958e1b
-        cow_header.mtime = cpu_to_be32(0);
958e1b
-
958e1b
-        if (stat(image_filename, &st) != 0) {
958e1b
-            goto mtime_fail;
958e1b
-        }
958e1b
-        cow_header.mtime = cpu_to_be32(st.st_mtime);
958e1b
-    mtime_fail:
958e1b
-        pstrcpy(cow_header.backing_file, sizeof(cow_header.backing_file),
958e1b
-                image_filename);
958e1b
-    }
958e1b
-    cow_header.sectorsize = cpu_to_be32(512);
958e1b
-    cow_header.size = cpu_to_be64(image_sectors * 512);
958e1b
-    ret = bdrv_pwrite(cow_bs, 0, &cow_header, sizeof(cow_header));
958e1b
-    if (ret < 0) {
958e1b
-        goto exit;
958e1b
-    }
958e1b
-
958e1b
-    /* resize to include at least all the bitmap */
958e1b
-    ret = bdrv_truncate(cow_bs,
958e1b
-        sizeof(cow_header) + ((image_sectors + 7) >> 3));
958e1b
-    if (ret < 0) {
958e1b
-        goto exit;
958e1b
-    }
958e1b
-
958e1b
-exit:
958e1b
-    bdrv_unref(cow_bs);
958e1b
-    return ret;
958e1b
-}
958e1b
-
958e1b
-static QEMUOptionParameter cow_create_options[] = {
958e1b
-    {
958e1b
-        .name = BLOCK_OPT_SIZE,
958e1b
-        .type = OPT_SIZE,
958e1b
-        .help = "Virtual disk size"
958e1b
-    },
958e1b
-    {
958e1b
-        .name = BLOCK_OPT_BACKING_FILE,
958e1b
-        .type = OPT_STRING,
958e1b
-        .help = "File name of a base image"
958e1b
-    },
958e1b
-    { NULL }
958e1b
-};
958e1b
-
958e1b
-static BlockDriver bdrv_cow = {
958e1b
-    .format_name    = "cow",
958e1b
-    .instance_size  = sizeof(BDRVCowState),
958e1b
-
958e1b
-    .bdrv_probe     = cow_probe,
958e1b
-    .bdrv_open      = cow_open,
958e1b
-    .bdrv_close     = cow_close,
958e1b
-    .bdrv_create    = cow_create,
958e1b
-    .bdrv_has_zero_init     = bdrv_has_zero_init_1,
958e1b
-
958e1b
-    .bdrv_read              = cow_co_read,
958e1b
-    .bdrv_write             = cow_co_write,
958e1b
-    .bdrv_co_get_block_status   = cow_co_get_block_status,
958e1b
-
958e1b
-    .create_options = cow_create_options,
958e1b
-};
958e1b
-
958e1b
-static void bdrv_cow_init(void)
958e1b
-{
958e1b
-    bdrv_register(&bdrv_cow);
958e1b
-}
958e1b
-
958e1b
-block_init(bdrv_cow_init);
958e1b
diff --git a/qapi-schema.json b/qapi-schema.json
958e1b
index 2af2643..8a7cf0b 100644
958e1b
--- a/qapi-schema.json
958e1b
+++ b/qapi-schema.json
958e1b
@@ -826,6 +826,7 @@
958e1b
 #       'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
958e1b
 #       'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow',
958e1b
 #       'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
958e1b
+#       2.2: 'cow' dropped
958e1b
 #
958e1b
 # @backing_file: #optional the name of the backing file (for copy-on-write)
958e1b
 #
958e1b
@@ -4076,7 +4077,6 @@
958e1b
 
958e1b
       'bochs':      'BlockdevOptionsGenericFormat',
958e1b
       'cloop':      'BlockdevOptionsGenericFormat',
958e1b
-      'cow':        'BlockdevOptionsGenericCOWFormat',
958e1b
       'dmg':        'BlockdevOptionsGenericFormat',
958e1b
       'parallels':  'BlockdevOptionsGenericFormat',
958e1b
       'qcow':       'BlockdevOptionsGenericCOWFormat',
958e1b
diff --git a/qemu-doc.texi b/qemu-doc.texi
958e1b
index ff124fe..33f709a 100644
958e1b
--- a/qemu-doc.texi
958e1b
+++ b/qemu-doc.texi
958e1b
@@ -621,15 +621,6 @@ File name of a base image (see @option{create} subcommand)
958e1b
 If this option is set to @code{on}, the image is encrypted.
958e1b
 @end table
958e1b
 
958e1b
-@item cow
958e1b
-User Mode Linux Copy On Write image format. It is supported only for
958e1b
-compatibility with previous versions.
958e1b
-Supported options:
958e1b
-@table @code
958e1b
-@item backing_file
958e1b
-File name of a base image (see @option{create} subcommand)
958e1b
-@end table
958e1b
-
958e1b
 @item vdi
958e1b
 VirtualBox 1.1 compatible image format.
958e1b
 Supported options:
958e1b
diff --git a/qemu-img.texi b/qemu-img.texi
958e1b
index e943856..2099dd1 100644
958e1b
--- a/qemu-img.texi
958e1b
+++ b/qemu-img.texi
958e1b
@@ -201,8 +201,8 @@ compression is read-only. It means that if a compressed sector is
958e1b
 rewritten, then it is rewritten as uncompressed data.
958e1b
 
958e1b
 Image conversion is also useful to get smaller image when using a
958e1b
-growable format such as @code{qcow} or @code{cow}: the empty sectors
958e1b
-are detected and suppressed from the destination image.
958e1b
+growable format such as @code{qcow}: the empty sectors are detected and
958e1b
+suppressed from the destination image.
958e1b
 
958e1b
 @var{sparse_size} indicates the consecutive number of bytes (defaults to 4k)
958e1b
 that must contain only zeros for qemu-img to create a sparse image during
958e1b
diff --git a/qmp-commands.hx b/qmp-commands.hx
958e1b
index 9c11213..44dd48e 100644
958e1b
--- a/qmp-commands.hx
958e1b
+++ b/qmp-commands.hx
958e1b
@@ -1903,7 +1903,7 @@ Each json-object contain the following:
958e1b
          - "file": device file name (json-string)
958e1b
          - "ro": true if read-only, false otherwise (json-bool)
958e1b
          - "drv": driver format name (json-string)
958e1b
-             - Possible values: "blkdebug", "bochs", "cloop", "cow", "dmg",
958e1b
+             - Possible values: "blkdebug", "bochs", "cloop", "dmg",
958e1b
                                 "file", "file", "ftp", "ftps", "host_cdrom",
958e1b
                                 "host_device", "host_floppy", "http", "https",
958e1b
                                 "nbd", "parallels", "qcow", "qcow2", "raw",
958e1b
diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069
958e1b
index 50347d9..d606685 100755
958e1b
--- a/tests/qemu-iotests/069
958e1b
+++ b/tests/qemu-iotests/069
958e1b
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
958e1b
 . ./common.rc
958e1b
 . ./common.filter
958e1b
 
958e1b
-_supported_fmt cow qed qcow qcow2 vmdk
958e1b
+_supported_fmt qed qcow qcow2 vmdk
958e1b
 _supported_proto generic
958e1b
 _supported_os Linux
958e1b
 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
958e1b
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
958e1b
index f8c1b56..a90415a 100644
958e1b
--- a/tests/qemu-iotests/common
958e1b
+++ b/tests/qemu-iotests/common
958e1b
@@ -129,7 +129,6 @@ common options
958e1b
 check options
958e1b
     -raw                test raw (default)
958e1b
     -bochs              test bochs
958e1b
-    -cow                test cow
958e1b
     -cloop              test cloop
958e1b
     -parallels          test parallels
958e1b
     -qcow               test qcow
958e1b
@@ -171,11 +170,6 @@ testlist options
958e1b
             xpand=false
958e1b
             ;;
958e1b
 
958e1b
-        -cow)
958e1b
-            IMGFMT=cow
958e1b
-            xpand=false
958e1b
-            ;;
958e1b
-
958e1b
         -cloop)
958e1b
             IMGFMT=cloop
958e1b
             IMGFMT_GENERIC=false
958e1b
diff --git a/ui/cocoa.m b/ui/cocoa.m
958e1b
index 1971d9c..0c35f25 100644
958e1b
--- a/ui/cocoa.m
958e1b
+++ b/ui/cocoa.m
958e1b
@@ -771,7 +771,7 @@ QemuCocoaView *cocoaView;
958e1b
         NSOpenPanel *op = [[NSOpenPanel alloc] init];
958e1b
         [op setPrompt:@"Boot image"];
958e1b
         [op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"];
958e1b
-        [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil]
958e1b
+        [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cloop",@"vmdk",nil]
958e1b
               modalForWindow:normalWindow modalDelegate:self
958e1b
               didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
958e1b
     } else {
958e1b
-- 
958e1b
2.1.0
958e1b