提交 59ba7023 编写于 作者: J John Ferlan

Convert virDomainVcpuPinDefPtr to virDomainPinDefPtr

As pointed out by jtomko in his review of the IOThreads pinning code:

http://www.redhat.com/archives/libvir-list/2015-March/msg00495.html

there are some comments sprinkled in indicating IOThreads were using
the same structure as the VcpuPin code...

This is the first patch of a few that will change the virDomainVcpuPin*
structures and code to just virDomainPin* - starting with the data
structure naming...
上级 ffa9f8a1
......@@ -2003,11 +2003,11 @@ virDomainClockDefClear(virDomainClockDefPtr def)
VIR_FREE(def->timers);
}
virDomainVcpuPinDefPtr *
virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin)
virDomainPinDefPtr *
virDomainVcpuPinDefCopy(virDomainPinDefPtr *src, int nvcpupin)
{
size_t i;
virDomainVcpuPinDefPtr *ret = NULL;
virDomainPinDefPtr *ret = NULL;
if (VIR_ALLOC_N(ret, nvcpupin) < 0)
goto error;
......@@ -2037,7 +2037,7 @@ virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin)
}
void
virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr def)
virDomainVcpuPinDefFree(virDomainPinDefPtr def)
{
if (def) {
virBitmapFree(def->cpumask);
......@@ -2046,7 +2046,7 @@ virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr def)
}
void
virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def,
virDomainVcpuPinDefArrayFree(virDomainPinDefPtr *def,
int nvcpupin)
{
size_t i;
......@@ -12759,14 +12759,14 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt,
* A vcpuid of -1 is valid and only valid for emulatorpin. So callers
* have to check the returned cpuid for validity.
*/
static virDomainVcpuPinDefPtr
static virDomainPinDefPtr
virDomainVcpuPinDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
int maxvcpus,
bool emulator,
bool iothreads)
{
virDomainVcpuPinDefPtr def;
virDomainPinDefPtr def;
xmlNodePtr oldnode = ctxt->node;
int vcpuid = -1;
unsigned int iothreadid;
......@@ -13523,7 +13523,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
for (i = 0; i < n; i++) {
virDomainVcpuPinDefPtr vcpupin = NULL;
virDomainPinDefPtr vcpupin = NULL;
vcpupin = virDomainVcpuPinDefParseXML(nodes[i], ctxt,
def->maxvcpus, false, false);
......@@ -13566,7 +13566,7 @@ virDomainDefParseXML(xmlDocPtr xml,
i))
continue;
virDomainVcpuPinDefPtr vcpupin = NULL;
virDomainPinDefPtr vcpupin = NULL;
if (VIR_ALLOC(vcpupin) < 0)
goto error;
......@@ -13615,7 +13615,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
for (i = 0; i < n; i++) {
virDomainVcpuPinDefPtr iothreadpin = NULL;
virDomainPinDefPtr iothreadpin = NULL;
iothreadpin = virDomainVcpuPinDefParseXML(nodes[i], ctxt,
def->iothreads,
false, true);
......@@ -16737,7 +16737,7 @@ virDomainDefAddImplicitControllers(virDomainDefPtr def)
/* Check if vcpupin with same vcpuid already exists.
* Return 1 if exists, 0 if not. */
int
virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
virDomainVcpuPinIsDuplicate(virDomainPinDefPtr *def,
int nvcpupin,
int vcpu)
{
......@@ -16754,8 +16754,8 @@ virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
return 0;
}
virDomainVcpuPinDefPtr
virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
virDomainPinDefPtr
virDomainVcpuPinFindByVcpu(virDomainPinDefPtr *def,
int nvcpupin,
int vcpu)
{
......@@ -16773,13 +16773,13 @@ virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
}
int
virDomainVcpuPinAdd(virDomainVcpuPinDefPtr **vcpupin_list,
virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list,
size_t *nvcpupin,
unsigned char *cpumap,
int maplen,
int vcpu)
{
virDomainVcpuPinDefPtr vcpupin = NULL;
virDomainPinDefPtr vcpupin = NULL;
if (!vcpupin_list)
return -1;
......@@ -16821,7 +16821,7 @@ void
virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
{
int n;
virDomainVcpuPinDefPtr *vcpupin_list = def->cputune.vcpupin;
virDomainPinDefPtr *vcpupin_list = def->cputune.vcpupin;
for (n = 0; n < def->cputune.nvcpupin; n++) {
if (vcpupin_list[n]->vcpuid == vcpu) {
......@@ -16838,7 +16838,7 @@ virDomainEmulatorPinAdd(virDomainDefPtr def,
unsigned char *cpumap,
int maplen)
{
virDomainVcpuPinDefPtr emulatorpin = NULL;
virDomainPinDefPtr emulatorpin = NULL;
if (!def->cputune.emulatorpin) {
/* No emulatorpin exists yet. */
......@@ -16879,14 +16879,13 @@ virDomainEmulatorPinDel(virDomainDefPtr def)
}
int
virDomainIOThreadsPinAdd(virDomainVcpuPinDefPtr **iothreadspin_list,
virDomainIOThreadsPinAdd(virDomainPinDefPtr **iothreadspin_list,
size_t *niothreadspin,
unsigned char *cpumap,
int maplen,
unsigned int iothread_id)
{
/* IOThreads share the virDomainVcpuPinDefPtr */
virDomainVcpuPinDefPtr iothreadpin = NULL;
virDomainPinDefPtr iothreadpin = NULL;
if (!iothreadspin_list)
return -1;
......@@ -16929,8 +16928,7 @@ virDomainIOThreadsPinDel(virDomainDefPtr def,
unsigned int iothread_id)
{
size_t i;
/* IOThreads share the virDomainVcpuPinDefPtr */
virDomainVcpuPinDefPtr *iothreadspin_list = def->cputune.iothreadspin;
virDomainPinDefPtr *iothreadspin_list = def->cputune.iothreadspin;
for (i = 0; i < def->cputune.niothreadspin; i++) {
if (iothreadspin_list[i]->vcpuid == iothread_id) {
......
......@@ -1900,26 +1900,26 @@ struct _virDomainClockDef {
# define VIR_DOMAIN_CPUMASK_LEN 1024
typedef struct _virDomainVcpuPinDef virDomainVcpuPinDef;
typedef virDomainVcpuPinDef *virDomainVcpuPinDefPtr;
struct _virDomainVcpuPinDef {
typedef struct _virDomainPinDef virDomainPinDef;
typedef virDomainPinDef *virDomainPinDefPtr;
struct _virDomainPinDef {
int vcpuid;
virBitmapPtr cpumask;
};
void virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr def);
void virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def, int nvcpupin);
void virDomainVcpuPinDefFree(virDomainPinDefPtr def);
void virDomainVcpuPinDefArrayFree(virDomainPinDefPtr *def, int nvcpupin);
virDomainVcpuPinDefPtr *virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src,
int nvcpupin);
virDomainPinDefPtr *virDomainVcpuPinDefCopy(virDomainPinDefPtr *src,
int nvcpupin);
int virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
int virDomainVcpuPinIsDuplicate(virDomainPinDefPtr *def,
int nvcpupin,
int vcpu);
virDomainVcpuPinDefPtr virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
int nvcpupin,
int vcpu);
virDomainPinDefPtr virDomainVcpuPinFindByVcpu(virDomainPinDefPtr *def,
int nvcpupin,
int vcpu);
typedef struct _virBlkioDevice virBlkioDevice;
typedef virBlkioDevice *virBlkioDevicePtr;
......@@ -2009,10 +2009,10 @@ struct _virDomainCputune {
unsigned long long emulator_period;
long long emulator_quota;
size_t nvcpupin;
virDomainVcpuPinDefPtr *vcpupin;
virDomainVcpuPinDefPtr emulatorpin;
virDomainPinDefPtr *vcpupin;
virDomainPinDefPtr emulatorpin;
size_t niothreadspin;
virDomainVcpuPinDefPtr *iothreadspin;
virDomainPinDefPtr *iothreadspin;
size_t nvcpusched;
virDomainThreadSchedParamPtr vcpusched;
......@@ -2557,7 +2557,7 @@ int virDomainDefCompatibleDevice(virDomainDefPtr def,
virDomainDeviceDefPtr dev,
virDomainDeviceAction action);
int virDomainVcpuPinAdd(virDomainVcpuPinDefPtr **vcpupin_list,
int virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list,
size_t *nvcpupin,
unsigned char *cpumap,
int maplen,
......@@ -2571,8 +2571,7 @@ int virDomainEmulatorPinAdd(virDomainDefPtr def,
int virDomainEmulatorPinDel(virDomainDefPtr def);
/* IOThreads share the virDomainVcpuPinDefPtr */
int virDomainIOThreadsPinAdd(virDomainVcpuPinDefPtr **iothreadspin_list,
int virDomainIOThreadsPinAdd(virDomainPinDefPtr **iothreadspin_list,
size_t *niothreads,
unsigned char *cpumap,
int maplen,
......
......@@ -2047,7 +2047,7 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
virDomainObjPtr vm = NULL;
virDomainDefPtr targetDef = NULL;
virDomainVcpuPinDefPtr *vcpupin_list;
virDomainPinDefPtr *vcpupin_list;
virBitmapPtr cpumask = NULL;
int maxcpu, hostcpus, vcpu, pcpu, n, ret = -1;
unsigned char *cpumap;
......
......@@ -941,7 +941,7 @@ qemuSetupCgroupVcpuBW(virCgroupPtr cgroup,
int
qemuSetupCgroupVcpuPin(virCgroupPtr cgroup,
virDomainVcpuPinDefPtr *vcpupin,
virDomainPinDefPtr *vcpupin,
int nvcpupin,
int vcpuid)
{
......@@ -957,7 +957,7 @@ qemuSetupCgroupVcpuPin(virCgroupPtr cgroup,
int
qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup,
virDomainVcpuPinDefPtr *iothreadspin,
virDomainPinDefPtr *iothreadspin,
int niothreadspin,
int iothreadid)
{
......
......@@ -53,12 +53,12 @@ int qemuSetupCgroupVcpuBW(virCgroupPtr cgroup,
unsigned long long period,
long long quota);
int qemuSetupCgroupVcpuPin(virCgroupPtr cgroup,
virDomainVcpuPinDefPtr *vcpupin,
virDomainPinDefPtr *vcpupin,
int nvcpupin,
int vcpuid);
int qemuSetupCgroupEmulatorPin(virCgroupPtr cgroup, virBitmapPtr cpumask);
int qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup,
virDomainVcpuPinDefPtr *iothreadspin,
virDomainPinDefPtr *iothreadspin,
int niothreadspin,
int iothreadid);
int qemuSetupCgroupForVcpu(virDomainObjPtr vm);
......
......@@ -4744,7 +4744,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
/* vm->def->cputune.vcpupin can't be NULL if
* vm->def->cpumask is not NULL.
*/
virDomainVcpuPinDefPtr vcpupin = NULL;
virDomainPinDefPtr vcpupin = NULL;
if (VIR_ALLOC(vcpupin) < 0)
goto cleanup;
......@@ -5046,7 +5046,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
qemuDomainObjPrivatePtr priv;
bool doReset = false;
size_t newVcpuPinNum = 0;
virDomainVcpuPinDefPtr *newVcpuPin = NULL;
virDomainPinDefPtr *newVcpuPin = NULL;
virBitmapPtr pcpumap = NULL;
virQEMUDriverConfigPtr cfg = NULL;
virCapsPtr caps = NULL;
......@@ -5283,7 +5283,7 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
goto cleanup;
for (vcpu = 0; vcpu < ncpumaps; vcpu++) {
virDomainVcpuPinDefPtr pininfo;
virDomainPinDefPtr pininfo;
virBitmapPtr bitmap = NULL;
unsigned char *tmpmap = NULL;
int tmpmaplen;
......@@ -5336,7 +5336,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
qemuDomainObjPrivatePtr priv;
bool doReset = false;
size_t newVcpuPinNum = 0;
virDomainVcpuPinDefPtr *newVcpuPin = NULL;
virDomainPinDefPtr *newVcpuPin = NULL;
virBitmapPtr pcpumap = NULL;
virQEMUDriverConfigPtr cfg = NULL;
virCapsPtr caps = NULL;
......@@ -5815,7 +5815,7 @@ qemuDomainGetIOThreadsConfig(virDomainDefPtr targetDef,
goto cleanup;
for (i = 0; i < targetDef->iothreads; i++) {
virDomainVcpuPinDefPtr pininfo;
virDomainPinDefPtr pininfo;
if (VIR_ALLOC(info_ret[i]) < 0)
goto cleanup;
......@@ -5920,7 +5920,7 @@ qemuDomainPinIOThread(virDomainPtr dom,
virDomainDefPtr persistentDef = NULL;
virBitmapPtr pcpumap = NULL;
qemuDomainObjPrivatePtr priv;
virDomainVcpuPinDefPtr *newIOThreadsPin = NULL;
virDomainPinDefPtr *newIOThreadsPin = NULL;
size_t newIOThreadsPinNum = 0;
virCgroupPtr cgroup_iothread = NULL;
virObjectEventPtr event = NULL;
......
......@@ -2413,7 +2413,7 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virDomainDefPtr def = vm->def;
virDomainVcpuPinDefPtr pininfo;
virDomainPinDefPtr pininfo;
int n;
int ret = -1;
VIR_DEBUG("Setting affinity on CPUs nvcpupin=%zu nvcpus=%d nvcpupids=%d",
......@@ -2479,7 +2479,7 @@ qemuProcessSetIOThreadsAffinity(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virDomainDefPtr def = vm->def;
virDomainVcpuPinDefPtr pininfo;
virDomainPinDefPtr pininfo;
size_t i;
int ret = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册