Skip to content

Commit 34460fe

Browse files
Vladimir Sementsov-Ogievskiyebblake
authored andcommitted
block-backend: convert blk_co_pwritev_part to int64_t bytes
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 <[email protected]> Message-Id: <[email protected]> Reviewed-by: Eric Blake <[email protected]> [eblake: grammar tweaks] Signed-off-by: Eric Blake <[email protected]>
1 parent 9547907 commit 34460fe

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

block/block-backend.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
12501250

12511251
/* To be called between exactly one pair of blk_inc/dec_in_flight() */
12521252
static int coroutine_fn
1253-
blk_do_pwritev_part(BlockBackend *blk, int64_t offset, unsigned int bytes,
1253+
blk_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes,
12541254
QEMUIOVector *qiov, size_t qiov_offset,
12551255
BdrvRequestFlags flags)
12561256
{
@@ -1286,7 +1286,7 @@ blk_do_pwritev_part(BlockBackend *blk, int64_t offset, unsigned int bytes,
12861286
}
12871287

12881288
int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset,
1289-
unsigned int bytes,
1289+
int64_t bytes,
12901290
QEMUIOVector *qiov, size_t qiov_offset,
12911291
BdrvRequestFlags flags)
12921292
{
@@ -1300,7 +1300,7 @@ int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset,
13001300
}
13011301

13021302
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
1303-
unsigned int bytes, QEMUIOVector *qiov,
1303+
int64_t bytes, QEMUIOVector *qiov,
13041304
BdrvRequestFlags flags)
13051305
{
13061306
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,
22142214
}
22152215

22162216
int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset,
2217-
int bytes, BdrvRequestFlags flags)
2217+
int64_t bytes, BdrvRequestFlags flags)
22182218
{
22192219
return blk_co_pwritev(blk, offset, bytes, NULL,
22202220
flags | BDRV_REQ_ZERO_WRITE);

block/trace-events

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
66

77
# block-backend.c
88
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"
9-
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"
9+
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"
1010
blk_root_attach(void *child, void *blk, void *bs) "child %p blk %p bs %p"
1111
blk_root_detach(void *child, void *blk, void *bs) "child %p blk %p bs %p"
1212

include/sysemu/block-backend.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
129129
int64_t bytes, QEMUIOVector *qiov,
130130
BdrvRequestFlags flags);
131131
int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset,
132-
unsigned int bytes,
132+
int64_t bytes,
133133
QEMUIOVector *qiov, size_t qiov_offset,
134134
BdrvRequestFlags flags);
135135
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
136-
unsigned int bytes, QEMUIOVector *qiov,
136+
int64_t bytes, QEMUIOVector *qiov,
137137
BdrvRequestFlags flags);
138138

139139
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);
243243
void *blk_aio_get(const AIOCBInfo *aiocb_info, BlockBackend *blk,
244244
BlockCompletionFunc *cb, void *opaque);
245245
int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset,
246-
int bytes, BdrvRequestFlags flags);
246+
int64_t bytes, BdrvRequestFlags flags);
247247
int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *buf,
248248
int bytes);
249249
int blk_truncate(BlockBackend *blk, int64_t offset, bool exact,

0 commit comments

Comments
 (0)