[libvirt] [PATCH 08/12] qemu: Add length for bps/iops throttling parameters to driver

John Ferlan jferlan at redhat.com
Wed Sep 28 20:20:11 UTC 2016


>> +        } else if (STREQ(param->field,
>> +                         VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH)) {
>> +            info.write_iops_sec_max_length = param->value.ul;
>> +            set_iops_max_length = true;
>> +            if (virTypedParamsAddULLong(&eventParams, &eventNparams,
>> +                                        &eventMaxparams,
>> +                                        VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH,
>> +                                        param->value.ul) < 0)
>> +                goto endjob;
> 
> I wonder if we could turn these into something more readable. But that's
> something for a different patch set.
> 

Well since I didn't push before freeze maybe I can insert/add a patch
that will make for fewer lines and push once 2.4 opens along with
adjustments to change from 2.3 to 2.4.

Initially I was scared off by the if-else if logic, but after working
through the conditions, I ended up with 3 macros that build upon the
'bytes' and 'iops' in order to create each of the if/else checks.

Starting with "bytes" or "iops", for each a prefix of "total_", "read_",
or "write_" will be added prior to calling another macro which will
append the postfixes of "_sec", "_sec_max", and "_sec_max_length".

It looks cleaner, but really makes one look closely to see what's
happening.

I'll post a reply here with the patch for consideration

John




More information about the libvir-list mailing list