aboutsummaryrefslogtreecommitdiff
path: root/block/qapi.c
diff options
context:
space:
mode:
authorBenoît Canet <benoit.canet@nodalink.com>2014-09-05 15:46:15 +0200
committerKevin Wolf <kwolf@redhat.com>2014-09-10 10:41:29 +0200
commit0ddd0ad96abf55acad06324b26b69a24bde23ac5 (patch)
treee1f834a9b89fb4802bc08a24b70e1e3a7c19332c /block/qapi.c
parent1a7044bb62ca490b8742ac17d40bb774b7a9048e (diff)
block: Extract the BlockAcctStats structure
Extract the block accounting statistics into a structure so the block device models can hold them in the future. CC: Kevin Wolf <kwolf@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Max Reitz <mreitz@redhat.com> CC: Eric Blake <eblake@redhat.com> Signed-off-by: Benoît Canet <benoit.canet@nodalink.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qapi.c')
-rw-r--r--block/qapi.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/block/qapi.c b/block/qapi.c
index 79d1e6a9f4..3d3d30b004 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -333,15 +333,16 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs)
}
s->stats = g_malloc0(sizeof(*s->stats));
- s->stats->rd_bytes = bs->nr_bytes[BDRV_ACCT_READ];
- s->stats->wr_bytes = bs->nr_bytes[BDRV_ACCT_WRITE];
- s->stats->rd_operations = bs->nr_ops[BDRV_ACCT_READ];
- s->stats->wr_operations = bs->nr_ops[BDRV_ACCT_WRITE];
- s->stats->wr_highest_offset = bs->wr_highest_sector * BDRV_SECTOR_SIZE;
- s->stats->flush_operations = bs->nr_ops[BDRV_ACCT_FLUSH];
- s->stats->wr_total_time_ns = bs->total_time_ns[BDRV_ACCT_WRITE];
- s->stats->rd_total_time_ns = bs->total_time_ns[BDRV_ACCT_READ];
- s->stats->flush_total_time_ns = bs->total_time_ns[BDRV_ACCT_FLUSH];
+ s->stats->rd_bytes = bs->stats.nr_bytes[BDRV_ACCT_READ];
+ s->stats->wr_bytes = bs->stats.nr_bytes[BDRV_ACCT_WRITE];
+ s->stats->rd_operations = bs->stats.nr_ops[BDRV_ACCT_READ];
+ s->stats->wr_operations = bs->stats.nr_ops[BDRV_ACCT_WRITE];
+ s->stats->wr_highest_offset =
+ bs->stats.wr_highest_sector * BDRV_SECTOR_SIZE;
+ s->stats->flush_operations = bs->stats.nr_ops[BDRV_ACCT_FLUSH];
+ s->stats->wr_total_time_ns = bs->stats.total_time_ns[BDRV_ACCT_WRITE];
+ s->stats->rd_total_time_ns = bs->stats.total_time_ns[BDRV_ACCT_READ];
+ s->stats->flush_total_time_ns = bs->stats.total_time_ns[BDRV_ACCT_FLUSH];
if (bs->file) {
s->has_parent = true;