[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 15/28] qed: Images with backing file do not require
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 15/28] qed: Images with backing file do not require QED_F_NEED_CHECK |
Date: |
Mon, 31 Jan 2011 16:29:03 +0100 |
From: Stefan Hajnoczi <address@hidden>
The consistency check on open is necessary in order to fix inconsistent
table offsets left as a result of a crash mid-operation. Images with a
backing file actually flush before updating table offsets and are
therefore guaranteed to be consistent. Do not mark these images dirty.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qed.c | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/block/qed.c b/block/qed.c
index a46f9ef..3273448 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -977,6 +977,19 @@ static void qed_aio_write_prefill(void *opaque, int ret)
}
/**
+ * Check if the QED_F_NEED_CHECK bit should be set during allocating write
+ */
+static bool qed_should_set_need_check(BDRVQEDState *s)
+{
+ /* The flush before L2 update path ensures consistency */
+ if (s->bs->backing_hd) {
+ return false;
+ }
+
+ return !(s->header.features & QED_F_NEED_CHECK);
+}
+
+/**
* Write new data cluster
*
* @acb: Write request
@@ -1001,15 +1014,12 @@ static void qed_aio_write_alloc(QEDAIOCB *acb, size_t
len)
acb->cur_cluster = qed_alloc_clusters(s, acb->cur_nclusters);
qemu_iovec_copy(&acb->cur_qiov, acb->qiov, acb->qiov_offset, len);
- /* Write new cluster if the image is already marked dirty */
- if (s->header.features & QED_F_NEED_CHECK) {
+ if (qed_should_set_need_check(s)) {
+ s->header.features |= QED_F_NEED_CHECK;
+ qed_write_header(s, qed_aio_write_prefill, acb);
+ } else {
qed_aio_write_prefill(acb, 0);
- return;
}
-
- /* Mark the image dirty before writing the new cluster */
- s->header.features |= QED_F_NEED_CHECK;
- qed_write_header(s, qed_aio_write_prefill, acb);
}
/**
--
1.7.2.3
- [Qemu-devel] [PATCH 01/28] strtosz(): use unsigned char and switch to qemu_isspace(), (continued)
- [Qemu-devel] [PATCH 01/28] strtosz(): use unsigned char and switch to qemu_isspace(), Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 04/28] strtosz(): Use suffix macros in switch() statement, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 02/28] strtosz() use qemu_toupper() to simplify switch statement, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 07/28] virtio-blk: tell the guest about size changes, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 03/28] strtosz(): Fix name confusion in use of modf(), Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 12/28] sheepdog: support creating images on remote hosts, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 05/28] block: add block_resize monitor command, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 08/28] virtio-pci: Disable virtio-ioeventfd when !CONFIG_IOTHREAD, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 10/28] ahci: Fix cpu_physical_memory_unmap() argument ordering, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 18/28] qcow2-refcount: remove write-only variables, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 15/28] qed: Images with backing file do not require QED_F_NEED_CHECK,
Kevin Wolf <=
- [Qemu-devel] [PATCH 11/28] Reorganize struct Qcow2Cache for better struct packing, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 14/28] qcow2: Add bdrv_discard support, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 17/28] scsi hotplug: Set DriveInfo member bus correctly, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 16/28] raw-win32: Fix bdrv_flush return value, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 24/28] blockdev: Factor drive_index_to_{bus, unit}_id out of drive_init(), Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 27/28] blockdev: Replace drive_add()'s fmt, ... by optstr parameter, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 25/28] blockdev: New drive_get_by_index(), Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 28/28] blockdev: Fix drive_add for drives without media, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 19/28] blockdev: New drive_get_next(), replacing qdev_init_bdrv(), Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 06/28] block: tell drivers about an image resize, Kevin Wolf, 2011/01/31