mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
-----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJbFptuAAoJEL2+eyfA3jBX7QUQAIPkoxsRRBo/XYRJjzoI7T2K I1Rzcd9x6ojf/XOPkZwgVVVhVLN8j2zGxdJBl8FJnpLiwzeTwtJqFMyZ5hmGBhK3 qOiz3TSWulTVYM7nbmwBCKCOIxmN/Mty4QwJNKFYrhFGcCZ7FyuKuokah+yGE/J8 XrNmy5bQU+qqtwsO2MRWZ02HQ5kv0NYtJ/+ph/y7xzhZ2AL2NiqEIO6nbkdRA/s1 zO7uyrQIY/iHuZbBPPIdGMM55pyeTcj7JMfdUhVnu+SpTB7sMXpoKJwLT2P+3czw t2mffSGW/n/Q3BN7QOaJ66VeTVA2l8CqBAeEoEsN3d0SRyc6mTPOsOTPf9uanaJo J0bEx28yWl+en4mWN5PjEQyqfR0rTBMZlyaArGsD6TDu8YpF8UwF3TzDhH0ctbhB DD1WXIBtSBYb5hU8F/BBdm8xs03Zubk+Dwb5Wkc31G28Ic7EfHVSlftBu3JytHBV nXdjDfSI7e9JtGHOUYbMAcrO6JQgKNAumd+fkQCLpPnMMiRzGCISABH9VD47x6Td 1CzJ+9VScfFufsSjoFSp3yz+I+RikzqQC+CiYSs8QYsUWWxi3qht3KbSoXP5uoS9 OXMBw/KT2RJNkTUophunkWUgpCHyzJbK03/tvtrgwfpxluyIQYvBw6epB99AUwRW 9FM/sR+ZR8fkG4/A/Clg =sVqd -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging # gpg: Signature made Tue 05 Jun 2018 15:17:18 BST # gpg: using RSA key BDBE7B27C0DE3057 # gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>" # gpg: aka "Jeffrey Cody <jeff@codyprime.org>" # gpg: aka "Jeffrey Cody <codyprime@gmail.com>" # Primary key fingerprint: 9957 4B4D 3474 90E7 9D98 D624 BDBE 7B27 C0DE 3057 * remotes/cody/tags/block-pull-request: sheepdog: remove huge BSS object sheepdog: cleanup repeated expression Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
1d889f2a8b
1 changed files with 15 additions and 13 deletions
|
@ -2335,7 +2335,7 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we don't need to update entire object */
|
/* we don't need to update entire object */
|
||||||
datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
|
datalen = SD_INODE_HEADER_SIZE;
|
||||||
s->inode.vdi_size = offset;
|
s->inode.vdi_size = offset;
|
||||||
ret = write_object(fd, s->bs, (char *)&s->inode,
|
ret = write_object(fd, s->bs, (char *)&s->inode,
|
||||||
vid_to_vdi_oid(s->inode.vdi_id), s->inode.nr_copies,
|
vid_to_vdi_oid(s->inode.vdi_id), s->inode.nr_copies,
|
||||||
|
@ -2703,7 +2703,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
|
||||||
*/
|
*/
|
||||||
strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag));
|
strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag));
|
||||||
/* we don't need to update entire object */
|
/* we don't need to update entire object */
|
||||||
datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
|
datalen = SD_INODE_HEADER_SIZE;
|
||||||
inode = g_malloc(datalen);
|
inode = g_malloc(datalen);
|
||||||
|
|
||||||
/* refresh inode. */
|
/* refresh inode. */
|
||||||
|
@ -2938,13 +2938,14 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
|
||||||
QEMUSnapshotInfo *sn_tab = NULL;
|
QEMUSnapshotInfo *sn_tab = NULL;
|
||||||
unsigned wlen, rlen;
|
unsigned wlen, rlen;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
static SheepdogInode inode;
|
SheepdogInode *inode;
|
||||||
unsigned long *vdi_inuse;
|
unsigned long *vdi_inuse;
|
||||||
unsigned int start_nr;
|
unsigned int start_nr;
|
||||||
uint64_t hval;
|
uint64_t hval;
|
||||||
uint32_t vid;
|
uint32_t vid;
|
||||||
|
|
||||||
vdi_inuse = g_malloc(max);
|
vdi_inuse = g_malloc(max);
|
||||||
|
inode = g_malloc(SD_INODE_HEADER_SIZE);
|
||||||
|
|
||||||
fd = connect_to_sdog(s, &local_err);
|
fd = connect_to_sdog(s, &local_err);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
@ -2987,26 +2988,26 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we don't need to read entire object */
|
/* we don't need to read entire object */
|
||||||
ret = read_object(fd, s->bs, (char *)&inode,
|
ret = read_object(fd, s->bs, (char *)inode,
|
||||||
vid_to_vdi_oid(vid),
|
vid_to_vdi_oid(vid),
|
||||||
0, SD_INODE_SIZE - sizeof(inode.data_vdi_id), 0,
|
0, SD_INODE_HEADER_SIZE, 0,
|
||||||
s->cache_flags);
|
s->cache_flags);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(inode.name, s->name) && is_snapshot(&inode)) {
|
if (!strcmp(inode->name, s->name) && is_snapshot(inode)) {
|
||||||
sn_tab[found].date_sec = inode.snap_ctime >> 32;
|
sn_tab[found].date_sec = inode->snap_ctime >> 32;
|
||||||
sn_tab[found].date_nsec = inode.snap_ctime & 0xffffffff;
|
sn_tab[found].date_nsec = inode->snap_ctime & 0xffffffff;
|
||||||
sn_tab[found].vm_state_size = inode.vm_state_size;
|
sn_tab[found].vm_state_size = inode->vm_state_size;
|
||||||
sn_tab[found].vm_clock_nsec = inode.vm_clock_nsec;
|
sn_tab[found].vm_clock_nsec = inode->vm_clock_nsec;
|
||||||
|
|
||||||
snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str),
|
snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str),
|
||||||
"%" PRIu32, inode.snap_id);
|
"%" PRIu32, inode->snap_id);
|
||||||
pstrcpy(sn_tab[found].name,
|
pstrcpy(sn_tab[found].name,
|
||||||
MIN(sizeof(sn_tab[found].name), sizeof(inode.tag)),
|
MIN(sizeof(sn_tab[found].name), sizeof(inode->tag)),
|
||||||
inode.tag);
|
inode->tag);
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3016,6 +3017,7 @@ out:
|
||||||
*psn_tab = sn_tab;
|
*psn_tab = sn_tab;
|
||||||
|
|
||||||
g_free(vdi_inuse);
|
g_free(vdi_inuse);
|
||||||
|
g_free(inode);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue