提交 ca979b06 编写于 作者: J Jiri Denemark

qemuDomainBlockCommit: Don't track top_canon path separately

virStorageFileChainLookup is able to give use virStorageSourcePtr which
contains the pointer to its canonical path. There's no need for the
caller to store both of them.

Former top_meta maps to topSource and top_canon maps to topSource->path.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 fe190434
...@@ -15285,8 +15285,7 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base, ...@@ -15285,8 +15285,7 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base,
int ret = -1; int ret = -1;
int idx; int idx;
virDomainDiskDefPtr disk = NULL; virDomainDiskDefPtr disk = NULL;
const char *top_canon = NULL; virStorageSourcePtr topSource;
virStorageSourcePtr top_meta = NULL;
const char *top_parent = NULL; const char *top_parent = NULL;
const char *base_canon = NULL; const char *base_canon = NULL;
bool clean_access = false; bool clean_access = false;
...@@ -15329,22 +15328,22 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base, ...@@ -15329,22 +15328,22 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base,
goto endjob; goto endjob;
if (!top) { if (!top) {
top_canon = disk->src.path; topSource = &disk->src;
top_meta = &disk->src; } else if (!(virStorageFileChainLookup(&disk->src,
} else if (!(top_canon = virStorageFileChainLookup(&disk->src, top, &topSource,
top, &top_meta,
&top_parent))) { &top_parent))) {
goto endjob; goto endjob;
} }
if (!top_meta || !top_meta->backingStore) { if (!topSource->backingStore) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("top '%s' in chain for '%s' has no backing file"), _("top '%s' in chain for '%s' has no backing file"),
top_canon, path); topSource->path, path);
goto endjob; goto endjob;
} }
if (!base && (flags & VIR_DOMAIN_BLOCK_COMMIT_SHALLOW)) if (!base && (flags & VIR_DOMAIN_BLOCK_COMMIT_SHALLOW))
base_canon = top_meta->backingStore->path; base_canon = topSource->backingStore->path;
else if (!(base_canon = virStorageFileChainLookup(top_meta, else if (!(base_canon = virStorageFileChainLookup(topSource,
base, NULL, NULL))) base, NULL, NULL)))
goto endjob; goto endjob;
...@@ -15352,11 +15351,11 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base, ...@@ -15352,11 +15351,11 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base,
* virStorageFileChainLookup guarantees a simple pointer * virStorageFileChainLookup guarantees a simple pointer
* comparison will work, rather than needing full-blown STREQ. */ * comparison will work, rather than needing full-blown STREQ. */
if ((flags & VIR_DOMAIN_BLOCK_COMMIT_SHALLOW) && if ((flags & VIR_DOMAIN_BLOCK_COMMIT_SHALLOW) &&
base_canon != top_meta->backingStore->path) { base_canon != topSource->backingStore->path) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("base '%s' is not immediately below '%s' in chain " _("base '%s' is not immediately below '%s' in chain "
"for '%s'"), "for '%s'"),
base, top_canon, path); base, topSource->path, path);
goto endjob; goto endjob;
} }
...@@ -15383,7 +15382,7 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base, ...@@ -15383,7 +15382,7 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base,
* thing if the user specified a relative name). */ * thing if the user specified a relative name). */
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorBlockCommit(priv->mon, device, ret = qemuMonitorBlockCommit(priv->mon, device,
top ? top : top_canon, top ? top : topSource->path,
base ? base : base_canon, bandwidth); base ? base : base_canon, bandwidth);
qemuDomainObjExitMonitor(driver, vm); qemuDomainObjExitMonitor(driver, vm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册