Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756509AbdCGXYK (ORCPT ); Tue, 7 Mar 2017 18:24:10 -0500 Received: from mail-it0-f44.google.com ([209.85.214.44]:33753 "EHLO mail-it0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756255AbdCGXYI (ORCPT ); Tue, 7 Mar 2017 18:24:08 -0500 Subject: Re: [PATCH RFC 01/14] block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler To: Paolo Valente , Tejun Heo References: <20170304160131.57366-1-paolo.valente@linaro.org> <20170304160131.57366-2-paolo.valente@linaro.org> Cc: Fabio Checconi , Arianna Avanzini , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org From: Jens Axboe Message-ID: <9ddb9586-d97e-e7b2-0081-216521f7be76@kernel.dk> Date: Tue, 7 Mar 2017 16:22:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170304160131.57366-2-paolo.valente@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 861 Lines: 26 > +/** > + * 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. -- Jens Axboe