A block patch for the block queue

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEvBAABCAAZBQJXe8oeEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrW2J
 CACowBCu25JLV62YpEj6aoCBqv9c8BtkFJd5nReJDU4XKAL/b5NGyk57CvBbL7gw
 yQeSoF9hBfziIk38jMwM2a2uXpyFAGiLDAy1qPj7C/DqWK2h7u0HQM6T45eIdFUa
 lMDettBCOtqAQCbzYDOwPrfNWB35bWglMl9WpuIxOyhts70pCjo6IshXQOZKQqgL
 LK1t9B4J9BATIrHsSBrjqXdg4zHkDwC5SaBU5yKNh8Ub58EEYhNMMUr/5818CeaK
 XpOq8Nl+TrDBBXjxQfHkqvJU+e3uNqZiDJtQFdvpBeaNPCjMHJXx6A7hT0nIfeIU
 Ba+1UA0DuMy1rLT+SoEwtpk2
 =F3RP
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-07-05-v2' into queue-block

A block patch for the block queue

# gpg: Signature made Tue Jul  5 16:54:22 2016 CEST
# gpg:                using RSA key 0x3BB14202E838ACAD
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>"
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40
#      Subkey fingerprint: 58B3 81CE 2DC8 9CF9 9730  EE64 3BB1 4202 E838 ACAD

* mreitz/tags/pull-block-for-kevin-2016-07-05-v2:
  block/qcow2: Don't use cpu_to_*w()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Kevin Wolf 2016-07-05 16:55:31 +02:00
commit b0aaca4d7f
3 changed files with 9 additions and 10 deletions

View file

@ -117,7 +117,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
/* set new table */
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ACTIVATE_TABLE);
cpu_to_be32w((uint32_t*)data, new_l1_size);
stl_be_p(data, new_l1_size);
stq_be_p(data + 4, new_l1_table_offset);
ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, l1_size),
data, sizeof(data));

View file

@ -562,8 +562,8 @@ static int alloc_refcount_block(BlockDriverState *bs,
uint64_t d64;
uint32_t d32;
} data;
cpu_to_be64w(&data.d64, table_offset);
cpu_to_be32w(&data.d32, table_clusters);
data.d64 = cpu_to_be64(table_offset);
data.d32 = cpu_to_be32(table_clusters);
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_SWITCH_TABLE);
ret = bdrv_pwrite_sync(bs->file,
offsetof(QCowHeader, refcount_table_offset),
@ -2155,10 +2155,9 @@ write_refblocks:
}
/* Enter new reftable into the image header */
cpu_to_be64w(&reftable_offset_and_clusters.reftable_offset,
reftable_offset);
cpu_to_be32w(&reftable_offset_and_clusters.reftable_clusters,
size_to_clusters(s, reftable_size * sizeof(uint64_t)));
reftable_offset_and_clusters.reftable_offset = cpu_to_be64(reftable_offset);
reftable_offset_and_clusters.reftable_clusters =
cpu_to_be32(size_to_clusters(s, reftable_size * sizeof(uint64_t)));
ret = bdrv_pwrite_sync(bs->file,
offsetof(QCowHeader, refcount_table_offset),
&reftable_offset_and_clusters,

View file

@ -2739,9 +2739,9 @@ static int make_completely_empty(BlockDriverState *bs)
/* "Create" an empty reftable (one cluster) directly after the image
* header and an empty L1 table three clusters after the image header;
* the cluster between those two will be used as the first refblock */
cpu_to_be64w(&l1_ofs_rt_ofs_cls.l1_offset, 3 * s->cluster_size);
cpu_to_be64w(&l1_ofs_rt_ofs_cls.reftable_offset, s->cluster_size);
cpu_to_be32w(&l1_ofs_rt_ofs_cls.reftable_clusters, 1);
l1_ofs_rt_ofs_cls.l1_offset = cpu_to_be64(3 * s->cluster_size);
l1_ofs_rt_ofs_cls.reftable_offset = cpu_to_be64(s->cluster_size);
l1_ofs_rt_ofs_cls.reftable_clusters = cpu_to_be32(1);
ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, l1_table_offset),
&l1_ofs_rt_ofs_cls, sizeof(l1_ofs_rt_ofs_cls));
if (ret < 0) {