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


Groups > linux.kernel > #1559369

Re: [PATCH] writeback: use rb_entry()

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] writeback: use rb_entry()
Date 2017-01-16 01:00 +0100
Message-ID <t02Sm-xH-15@gated-at.bofh.it> (permalink)
References <sZbXH-2vV-11@gated-at.bofh.it> <sZbXI-2vV-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jan 13, 2017 at 11:17:12PM +0800, Geliang Tang wrote:
> To make the code clearer, use rb_entry() instead of container_of() to
> deal with rbtree.
> 
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> ---
>  mm/backing-dev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> index 3bfed5ab..ffb77a1 100644
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -410,8 +410,8 @@ wb_congested_get_create(struct backing_dev_info *bdi, int blkcg_id, gfp_t gfp)
>  
>  	while (*node != NULL) {
>  		parent = *node;
> -		congested = container_of(parent, struct bdi_writeback_congested,
> -					 rb_node);
> +		congested = rb_entry(parent, struct bdi_writeback_congested,
> +				     rb_node);

I don't get the rb_entry() macro.  It's just another name for
container_of().  I have no objection to the patch but this macro is a
bit silly.

Thanks.

-- 
tejun

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] block: use list_entry_rq Geliang Tang <geliangtang@gmail.com> - 2017-01-13 16:30 +0100
  [PATCH] elevator: add fall through comment Geliang Tang <geliangtang@gmail.com> - 2017-01-13 16:30 +0100
  [PATCH] writeback: use rb_entry() Geliang Tang <geliangtang@gmail.com> - 2017-01-13 16:30 +0100
    Re: [PATCH] writeback: use rb_entry() Tejun Heo <tj@kernel.org> - 2017-01-16 01:00 +0100

csiph-web