Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1603784 > unrolled thread

Re: [PATCH RFC 01/14] block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler

Started byPaolo Valente <paolo.valente@linaro.org>
First post2017-03-18 13:50 +0100
Last post2017-03-18 13:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH RFC 01/14] block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler Paolo Valente <paolo.valente@linaro.org> - 2017-03-18 13:50 +0100

#1603784 — Re: [PATCH RFC 01/14] block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler

FromPaolo Valente <paolo.valente@linaro.org>
Date2017-03-18 13:50 +0100
SubjectRe: [PATCH RFC 01/14] block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler
Message-ID<tmlXX-6p8-1@gated-at.bofh.it>
> Il giorno 07 mar 2017, alle ore 18:22, Jens Axboe <axboe@kernel.dk> ha scritto:
> 
>> +/**
>> + * bfq_entity_of - get an entity from a node.
>> + * @node: the node field of the entity.
>> + *
>> + * Convert a node pointer to the relative entity.  This is used only
>> + * to simplify the logic of some functions and not as the generic
>> + * conversion mechanism because, e.g., in the tree walking functions,
>> + * the check for a %NULL value would be redundant.
>> + */
>> +static struct bfq_entity *bfq_entity_of(struct rb_node *node)
>> +{
>> +	struct bfq_entity *entity = NULL;
>> +
>> +	if (node)
>> +		entity = rb_entry(node, struct bfq_entity, rb_node);
>> +
>> +	return entity;
>> +}
> 
> Get rid of pointless wrappers like this, just use rb_entry() in the
> caller. It's harmful to the readability of the code to have to lookup
> things like this, if it's a list_entry or rb_entry() in the caller you
> know exactly what is going on immediately.
> 


Ok.  Just a quick request for help about this.  The code seems to become
quite ugly with a verbatim replacement of this function with its body
(and there are several occurrences of it), so there is probably something I'm
missing.  For example, given the following loop:

	for (; entity ; entity = bfq_entity_of(rb_first(active)))
		bfq_reparent_leaf_entity(bfqd, entity);

the only non-cryptic, but heavier solution I see is:

	for (; entity ; ) {
		bfq_reparent_leaf_entity(bfqd, entity);
		if (rb_first(active))
			entity = rb_entry(rb_first(active), struct bfq_entity, rb_node);
		else
			entity = NULL;
	}

Am I missing something?  Or are these extra lines of code a reasonable
price to pay for increased transparency?

Thanks,
Paolo

> -- 
> Jens Axboe
> 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web