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/