mirror of
https://github.com/qemu/qemu.git
synced 2025-08-09 01:50:43 +00:00
qcow2: Use BDRV_SECTOR_BITS instead of its literal value
BDRV_SECTOR_BITS is defined to be 9 in block.h (and BDRV_SECTOR_SIZE is calculated from that), but there are still a couple of places where we are using the literal value instead of the macro. Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: 20171009153856.20387-1-berto@igalia.com Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
67e56472a5
commit
a35f87f50d
@ -1139,7 +1139,7 @@ static int qcow2_do_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
|
|
||||||
s->cluster_bits = header.cluster_bits;
|
s->cluster_bits = header.cluster_bits;
|
||||||
s->cluster_size = 1 << s->cluster_bits;
|
s->cluster_size = 1 << s->cluster_bits;
|
||||||
s->cluster_sectors = 1 << (s->cluster_bits - 9);
|
s->cluster_sectors = 1 << (s->cluster_bits - BDRV_SECTOR_BITS);
|
||||||
|
|
||||||
/* Initialise version 3 header fields */
|
/* Initialise version 3 header fields */
|
||||||
if (header.version == 2) {
|
if (header.version == 2) {
|
||||||
@ -1636,7 +1636,7 @@ static int64_t coroutine_fn qcow2_co_get_block_status(BlockDriverState *bs,
|
|||||||
|
|
||||||
bytes = MIN(INT_MAX, nb_sectors * BDRV_SECTOR_SIZE);
|
bytes = MIN(INT_MAX, nb_sectors * BDRV_SECTOR_SIZE);
|
||||||
qemu_co_mutex_lock(&s->lock);
|
qemu_co_mutex_lock(&s->lock);
|
||||||
ret = qcow2_get_cluster_offset(bs, sector_num << 9, &bytes,
|
ret = qcow2_get_cluster_offset(bs, sector_num << BDRV_SECTOR_BITS, &bytes,
|
||||||
&cluster_offset);
|
&cluster_offset);
|
||||||
qemu_co_mutex_unlock(&s->lock);
|
qemu_co_mutex_unlock(&s->lock);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user