diff mbox

[6/7] throttle: add the name of the ThrottleGroup to BlockDeviceInfo

Message ID 3e2f5bedd4889507e5083faf431250a814205db9.1427732020.git.berto@igalia.com
State New
Headers show

Commit Message

Alberto Garcia March 30, 2015, 4:19 p.m. UTC
Signed-off-by: Alberto Garcia <berto@igalia.com>
---
 block/qapi.c         | 3 +++
 hmp.c                | 6 ++++--
 qapi/block-core.json | 4 +++-
 3 files changed, 10 insertions(+), 3 deletions(-)

Comments

Fam Zheng April 1, 2015, 9:59 a.m. UTC | #1
On Mon, 03/30 19:19, Alberto Garcia wrote:
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
>  block/qapi.c         | 3 +++
>  hmp.c                | 6 ++++--
>  qapi/block-core.json | 4 +++-
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/block/qapi.c b/block/qapi.c
> index 65af057..ee823d1 100644
> --- a/block/qapi.c
> +++ b/block/qapi.c
> @@ -91,6 +91,9 @@ BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs)
>  
>          info->has_iops_size = cfg.op_size;
>          info->iops_size = cfg.op_size;
> +
> +        info->has_group = true;
> +        info->group = g_strdup(throttle_group_get_name(bs));

True even if it's unset?

>      }
>  
>      info->write_threshold = bdrv_write_threshold_get(bs);
> diff --git a/hmp.c b/hmp.c
> index 50f30f2..759fb86 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -375,7 +375,8 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
>                          " iops_max=%" PRId64
>                          " iops_rd_max=%" PRId64
>                          " iops_wr_max=%" PRId64
> -                        " iops_size=%" PRId64 "\n",
> +                        " iops_size=%" PRId64
> +                        " group=%s\n",
>                          inserted->bps,
>                          inserted->bps_rd,
>                          inserted->bps_wr,
> @@ -388,7 +389,8 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
>                          inserted->iops_max,
>                          inserted->iops_rd_max,
>                          inserted->iops_wr_max,
> -                        inserted->iops_size);
> +                        inserted->iops_size,
> +                        inserted->group);
>      }
>  
>      if (verbose) {
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index d8211b7..0057f60 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -259,6 +259,8 @@
>  #
>  # @iops_size: #optional an I/O size in bytes (Since 1.7)
>  #
> +# @group: #optional throttle group name (Since 2.3)

Will probably be 2.4.

Fam

> +#
>  # @cache: the cache mode used for the block device (since: 2.3)
>  #
>  # @write_threshold: configured write threshold for the device.
> @@ -278,7 +280,7 @@
>              '*bps_max': 'int', '*bps_rd_max': 'int',
>              '*bps_wr_max': 'int', '*iops_max': 'int',
>              '*iops_rd_max': 'int', '*iops_wr_max': 'int',
> -            '*iops_size': 'int', 'cache': 'BlockdevCacheInfo',
> +            '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
>              'write_threshold': 'int' } }
>  
>  ##
> -- 
> 2.1.4
> 
>
Alberto Garcia April 1, 2015, 10:06 a.m. UTC | #2
On Wed, Apr 01, 2015 at 05:59:40PM +0800, Fam Zheng wrote:

> >          info->has_iops_size = cfg.op_size;
> >          info->iops_size = cfg.op_size;
> > +
> > +        info->has_group = true;
> > +        info->group = g_strdup(throttle_group_get_name(bs));
> 
> True even if it's unset?

Note that that's inside an "if (bs->io_limits_enabled)" block.

io_limits_enabled is set immediately after adding a BDS to a
throttling group, and that requires a name.

> > +# @group: #optional throttle group name (Since 2.3)
> 
> Will probably be 2.4.

Right.

Berto
Fam Zheng April 1, 2015, 2:05 p.m. UTC | #3
On Wed, 04/01 12:06, Alberto Garcia wrote:
> On Wed, Apr 01, 2015 at 05:59:40PM +0800, Fam Zheng wrote:
> 
> > >          info->has_iops_size = cfg.op_size;
> > >          info->iops_size = cfg.op_size;
> > > +
> > > +        info->has_group = true;
> > > +        info->group = g_strdup(throttle_group_get_name(bs));
> > 
> > True even if it's unset?
> 
> Note that that's inside an "if (bs->io_limits_enabled)" block.

Then this is OK :)

Fam

> 
> io_limits_enabled is set immediately after adding a BDS to a
> throttling group, and that requires a name.
> 
> > > +# @group: #optional throttle group name (Since 2.3)
> > 
> > Will probably be 2.4.
> 
> Right.
> 
> Berto
diff mbox

Patch

diff --git a/block/qapi.c b/block/qapi.c
index 65af057..ee823d1 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -91,6 +91,9 @@  BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs)
 
         info->has_iops_size = cfg.op_size;
         info->iops_size = cfg.op_size;
+
+        info->has_group = true;
+        info->group = g_strdup(throttle_group_get_name(bs));
     }
 
     info->write_threshold = bdrv_write_threshold_get(bs);
diff --git a/hmp.c b/hmp.c
index 50f30f2..759fb86 100644
--- a/hmp.c
+++ b/hmp.c
@@ -375,7 +375,8 @@  static void print_block_info(Monitor *mon, BlockInfo *info,
                         " iops_max=%" PRId64
                         " iops_rd_max=%" PRId64
                         " iops_wr_max=%" PRId64
-                        " iops_size=%" PRId64 "\n",
+                        " iops_size=%" PRId64
+                        " group=%s\n",
                         inserted->bps,
                         inserted->bps_rd,
                         inserted->bps_wr,
@@ -388,7 +389,8 @@  static void print_block_info(Monitor *mon, BlockInfo *info,
                         inserted->iops_max,
                         inserted->iops_rd_max,
                         inserted->iops_wr_max,
-                        inserted->iops_size);
+                        inserted->iops_size,
+                        inserted->group);
     }
 
     if (verbose) {
diff --git a/qapi/block-core.json b/qapi/block-core.json
index d8211b7..0057f60 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -259,6 +259,8 @@ 
 #
 # @iops_size: #optional an I/O size in bytes (Since 1.7)
 #
+# @group: #optional throttle group name (Since 2.3)
+#
 # @cache: the cache mode used for the block device (since: 2.3)
 #
 # @write_threshold: configured write threshold for the device.
@@ -278,7 +280,7 @@ 
             '*bps_max': 'int', '*bps_rd_max': 'int',
             '*bps_wr_max': 'int', '*iops_max': 'int',
             '*iops_rd_max': 'int', '*iops_wr_max': 'int',
-            '*iops_size': 'int', 'cache': 'BlockdevCacheInfo',
+            '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
             'write_threshold': 'int' } }
 
 ##