qemuMonitorGetAllBlockStatsInfo: Remove 'backingChain' argument

All (proper) callers pass true so we can remove the argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-10-19 15:25:46 +02:00
parent 4e950ba4b4
commit 5f5631707f
6 changed files with 14 additions and 26 deletions

View File

@ -10051,7 +10051,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver,
} }
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);
nstats = qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats, true); nstats = qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats);
if (capacity && nstats >= 0) { if (capacity && nstats >= 0) {
if (blockdev) if (blockdev)
@ -18477,7 +18477,7 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver,
if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) { if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) {
qemuDomainObjEnterMonitor(driver, dom); qemuDomainObjEnterMonitor(driver, dom);
rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats, true); rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats);
if (rc >= 0) { if (rc >= 0) {
if (blockdev) if (blockdev)

View File

@ -2056,27 +2056,22 @@ qemuMonitorQueryBlockstats(qemuMonitor *mon)
* qemuMonitorGetAllBlockStatsInfo: * qemuMonitorGetAllBlockStatsInfo:
* @mon: monitor object * @mon: monitor object
* @ret_stats: pointer that is filled with a hash table containing the stats * @ret_stats: pointer that is filled with a hash table containing the stats
* @backingChain: recurse into the backing chain of devices
* *
* Creates a hash table in @ret_stats with block stats of all devices. In case * Creates a hash table in @ret_stats with block stats of all devices and the
* @backingChain is true @ret_stats will additionally contain stats for * backing chains for the block devices.
* backing chain members of block devices.
* *
* Returns < 0 on error, count of supported block stats fields on success. * Returns < 0 on error, count of supported block stats fields on success.
*/ */
int int
qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon,
GHashTable **ret_stats, GHashTable **ret_stats)
bool backingChain)
{ {
int ret; int ret;
g_autoptr(GHashTable) stats = virHashNew(g_free); g_autoptr(GHashTable) stats = virHashNew(g_free);
VIR_DEBUG("ret_stats=%p, backing=%d", ret_stats, backingChain);
QEMU_CHECK_MONITOR(mon); QEMU_CHECK_MONITOR(mon);
ret = qemuMonitorJSONGetAllBlockStatsInfo(mon, stats, backingChain); ret = qemuMonitorJSONGetAllBlockStatsInfo(mon, stats);
if (ret < 0) if (ret < 0)
return -1; return -1;

View File

@ -738,8 +738,7 @@ struct _qemuBlockStats {
}; };
int qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, int qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon,
GHashTable **ret_stats, GHashTable **ret_stats)
bool backingChain)
ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(2);
int qemuMonitorBlockStatsUpdateCapacity(qemuMonitor *mon, int qemuMonitorBlockStatsUpdateCapacity(qemuMonitor *mon,

View File

@ -2469,8 +2469,7 @@ static int
qemuMonitorJSONGetOneBlockStatsInfo(virJSONValue *dev, qemuMonitorJSONGetOneBlockStatsInfo(virJSONValue *dev,
const char *dev_name, const char *dev_name,
int depth, int depth,
GHashTable *hash, GHashTable *hash)
bool backingChain)
{ {
g_autofree qemuBlockStats *bstats = NULL; g_autofree qemuBlockStats *bstats = NULL;
int nstats = 0; int nstats = 0;
@ -2507,10 +2506,8 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValue *dev,
qemuMonitorJSONAddOneBlockStatsInfo(bstats, nodename, hash) < 0) qemuMonitorJSONAddOneBlockStatsInfo(bstats, nodename, hash) < 0)
return -1; return -1;
if (backingChain && if ((backing = virJSONValueObjectGetObject(dev, "backing")) &&
(backing = virJSONValueObjectGetObject(dev, "backing")) && qemuMonitorJSONGetOneBlockStatsInfo(backing, dev_name, depth + 1, hash) < 0)
qemuMonitorJSONGetOneBlockStatsInfo(backing, dev_name, depth + 1,
hash, true) < 0)
return -1; return -1;
return nstats; return nstats;
@ -2538,8 +2535,7 @@ qemuMonitorJSONQueryBlockstats(qemuMonitor *mon)
int int
qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon,
GHashTable *hash, GHashTable *hash)
bool backingChain)
{ {
int nstats = 0; int nstats = 0;
int rc; int rc;
@ -2570,8 +2566,7 @@ qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon,
if (*dev_name == '\0') if (*dev_name == '\0')
dev_name = NULL; dev_name = NULL;
rc = qemuMonitorJSONGetOneBlockStatsInfo(dev, dev_name, 0, hash, rc = qemuMonitorJSONGetOneBlockStatsInfo(dev, dev_name, 0, hash);
backingChain);
if (rc < 0) if (rc < 0)
return -1; return -1;

View File

@ -77,8 +77,7 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitor *mon,
virJSONValue *qemuMonitorJSONQueryBlockstats(qemuMonitor *mon); virJSONValue *qemuMonitorJSONQueryBlockstats(qemuMonitor *mon);
int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon,
GHashTable *hash, GHashTable *hash);
bool backingChain);
int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon,
GHashTable *stats, GHashTable *stats,
bool backingChain); bool backingChain);

View File

@ -1657,7 +1657,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void *opaque)
CHECK0FULL(wr_highest_offset_valid, WR_HIGHEST_OFFSET_VALID, "%d", "%d") CHECK0FULL(wr_highest_offset_valid, WR_HIGHEST_OFFSET_VALID, "%d", "%d")
if (qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorTestGetMonitor(test), if (qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorTestGetMonitor(test),
blockstats, false) < 0) blockstats) < 0)
return -1; return -1;
if (!blockstats) { if (!blockstats) {