aboutsummaryrefslogtreecommitdiff
path: root/qemu-io-cmds.c
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2019-05-14 16:57:35 +0300
committerKevin Wolf <kwolf@redhat.com>2019-05-20 17:08:56 +0200
commit41ae31e3d7696ec639b8fd6c162846244eeaa511 (patch)
treeb944c904d605789c320aff6f9aea39c3e48b6593 /qemu-io-cmds.c
parentb6c246942b14d3e0dec46a6c5868ed84e7dbea19 (diff)
downloadqemu-41ae31e3d7696ec639b8fd6c162846244eeaa511.zip
qemu-41ae31e3d7696ec639b8fd6c162846244eeaa511.tar.gz
qemu-41ae31e3d7696ec639b8fd6c162846244eeaa511.tar.bz2
block: Use BDRV_REQUEST_MAX_BYTES instead of BDRV_REQUEST_MAX_SECTORS
There are a few places in which we turn a number of bytes into sectors in order to compare the result against BDRV_REQUEST_MAX_SECTORS instead of using BDRV_REQUEST_MAX_BYTES directly. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-io-cmds.c')
-rw-r--r--qemu-io-cmds.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 8826beb..30a7d9a 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -538,7 +538,7 @@ static int do_write_compressed(BlockBackend *blk, char *buf, int64_t offset,
{
int ret;
- if (bytes >> 9 > BDRV_REQUEST_MAX_SECTORS) {
+ if (bytes > BDRV_REQUEST_MAX_BYTES) {
return -ERANGE;
}
@@ -1781,10 +1781,9 @@ static int discard_f(BlockBackend *blk, int argc, char **argv)
if (bytes < 0) {
print_cvtnum_err(bytes, argv[optind]);
return bytes;
- } else if (bytes >> BDRV_SECTOR_BITS > BDRV_REQUEST_MAX_SECTORS) {
+ } else if (bytes > BDRV_REQUEST_MAX_BYTES) {
printf("length cannot exceed %"PRIu64", given %s\n",
- (uint64_t)BDRV_REQUEST_MAX_SECTORS << BDRV_SECTOR_BITS,
- argv[optind]);
+ (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]);
return -EINVAL;
}