All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Nefedov <anton.nefedov@virtuozzo.com>
To: Markus Armbruster <armbru@redhat.com>, Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org,
	qemu-devel@nongnu.org, mreitz@redhat.com, pbonzini@redhat.com,
	jsnow@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 8/8] qapi: query-blockstat: add driver specific file-posix stats
Date: Wed, 13 Jun 2018 13:36:05 +0300	[thread overview]
Message-ID: <a6ebab62-ac31-46ef-79d7-4eefa72bdd2e@virtuozzo.com> (raw)
In-Reply-To: <87a7s5q20q.fsf@dusky.pond.sub.org>



On 8/6/2018 8:29 AM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
>> On 06/07/2018 10:23 AM, Anton Nefedov wrote:
>>>>> If we introduce BlockdevDriver as a discriminator as Markus suggests
>>>>> above, we need some way to define its value.
>>>>> I guess one would be to check blk->bs->drv->format_name but it won't
>>>>> always work; often it's even blk->bs == NULL.
>>>>
>>>> There is no blk->bs, at least not if blk is a BlockBackend *.
>>>>
>>>> I figure the problem you're trying to describe is query-blockstats
>>>> running into BlockBackends that aren't associated with a
>>>> BlockDriverState (blk->root is null), and thus aren't associated with a
>>>> BlockDriver.  Correct?
>>>>
>>>
>>> Sorry, yes, exactly
>>
>> Okay, that sounds like the driver stats have to be optional, present
>> only when blk->bs is non-NULL.
>>
>>>
>>>>> I guess we could add a default ('unspecified'?) to BlockdevDriver enum?
>>>>
>>>> This part I understand, but...
>>>>
>>>>> But I'd rather leave an optional BlockDriverStats union (but make it
>>>>> flat). Only the drivers that provide these stats will need to set
>>>>> BlockdevDriver field. What do you think?
>>>>
>>>> I'm not sure I got this part.  Care to sketch the QAPI schema snippet?
>>>>
>>>
>>> You earlier proposed:
>>>
>>>   >>> You're adding a union of driver-specific stats to a struct of generic
>>>   >>> stats.  That's unnecessarily complicated.  Instead, turn the struct of
>>>   >>> generic stats into a flat union, like this:
>>>   >>>
>>>   >>> { 'union': 'BlockStats',
>>>   >>>     'base': { ... the generic stats, i.e. the members of BlockStats
>>>   >>>               before this patch ...
>>>   >>>               'driver': 'BlockdevDriver' }
>>>   >>>     'discriminator': 'driver',
>>>   >>>     'data': {
>>>   >>>         'file': 'BlockDriverStatsFile',
>>>   >>>         ... } }
>>
>> That would require 'driver' to always resolve to something, even when
>> there is no driver (unless we create a superset enum that adds 'none'
>> beyond what 'BlockdevDriver' supports).
>>
>>>
>>> But I meant to leave it as:
>>>
>>> + { 'union': 'BlockDriverStats':
>>> +     'base': { 'driver': 'BlockdevDriver' },
>>> +     'discriminator': 'driver',
>>> +     'data': {
>>> +         'file': 'BlockDriverStatsFile' } }
>>>
>>>
>>>     { 'struct': 'BlockStats',
>>>       'data': {'*device': 'str', '*node-name': 'str',
>>>                'stats': 'BlockDeviceStats',
>>> +            '*driver-stats': 'BlockDriverStats',
>>>                '*parent': 'BlockStats',
>>>                '*backing': 'BlockStats'} }
>>>
>>> so those block backends which do not provide driver stats do not need to
>>> set BlockdevDriver field.
>>
>> This makes the most sense to me - we're stuck with a layer of nesting,
>> but that's because driver-stats truly is optional (we don't always
>> have access to a driver).
> 
> Agree.
> 
> Now we have to name the thing.  You propose @driver-stats.  Servicable,
> but let's review how existing driver-specific things are named.
> 
> BlockdevOptions and BlockdevCreateOptions have them inline, thus no
> name.
> 
> ImageInfo has '*format-specific': 'ImageInfoSpecific'.
> 
> If we follow ImageInfo precedence, we get '*driver-specific':
> 'BlockStatsSpecific'.  driver-specific I like well enough.
> BlockStatsSpecific less so.  BlockStatsDriverSpecific feels better, but
> perhaps a bit long.
> 

following it further we will have BlockStatsDriverSpecificFile which is
even longer.

Personally, both
'*driver-specific': 'BlockDriverStats'; 'BlockDriverStatsFile'
'*driver-specific': 'BlockStatsSpecific'; 'BlockStatsSpecificFile'
look right to me.

Function signatures look ok too except that BlockDriverStats is easy to
confuse with BlockDriverState

BlockDriverStats *bdrv_get_stats(BlockDriverState *bs);
BlockStatsSpecific *bdrv_get_specific_stats(BlockDriverState *bs);

so maybe BlockStatsSpecific indeed?

  reply	other threads:[~2018-06-13 10:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 12:49 [Qemu-devel] [PATCH v2 0/8] discard blockstats Anton Nefedov
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 1/8] qapi: group BlockDeviceStats fields Anton Nefedov
2018-02-06 13:12   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-02-12 16:18     ` Anton Nefedov
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 2/8] qapi: add unmap to BlockDeviceStats Anton Nefedov
2018-01-22 20:47   ` Eric Blake
2018-01-23 10:35     ` Anton Nefedov
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 3/8] ide: account UNMAP (TRIM) operations Anton Nefedov
2018-01-22 20:48   ` Eric Blake
2018-01-23 10:39     ` Anton Nefedov
2018-02-07 14:39   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 4/8] scsi: store unmap offset and nb_sectors in request struct Anton Nefedov
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 5/8] scsi: move unmap error checking to the complete callback Anton Nefedov
2018-02-07 15:00   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 6/8] scsi: account unmap operations Anton Nefedov
2018-02-07 15:03   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 7/8] file-posix: account discard operations Anton Nefedov
2018-02-07 15:10   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-02-12 16:19     ` Anton Nefedov
2018-02-16 11:36       ` Alberto Garcia
2018-01-19 12:50 ` [Qemu-devel] [PATCH v2 8/8] qapi: query-blockstat: add driver specific file-posix stats Anton Nefedov
2018-01-22 20:55   ` Eric Blake
2018-01-23 11:28     ` Anton Nefedov
2018-01-23 14:53       ` Eric Blake
2018-02-03 15:59     ` Markus Armbruster
2018-02-12 16:38       ` Anton Nefedov
2018-02-15 10:23         ` Anton Nefedov
2018-02-15 14:32           ` Eric Blake
2018-06-07 14:32       ` Anton Nefedov
2018-06-07 15:09         ` Markus Armbruster
2018-06-07 15:23           ` Anton Nefedov
2018-06-07 18:45             ` Eric Blake
2018-06-08  5:29               ` Markus Armbruster
2018-06-13 10:36                 ` Anton Nefedov [this message]
2018-06-13 11:40                   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6ebab62-ac31-46ef-79d7-4eefa72bdd2e@virtuozzo.com \
    --to=anton.nefedov@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@virtuozzo.com \
    --cc=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.