diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2011-05-09 16:45:40 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-05-18 14:38:46 +0200 |
commit | 6f321e93abb27b4e7ceb228b4204aa304e95daad (patch) | |
tree | 91a670fd257f3c412aeca38156112dc557491ce9 /block/qed.h | |
parent | 5fc09ca5c315b87539db882fba175a7955783530 (diff) | |
download | qemu-6f321e93abb27b4e7ceb228b4204aa304e95daad.tar.gz qemu-6f321e93abb27b4e7ceb228b4204aa304e95daad.tar.bz2 qemu-6f321e93abb27b4e7ceb228b4204aa304e95daad.zip |
qed: Periodically flush and clear need check bit
One strategy to limit the startup delay of consistency check when
opening image files is to ensure that the file is marked dirty for as
little time as possible.
QED currently marks the image dirty when the first allocating write
request is issued and clears the dirty bit again when the image is
cleanly closed. In practice that means the image is marked dirty for
most of a guest's lifetime and prone to being in a dirty state upon
crash or power failure.
It is safe to clear the dirty bit after all allocating write requests
have completed and a flush has been performed. This patch adds a timer
after the last allocating write request completes. When the timer fires
it will flush and then clear the dirty bit. The timer is set to 5
seconds and is cancelled upon arrival of a new allocating write request.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qed.h')
-rw-r--r-- | block/qed.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/block/qed.h b/block/qed.h index 1d1421fee1..388fdb3760 100644 --- a/block/qed.h +++ b/block/qed.h @@ -78,6 +78,9 @@ enum { QED_MIN_TABLE_SIZE = 1, /* in clusters */ QED_MAX_TABLE_SIZE = 16, QED_DEFAULT_TABLE_SIZE = 4, + + /* Delay to flush and clean image after last allocating write completes */ + QED_NEED_CHECK_TIMEOUT = 5, /* in seconds */ }; typedef struct { @@ -157,6 +160,10 @@ typedef struct { /* Allocating write request queue */ QSIMPLEQ_HEAD(, QEDAIOCB) allocating_write_reqs; + bool allocating_write_reqs_plugged; + + /* Periodic flush and clear need check flag */ + QEMUTimer *need_check_timer; } BDRVQEDState; enum { |