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

Erik Skultety eskultet at redhat.com
Fri Nov 25 15:53:39 UTC 2016


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 at redhat.com>
> ---
>  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.

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

Erik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161125/4a3f3aea/attachment-0001.sig>


More information about the libvir-list mailing list