Received: from eggs.gnu.org ([2001:4830:134:3::10]:49515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEgPs-0005DV-GM for qemu-devel@nongnu.org; Wed, 28 Aug 2013 10:08:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEgPl-0005py-5O for qemu-devel@nongnu.org; Wed, 28 Aug 2013 10:08:12 -0400 Received: from mail-ee0-f50.google.com ([74.125.83.50]:61519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEgPk-0005pu-RL for qemu-devel@nongnu.org; Wed, 28 Aug 2013 10:08:05 -0400 Received: by mail-ee0-f50.google.com with SMTP id d51so2975301eek.9 for ; Wed, 28 Aug 2013 07:07:49 -0700 (PDT) Date: Wed, 28 Aug 2013 16:07:42 +0200 From: Stefan Hajnoczi Message-ID: <20130828140742.GD12214@stefanha-thinkpad.muc.redhat.com> References: <1377528172-11137-1-git-send-email-benoit@irqsave.net> <1377528172-11137-2-git-send-email-benoit@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1377528172-11137-2-git-send-email-benoit@irqsave.net> Subject: Re: [Qemu-devel] [PATCH V6 1/5] throttle: Add a new throttling API implementing continuous leaky bucket. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Mon, Aug 26, 2013 at 04:42:48PM +0200, Benoît Canet wrote: > +/* fix bucket parameters */ > +static void throttle_fix_bucket(LeakyBucket *bkt) > +{ > + double min; > + > + /* zero bucket level */ > + bkt->level = 0; > + > + /* The following is done to cope with the cfg block scheduler which regroup s/cfg/Linux CFQ/ ? > +/* used to get config > + * > + * @ts: the throttle state we are working on > + * @ret: the config > + */ > +ThrottleConfig *throttle_get_config(ThrottleState *ts) > +{ > + return &ts->cfg; > +} throttle_config() copies the ThrottleConfig struct but this returns a non-const pointer to it. Should this function copy it too? void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg) { *cfg = ts->cfg; } > +/* do the accounting for this operation > + * > + * @is_write: the type of operation (read/write) > + * size: the size of the operation s/size/@size/ > + */ > +void throttle_account(ThrottleState *ts, bool is_write, uint64_t size) > +{ > + double units = 1.0; > + > + /* if cfg.op_size is not defined we will acccount exactly 1 operation */ s/acccount/account/