[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 15/22] block: use Stat64 for wr_highest_offset
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PULL v2 15/22] block: use Stat64 for wr_highest_offset |
Date: |
Fri, 2 Jun 2017 16:11:13 +0800 |
From: Paolo Bonzini <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
---
block/io.c | 4 +---
block/qapi.c | 2 +-
include/block/block_int.h | 7 ++++---
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/block/io.c b/block/io.c
index bb1c9c5..bc69b4c 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1405,9 +1405,7 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild
*child,
++bs->write_gen;
bdrv_set_dirty(bs, start_sector, end_sector - start_sector);
- if (bs->wr_highest_offset < offset + bytes) {
- bs->wr_highest_offset = offset + bytes;
- }
+ stat64_max(&bs->wr_highest_offset, offset + bytes);
if (ret >= 0) {
bs->total_sectors = MAX(bs->total_sectors, end_sector);
diff --git a/block/qapi.c b/block/qapi.c
index a40922e..14b60ae 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -441,7 +441,7 @@ static BlockStats *bdrv_query_bds_stats(const
BlockDriverState *bs,
s->node_name = g_strdup(bdrv_get_node_name(bs));
}
- s->stats->wr_highest_offset = bs->wr_highest_offset;
+ s->stats->wr_highest_offset = stat64_get(&bs->wr_highest_offset);
if (bs->file) {
s->has_parent = true;
diff --git a/include/block/block_int.h b/include/block/block_int.h
index d11417e..8f36d1f 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -29,6 +29,7 @@
#include "qemu/option.h"
#include "qemu/queue.h"
#include "qemu/coroutine.h"
+#include "qemu/stats64.h"
#include "qemu/timer.h"
#include "qapi-types.h"
#include "qemu/hbitmap.h"
@@ -604,9 +605,6 @@ struct BlockDriverState {
/* Callback before write request is processed */
NotifierWithReturnList before_write_notifiers;
- /* Offset after the highest byte written to */
- uint64_t wr_highest_offset;
-
/* threshold limit for writes, in bytes. "High water mark". */
uint64_t write_threshold_offset;
NotifierWithReturn write_threshold_notifier;
@@ -619,6 +617,9 @@ struct BlockDriverState {
QLIST_HEAD(, BdrvDirtyBitmap) dirty_bitmaps;
+ /* Offset after the highest byte written to */
+ Stat64 wr_highest_offset;
+
/* If true, copy read backing sectors into image. Can be >1 if more
* than one client has requested copy-on-read. Accessed with atomic
* ops.
--
2.9.4
- [Qemu-devel] [PULL v2 05/22] block: access copy_on_read with atomic ops, (continued)
- [Qemu-devel] [PULL v2 05/22] block: access copy_on_read with atomic ops, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 06/22] block: access quiesce_counter with atomic ops, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 07/22] block: access io_limits_disabled with atomic ops, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 10/22] block: access io_plugged with atomic ops, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 08/22] block: access serialising_in_flight with atomic ops, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 09/22] block: access wakeup with atomic ops, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 11/22] throttle-groups: only start one coroutine from drained_begin, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 12/22] throttle-groups: do not use qemu_co_enter_next, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 13/22] throttle-groups: protect throttled requests with a CoMutex, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 14/22] util: add stats64 module, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 15/22] block: use Stat64 for wr_highest_offset,
Fam Zheng <=
- [Qemu-devel] [PULL v2 17/22] block: protect tracked_requests and flush_queue with reqs_lock, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 19/22] migration/block: reset dirty bitmap before reading, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 18/22] block: introduce dirty_bitmap_mutex, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 16/22] block: access write_gen with atomics, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 20/22] block: protect modification of dirty bitmaps with a mutex, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 22/22] block: make accounting thread-safe, Fam Zheng, 2017/06/02
- [Qemu-devel] [PULL v2 21/22] block: introduce block_account_one_io, Fam Zheng, 2017/06/02
- Re: [Qemu-devel] [PULL v2 00/22] Docker and block patches, no-reply, 2017/06/02
- Re: [Qemu-devel] [PULL v2 00/22] Docker and block patches, Peter Maydell, 2017/06/02