summaryrefslogtreecommitdiff
path: root/block/accounting.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-06-05 14:39:07 +0200
committerFam Zheng <famz@redhat.com>2017-06-16 07:55:00 +0800
commit9caa6f3dbe20f2c506df6698386fce941fc6238a (patch)
tree0d2cceb60dbfe4f1d01cef4c23f69edbabcd7dac /block/accounting.c
parent39c1b4254e6200519d747f6cb8c888004e2446e2 (diff)
downloadqemu-9caa6f3dbe20f2c506df6698386fce941fc6238a.tar.gz
block: split BlockAcctStats creation and setup
block_acct_destroy is called unconditionally in blk_delete, but there is no BlockAcctStats function that is called unconditionally in blk_new. Split block_acct_init in two, so that it will be possible to create a QemuMutex in block_acct_init and destroy it in block_acct_cleanup. Cc: Alberto Garcia <berto@igalia.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20170605123908.18777-19-pbonzini@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'block/accounting.c')
-rw-r--r--block/accounting.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/block/accounting.c b/block/accounting.c
index a279e0b124..ce6dbf7760 100644
--- a/block/accounting.c
+++ b/block/accounting.c
@@ -32,17 +32,20 @@
static QEMUClockType clock_type = QEMU_CLOCK_REALTIME;
static const int qtest_latency_ns = NANOSECONDS_PER_SECOND / 1000;
-void block_acct_init(BlockAcctStats *stats, bool account_invalid,
- bool account_failed)
+void block_acct_init(BlockAcctStats *stats)
{
- stats->account_invalid = account_invalid;
- stats->account_failed = account_failed;
-
if (qtest_enabled()) {
clock_type = QEMU_CLOCK_VIRTUAL;
}
}
+void block_acct_setup(BlockAcctStats *stats, bool account_invalid,
+ bool account_failed)
+{
+ stats->account_invalid = account_invalid;
+ stats->account_failed = account_failed;
+}
+
void block_acct_cleanup(BlockAcctStats *stats)
{
BlockAcctTimedStats *s, *next;