virDomainFormatIOThreadSchedDef(virDomainDefPtr def,
virBufferPtr buf)
{
- virBitmapPtr allthreadmap;
- int ret;
+ virBitmapPtr threadmap;
+ size_t i;
+ int ret = -1;
if (def->niothreadids == 0)
return 0;
- if (!(allthreadmap = virDomainIOThreadIDMap(def)))
+ if (!(threadmap = virBitmapNewEmpty()))
return -1;
+ for (i = 0; i < def->niothreadids; i++) {
+ if (def->iothreadids[i]->sched.policy != VIR_PROC_POLICY_NONE &&
+ virBitmapSetBitExpand(threadmap, def->iothreadids[i]->iothread_id) < 0)
+ goto cleanup;
+ }
+
+ if (virBitmapIsAllClear(threadmap)) {
+ ret = 0;
+ goto cleanup;
+ }
+
ret = virDomainFormatSchedDef(def, buf, "iothreads",
- virDomainDefGetIOThreadSched, allthreadmap);
+ virDomainDefGetIOThreadSched, threadmap);
- virBitmapFree(allthreadmap);
+ cleanup:
+ virBitmapFree(threadmap);
return ret;
}