Re: [REPOST PATCH v2 5/9] qemu: Adjust various bool BlockIoTune set_ values into mask

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 11/25/2016 10:53 AM, Erik Skultety wrote:
> On Mon, Nov 21, 2016 at 06:35:50PM -0500, John Ferlan wrote:
>> Rather than have multiple bool values, create a single enum with bits
>> representing what can be set.
>>
>> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
>> ---
>>  src/qemu/qemu_driver.c | 113 +++++++++++++++++++++++--------------------------
>>  1 file changed, 54 insertions(+), 59 deletions(-)
>>
>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>> index 87d219f..73b58d0 100644
>> --- a/src/qemu/qemu_driver.c
>> +++ b/src/qemu/qemu_driver.c
>> @@ -17338,34 +17338,38 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom,
>>      return ret;
>>  }
>>  
>> +typedef enum {
>> +    QEMU_BLOCK_IOTUNE_SET_BYTES            = 1 << 0,
>> +    QEMU_BLOCK_IOTUNE_SET_IOPS             = 1 << 1,
>> +    QEMU_BLOCK_IOTUNE_SET_BYTES_MAX        = 1 << 2,
>> +    QEMU_BLOCK_IOTUNE_SET_IOPS_MAX         = 1 << 3,
>> +    QEMU_BLOCK_IOTUNE_SET_SIZE_IOPS        = 1 << 4,
>> +    QEMU_BLOCK_IOTUNE_SET_BYTES_MAX_LENGTH = 1 << 5,
>> +    QEMU_BLOCK_IOTUNE_SET_IOPS_MAX_LENGTH  = 1 << 6,
>> +} qemuBlockIoTuneSetFlags;
>> +
>>  
>>  /* If the user didn't specify bytes limits, inherit previous values;
>>   * likewise if the user didn't specify iops limits.  */
>>  static void
>>  qemuDomainSetBlockIoTuneDefaults(virDomainBlockIoTuneInfoPtr newinfo,
>>                                   virDomainBlockIoTuneInfoPtr oldinfo,
>> -                                 bool set_bytes,
>> -                                 bool set_iops,
>> -                                 bool set_bytes_max,
>> -                                 bool set_iops_max,
>> -                                 bool set_size_iops,
>> -                                 bool set_bytes_max_length,
>> -                                 bool set_iops_max_length)
>> +                                 qemuBlockIoTuneSetFlags set_flag)
> 
> Just a cosmetic "nit", I spent a few seconds looking at the name "set_flag"
> confusingly (probably 'cause it's Friday). Maybe something like
> set_map|set_mask|mask|bitmap or something alike would sound better, but then,
> who am I to judge with my history of 'brilliant' function naming :D.

I could go with set_mask, but mask has a different connotation for some.
It's not a bitmap and there are those that would say that a bitmap
should use the Bitmap functions (which would be overkill at this point).

Maybe a 'set_fields_flag' would be clearer? It's a flag to indicate a
grouping of (usually) 3 elements ({read|write|total}) were set, where
size_iops and group_name become the exception.

Unless someone else has a brilliant suggestion...

John
> 
> Patch looks good though, I'll leave it to you.
> 
> Erik
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux