From: Stefan Hajnoczi <stefanha@gmail.com>
To: Manos Pitsidianakis <el13635@mail.ntua.gr>,
kwolf@redhat.com, berto@igalia.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH RFC] block: add throttle block filter driver
Date: Thu, 8 Jun 2017 11:32:29 +0100 [thread overview]
Message-ID: <20170608103229.GF4145@stefanha-x1.localdomain> (raw)
In-Reply-To: <20170608074149.4qhb66k6ujyonlo4@postretch>
[-- Attachment #1: Type: text/plain, Size: 3753 bytes --]
On Thu, Jun 08, 2017 at 10:41:49AM +0300, Manos Pitsidianakis wrote:
> On Thu, Jun 08, 2017 at 08:22:28AM +0100, Stefan Hajnoczi wrote:
> > On Wed, Jun 07, 2017 at 04:06:19PM +0300, Manos Pitsidianakis wrote:
> > > +#define QEMU_OPT_IOPS_TOTAL "iops-total"
> > > +#define QEMU_OPT_IOPS_TOTAL_MAX "iops-total-max"
> > > +#define QEMU_OPT_IOPS_TOTAL_MAX_LENGTH "iops-total-max-length"
> > > +#define QEMU_OPT_IOPS_READ "iops-read"
> > > +#define QEMU_OPT_IOPS_READ_MAX "iops-read-max"
> > > +#define QEMU_OPT_IOPS_READ_MAX_LENGTH "iops-read-max-length"
> > > +#define QEMU_OPT_IOPS_WRITE "iops-write"
> > > +#define QEMU_OPT_IOPS_WRITE_MAX "iops-write-max"
> > > +#define QEMU_OPT_IOPS_WRITE_MAX_LENGTH "iops-write-max-length"
> > > +#define QEMU_OPT_BPS_TOTAL "bps-total"
> > > +#define QEMU_OPT_BPS_TOTAL_MAX "bps-total-max"
> > > +#define QEMU_OPT_BPS_TOTAL_MAX_LENGTH "bps-total-max-length"
> > > +#define QEMU_OPT_BPS_READ "bps-read"
> > > +#define QEMU_OPT_BPS_READ_MAX "bps-read-max"
> > > +#define QEMU_OPT_BPS_READ_MAX_LENGTH "bps-read-max-length"
> > > +#define QEMU_OPT_BPS_WRITE "bps-write"
> > > +#define QEMU_OPT_BPS_WRITE_MAX "bps-write-max"
> > > +#define QEMU_OPT_BPS_WRITE_MAX_LENGTH "bps-write-max-length"
> > > +#define QEMU_OPT_IOPS_SIZE "iops-size"
> > > +#define QEMU_OPT_THROTTLE_GROUP_NAME "throttle-group"
> >
> > Please reuse include/qemu/throttle-options.h.
>
> This would make the options too verbose, ie -drive
> driver=throttle,file=..,throttling.iops-total=..,throttling. Eventually of
> course throttle-options.h will be replaced.
>
> However, this can't be done at this point anyway, since the throttling.[...]
> options are consumed by the already existing throttling code, and are
> unavailable for the driver.
There are ways of reusing include/qemu/throttle-options.h, I'm just not
sure if they are worth it.
In block/block-backend.c:
#define THROTTLE_OPTION_PREFIX "throttling."
#include "qemu/throttle-options.h"
In block/throttle.c:
#include "qemu/throttle-options.h"
In include/qemu/throttle-options.h:
#define THROTTLE_OPTION_IOPS_TOTAL (THROTTLE_OPTION_PREFIX "iops-total")
#define THROTTLE_OPTS \
{ \
.name = THROTTLE_OPTION_IOPS_TOTAL,\
.type = QEMU_OPT_NUMBER,\
.help = "limit total I/O operations per second",\
},{ \
to generate either "throttling.iops-total" or "iops-total", depending on
the environment in which the file was included.
This reuses the same .h file but it's also a little ugly because of the
C macro (ab)use.
> > > diff --git a/include/block/throttle.h b/include/block/throttle.h
> > > new file mode 100644
> > > index 0000000000..fed24f02a6
> > > --- /dev/null
> > > +++ b/include/block/throttle.h
> >
> > What is the purpose of this header?
> >
> > Header files in include/* are "public" APIs that other parts of QEMU can
> > use. There is no user other than block/throttle.c so please keep it
> > private in the .c file.
>
> Eventually the qmp/hmp/qom related stuff will be in a header file, and this
> is why I put them from the beginning separately. But yes, in this case it is
> not needed. Also, these probably should go to include/qemu/throttle.h
> instead of a separate header file.
Patches must be self-contained because reviewers don't necessarily know
future plans and if those future patches are never merged then the
source tree is in an incomplete state.
There are rare cases where it's really necessary for a patch to add
something that is unused. In that case the intention should be clear
from the patch or commit description (e.g. "let's change this now so
the next patch can take advantage of it").
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
prev parent reply other threads:[~2017-06-08 10:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 13:06 [Qemu-devel] [PATCH RFC] block: add throttle block filter driver Manos Pitsidianakis
2017-06-07 15:40 ` Eric Blake
2017-06-07 16:06 ` Manos Pitsidianakis
2017-06-07 21:38 ` Eric Blake
2017-06-07 22:08 ` Manos Pitsidianakis
2017-06-07 22:19 ` Eric Blake
2017-06-08 7:22 ` Stefan Hajnoczi
2017-06-08 7:41 ` Manos Pitsidianakis
2017-06-08 10:32 ` Stefan Hajnoczi [this message]
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=20170608103229.GF4145@stefanha-x1.localdomain \
--to=stefanha@gmail.com \
--cc=berto@igalia.com \
--cc=el13635@mail.ntua.gr \
--cc=kwolf@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).