All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [PATCH 1/3] block/block-backend: add converter from BlockAcctStats to BlockBackend
Date: Thu, 17 Sep 2020 16:02:08 +0200	[thread overview]
Message-ID: <9aa6f66e-c51f-1167-ac49-e05e10347cd6@redhat.com> (raw)
In-Reply-To: <20200810101447.7380-2-den@openvz.org>


[-- Attachment #1.1: Type: text/plain, Size: 2052 bytes --]

On 10.08.20 12:14, Denis V. Lunev wrote:
> Right now BlockAcctStats is always reside on BlockBackend. This structure
> is not used in any other place. Thus we are able to create a converter
> from one pointer to another.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Max Reitz <mreitz@redhat.com>
> ---
>  block/block-backend.c          | 5 +++++
>  include/sysemu/block-backend.h | 1 +
>  2 files changed, 6 insertions(+)

(Note: I’m just writing this mail because I already responded to patch
2.  I wouldn’t have if I didn’t have anything to say regarding the other
patches in this series, so nothing I say here is backed by a strong
opinion from me.)

> diff --git a/block/block-backend.c b/block/block-backend.c
> index 3a13cb5f0b..88e531df98 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -2153,6 +2153,11 @@ BlockAcctStats *blk_get_stats(BlockBackend *blk)
>      return &blk->stats;
>  }
>  
> +BlockBackend *blk_stats2blk(BlockAcctStats *s)

(Extreme bikeshedding: I’d prefer something like blk_from_stats().)

> +{
> +    return container_of(s, BlockBackend, stats);
> +}

Works, but I get all itchy, especially given the reasoning in the commit
message, which is basically “Right now this works”.

That sounds to me like maybe in the future someone could get the idea of
moving BlockAcctStats somewhere else and then this is something that we
absolutely must not forget about, lest horrible accidents occur.

Would a back pointer from BlockAcctStats to the BlockBackend work or do
you find that just too ugly and unnecessary?  (I think it would help at
least so that we do not forget this place here.)

Or maybe just a comment above BlockAcctStats would help quench my itch,
too, like “Note: blk_stats2blk() expects objects of this type only to
occur as part of a BlockBackend”.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-09-17 14:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-10 10:14 [PATCH v2 for 5.2 0/3] block: add logging facility for long standing IO requests Denis V. Lunev
2020-08-10 10:14 ` [PATCH 1/3] block/block-backend: add converter from BlockAcctStats to BlockBackend Denis V. Lunev
2020-09-17 14:02   ` Max Reitz [this message]
2020-08-10 10:14 ` [PATCH 2/3] block: add logging facility for long standing IO requests Denis V. Lunev
2020-08-20  8:03   ` David Edmondson
2020-08-24  9:01     ` Denis V. Lunev
2020-09-17 13:56   ` Max Reitz
2020-09-17 15:27     ` Denis V. Lunev
2020-08-10 10:14 ` [PATCH 3/3] block: enable long IO requests report by default Denis V. Lunev
2020-09-17 14:03   ` Max Reitz
2020-08-12 14:00 ` [PATCH v2 for 5.2 0/3] block: add logging facility for long standing IO requests Stefan Hajnoczi
2020-08-20  7:37   ` Denis V. Lunev
  -- strict thread matches above, loose matches on Subject: below --
2020-08-05 10:08 [PATCH v2 " Denis V. Lunev
2020-08-05 10:08 ` [PATCH 1/3] block/block-backend: add converter from BlockAcctStats to BlockBackend Denis V. Lunev

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=9aa6f66e-c51f-1167-ac49-e05e10347cd6@redhat.com \
    --to=mreitz@redhat.com \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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.