]> Git Repo - qemu.git/commitdiff
qcow2: Use BDRV_SECTOR_BITS instead of its literal value
authorAlberto Garcia <[email protected]>
Mon, 9 Oct 2017 15:38:56 +0000 (17:38 +0200)
committerMax Reitz <[email protected]>
Thu, 26 Oct 2017 13:01:13 +0000 (15:01 +0200)
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 <[email protected]>
Message-id: 20171009153856[email protected]
Signed-off-by: Max Reitz <[email protected]>
block/qcow2.c

index fbf9464d3ada0bdeea2c49395fa3779db0e8884f..f77b490cc68f7eda20b6b43ed1a311284058f549 100644 (file)
@@ -1139,7 +1139,7 @@ static int qcow2_do_open(BlockDriverState *bs, QDict *options, int flags,
 
     s->cluster_bits = header.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 */
     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);
     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);
     qemu_co_mutex_unlock(&s->lock);
     if (ret < 0) {
This page took 0.033219 seconds and 4 git commands to generate.