[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/15] block-backend: convert blk_co_pwritev_part to int64_t bytes
From: |
Eric Blake |
Subject: |
[PULL 04/15] block-backend: convert blk_co_pwritev_part to int64_t bytes |
Date: |
Fri, 15 Oct 2021 16:09:59 -0500 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
We convert blk_do_pwritev_part() and some wrappers:
blk_co_pwritev_part(), blk_co_pwritev(), blk_co_pwrite_zeroes().
All functions are converted so that the parameter type becomes wider, so
all callers should be OK with it.
Look at blk_do_pwritev_part() body:
bytes is passed to:
- trace_blk_co_pwritev (we update it here)
- blk_check_byte_request, throttle_group_co_io_limits_intercept,
bdrv_co_pwritev_part - all already have int64_t argument.
Note that requests exceeding INT_MAX are still restricted by
blk_check_byte_request().
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-4-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: grammar tweaks]
Signed-off-by: Eric Blake <eblake@redhat.com>
---
include/sysemu/block-backend.h | 6 +++---
block/block-backend.c | 8 ++++----
block/trace-events | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 442fd705bb78..91457a081ec1 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -129,11 +129,11 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t
offset,
int64_t bytes, QEMUIOVector *qiov,
BdrvRequestFlags flags);
int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset,
- unsigned int bytes,
+ int64_t bytes,
QEMUIOVector *qiov, size_t qiov_offset,
BdrvRequestFlags flags);
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
- unsigned int bytes, QEMUIOVector *qiov,
+ int64_t bytes, QEMUIOVector *qiov,
BdrvRequestFlags flags);
static inline int coroutine_fn blk_co_pread(BlockBackend *blk, int64_t offset,
@@ -243,7 +243,7 @@ int blk_get_open_flags_from_root_state(BlockBackend *blk);
void *blk_aio_get(const AIOCBInfo *aiocb_info, BlockBackend *blk,
BlockCompletionFunc *cb, void *opaque);
int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset,
- int bytes, BdrvRequestFlags flags);
+ int64_t bytes, BdrvRequestFlags flags);
int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *buf,
int bytes);
int blk_truncate(BlockBackend *blk, int64_t offset, bool exact,
diff --git a/block/block-backend.c b/block/block-backend.c
index 3199f84e96d9..105f0afff970 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1250,7 +1250,7 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t
offset,
/* To be called between exactly one pair of blk_inc/dec_in_flight() */
static int coroutine_fn
-blk_do_pwritev_part(BlockBackend *blk, int64_t offset, unsigned int bytes,
+blk_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes,
QEMUIOVector *qiov, size_t qiov_offset,
BdrvRequestFlags flags)
{
@@ -1286,7 +1286,7 @@ blk_do_pwritev_part(BlockBackend *blk, int64_t offset,
unsigned int bytes,
}
int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset,
- unsigned int bytes,
+ int64_t bytes,
QEMUIOVector *qiov, size_t qiov_offset,
BdrvRequestFlags flags)
{
@@ -1300,7 +1300,7 @@ int coroutine_fn blk_co_pwritev_part(BlockBackend *blk,
int64_t offset,
}
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
- unsigned int bytes, QEMUIOVector *qiov,
+ int64_t bytes, QEMUIOVector *qiov,
BdrvRequestFlags flags)
{
return blk_co_pwritev_part(blk, offset, bytes, qiov, 0, flags);
@@ -2214,7 +2214,7 @@ void *blk_aio_get(const AIOCBInfo *aiocb_info,
BlockBackend *blk,
}
int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset,
- int bytes, BdrvRequestFlags flags)
+ int64_t bytes, BdrvRequestFlags flags)
{
return blk_co_pwritev(blk, offset, bytes, NULL,
flags | BDRV_REQ_ZERO_WRITE);
diff --git a/block/trace-events b/block/trace-events
index ff397ffff485..ab56edacb4fc 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -6,7 +6,7 @@ bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
# block-backend.c
blk_co_preadv(void *blk, void *bs, int64_t offset, int64_t bytes, int flags)
"blk %p bs %p offset %"PRId64" bytes %" PRId64 " flags 0x%x"
-blk_co_pwritev(void *blk, void *bs, int64_t offset, unsigned int bytes, int
flags) "blk %p bs %p offset %"PRId64" bytes %u flags 0x%x"
+blk_co_pwritev(void *blk, void *bs, int64_t offset, int64_t bytes, int flags)
"blk %p bs %p offset %"PRId64" bytes %" PRId64 " flags 0x%x"
blk_root_attach(void *child, void *blk, void *bs) "child %p blk %p bs %p"
blk_root_detach(void *child, void *blk, void *bs) "child %p blk %p bs %p"
--
2.31.1
- [PULL 00/15] NBD patches through 2021-10-15, Eric Blake, 2021/10/15
- [PULL 05/15] block-backend: convert blk_co_pdiscard to int64_t bytes, Eric Blake, 2021/10/15
- [PULL 01/15] qcow2: Silence clang -m32 compiler warning, Eric Blake, 2021/10/15
- [PULL 04/15] block-backend: convert blk_co_pwritev_part to int64_t bytes,
Eric Blake <=
- [PULL 02/15] block-backend: blk_check_byte_request(): int64_t bytes, Eric Blake, 2021/10/15
- [PULL 06/15] block-backend: rename _do_ helper functions to _co_do_, Eric Blake, 2021/10/15
- [PULL 03/15] block-backend: make blk_co_preadv() 64bit, Eric Blake, 2021/10/15
- [PULL 08/15] block-backend: drop blk_prw, use block-coroutine-wrapper, Eric Blake, 2021/10/15
- [PULL 11/15] block-backend: convert blk_aio_ functions to int64_t bytes paramter, Eric Blake, 2021/10/15
- [PULL 09/15] block-backend: convert blk_foo wrappers to use int64_t bytes parameter, Eric Blake, 2021/10/15
- [PULL 10/15] block-backend: convert blk_co_copy_range to int64_t bytes, Eric Blake, 2021/10/15
- [PULL 07/15] block-coroutine-wrapper.py: support BlockBackend first argument, Eric Blake, 2021/10/15
- [PULL 12/15] block-backend: blk_pread, blk_pwrite: rename count parameter to bytes, Eric Blake, 2021/10/15
- [PULL 14/15] block-backend: fix blk_co_flush prototype to mention coroutine_fn, Eric Blake, 2021/10/15