Skip to content

Commit 2800637

Browse files
Vladimir Sementsov-Ogievskiyebblake
authored andcommitted
block-backend: convert blk_co_pdiscard to int64_t bytes
We updated blk_do_pdiscard() and its wrapper blk_co_pdiscard(). Both functions are updated so that the parameter type becomes wider, so all callers should be OK with it. Look at blk_do_pdiscard(): bytes is passed only to blk_check_byte_request() and bdrv_co_pdiscard(), which already have int64_t bytes parameter, so we are OK. 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 34460fe commit 2800637

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

block/block-backend.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
16261626

16271627
/* To be called between exactly one pair of blk_inc/dec_in_flight() */
16281628
static int coroutine_fn
1629-
blk_do_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
1629+
blk_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes)
16301630
{
16311631
int ret;
16321632

@@ -1657,7 +1657,8 @@ BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
16571657
cb, opaque);
16581658
}
16591659

1660-
int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
1660+
int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset,
1661+
int64_t bytes)
16611662
{
16621663
int ret;
16631664

include/sysemu/block-backend.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ void blk_aio_cancel_async(BlockAIOCB *acb);
181181
int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf);
182182
BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
183183
BlockCompletionFunc *cb, void *opaque);
184-
int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes);
184+
int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset,
185+
int64_t bytes);
185186
int blk_co_flush(BlockBackend *blk);
186187
int blk_flush(BlockBackend *blk);
187188
int blk_commit_all(void);

0 commit comments

Comments
 (0)