[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [RFC PATCH 30/56] block: Make write thresholds unsigned in
From: |
Markus Armbruster |
Subject: |
[Qemu-block] [RFC PATCH 30/56] block: Make write thresholds unsigned in QAPI/QMP |
Date: |
Mon, 7 Aug 2017 16:45:34 +0200 |
File offsets should use QAPI type 'size' (uint64_t).
block-set-write-threshold parameter @write-threshold is 'int'
(int64_t). qmp_block_set_write_threshold() passes it on to
bdrv_write_threshold_set(), implicitly converting to uint64_t.
BLOCK_WRITE_THRESHOLD parameters @write-threshold, @amount-exceeded
are 'int'. before_write_notify() gets them from BlockDriverState
member write_threshold_offset and bdrv_write_threshold_exceeded(),
implicitly converting from uint64_t. BlockDeviceInfo members
@write_threshold is 'int'. bdrv_block_device_info() gets it from
bdrv_write_threshold_get(), implicitly converting from uint64_t.
Change them all to 'size'. Drop a redundant initializer while there.
block-set-write-threshold now accepts file offsets between 2^63 and
2^64-1. It accepts negative values as before, because that's how the
QObject input visitor works for backward compatibility.
There is no matching HMP command.
BLOCK_WRITE_THRESHOLD, query-block and query-named-block-nodes now
report write threshold values above 2^63-1 correctly instead of their
(negative) two's complement.
HMP's info block does not report write thresholds.
Signed-off-by: Markus Armbruster <address@hidden>
---
block/write-threshold.c | 2 +-
qapi/block-core.json | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/block/write-threshold.c b/block/write-threshold.c
index 0bd1a01..c4572d9 100644
--- a/block/write-threshold.c
+++ b/block/write-threshold.c
@@ -56,7 +56,7 @@ static int coroutine_fn
before_write_notify(NotifierWithReturn *notifier,
{
BdrvTrackedRequest *req = opaque;
BlockDriverState *bs = req->bs;
- uint64_t amount = 0;
+ uint64_t amount;
amount = bdrv_write_threshold_exceeded(bs, req);
if (amount > 0) {
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 60e1b6f..9e96590 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -366,7 +366,7 @@
'*bps_wr_max_length': 'int', '*iops_max_length': 'int',
'*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
'*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
- 'write_threshold': 'int' } }
+ 'write_threshold': 'size' } }
##
# @BlockDeviceIoStatus:
@@ -3748,8 +3748,8 @@
##
{ 'event': 'BLOCK_WRITE_THRESHOLD',
'data': { 'node-name': 'str',
- 'amount-exceeded': 'uint64',
- 'write-threshold': 'uint64' } }
+ 'amount-exceeded': 'size',
+ 'write-threshold': 'size' } }
##
# @block-set-write-threshold:
@@ -3779,7 +3779,7 @@
#
##
{ 'command': 'block-set-write-threshold',
- 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } }
+ 'data': { 'node-name': 'str', 'write-threshold': 'size' } }
##
# @x-blockdev-change:
--
2.7.5
- [Qemu-block] [RFC PATCH 31/56] block: Make throttle byte rates and sizes unsigned in QAPI/QMP, (continued)
- [Qemu-block] [RFC PATCH 31/56] block: Make throttle byte rates and sizes unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 39/56] blockjob: Lift speed sign conversion out of block_job_create(), Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 45/56] blockjob: Lift speed sign conversion out of commit_start() etc., Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 36/56] blockjob: Drop unused parameter @errp of method set_speed(), Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 43/56] blockjob: Lift speed sign conversion out of mirror_start(), Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 44/56] blockjob: Lift speed sign conversion out of blockdev_mirror_common(), Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 49/56] block: Make ImageCheck file offset unsigned in QAPI, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 52/56] block/nfs: Reject negative readahead-size, page-cache-size, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 30/56] block: Make write thresholds unsigned in QAPI/QMP,
Markus Armbruster <=
- [Qemu-block] [RFC PATCH 40/56] blockjob: Lift speed sign conversion out of backup_job_create(), Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 48/56] block: Make mirror buffer size unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 54/56] qemu-img: blk_getlength() can fail, fix img_map() to check, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 46/56] blockjob: Make job commands' speed parameter unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 38/56] blockjob: Lift speed sign conversion out of block_job_set_speed(), Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 28/56] block: Widen dirty bitmap granularity to uint64_t for safety, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 50/56] block: Make BLOCK_IMAGE_CORRUPTED offset, size unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07