blockdev.c (fb0490f69feb96b7e92457f176dc834ff0b00b09) blockdev.c (922453bca6a927bb527068ae8679d587cfa45dbc)
1/*
2 * QEMU host block devices
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or
7 * later. See the COPYING file in the top-level directory.
8 */

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

648 }
649
650 ret = bdrv_img_create(filename, format, bs->filename,
651 bs->drv->format_name, NULL, -1, flags);
652 if (ret) {
653 goto out;
654 }
655
1/*
2 * QEMU host block devices
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or
7 * later. See the COPYING file in the top-level directory.
8 */

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

648 }
649
650 ret = bdrv_img_create(filename, format, bs->filename,
651 bs->drv->format_name, NULL, -1, flags);
652 if (ret) {
653 goto out;
654 }
655
656 qemu_aio_flush();
656 bdrv_drain_all();
657 bdrv_flush(bs);
658
659 bdrv_close(bs);
660 ret = bdrv_open(bs, filename, flags, drv);
661 /*
662 * If reopening the image file we just created fails, fall back
663 * and try to re-open the original image. If that fails too, we
664 * are in serious trouble.

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

835 return -1;
836 }
837 if (bdrv_in_use(bs)) {
838 qerror_report(QERR_DEVICE_IN_USE, id);
839 return -1;
840 }
841
842 /* quiesce block driver; prevent further io */
657 bdrv_flush(bs);
658
659 bdrv_close(bs);
660 ret = bdrv_open(bs, filename, flags, drv);
661 /*
662 * If reopening the image file we just created fails, fall back
663 * and try to re-open the original image. If that fails too, we
664 * are in serious trouble.

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

835 return -1;
836 }
837 if (bdrv_in_use(bs)) {
838 qerror_report(QERR_DEVICE_IN_USE, id);
839 return -1;
840 }
841
842 /* quiesce block driver; prevent further io */
843 qemu_aio_flush();
843 bdrv_drain_all();
844 bdrv_flush(bs);
845 bdrv_close(bs);
846
847 /* if we have a device attached to this BlockDriverState
848 * then we need to make the drive anonymous until the device
849 * can be removed. If this is a drive with no device backing
850 * then we can just get rid of the block driver state right here.
851 */

--- 38 unchanged lines hidden ---
844 bdrv_flush(bs);
845 bdrv_close(bs);
846
847 /* if we have a device attached to this BlockDriverState
848 * then we need to make the drive anonymous until the device
849 * can be removed. If this is a drive with no device backing
850 * then we can just get rid of the block driver state right here.
851 */

--- 38 unchanged lines hidden ---