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


Groups > linux.kernel > #1175033 > unrolled thread

Re: [PATCH 36/51] writeback: implement bdi_for_each_wb()

Started byJan Kara <jack@suse.cz>
First post2015-07-01 09:30 +0200
Last post2015-07-03 19:10 +0200
Articles 2 — 2 participants

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 36/51] writeback: implement bdi_for_each_wb() Jan Kara <jack@suse.cz> - 2015-07-01 09:30 +0200
    Re: [PATCH 36/51] writeback: implement bdi_for_each_wb() Tejun Heo <tj@kernel.org> - 2015-07-03 19:10 +0200

#1175033 — Re: [PATCH 36/51] writeback: implement bdi_for_each_wb()

FromJan Kara <jack@suse.cz>
Date2015-07-01 09:30 +0200
SubjectRe: [PATCH 36/51] writeback: implement bdi_for_each_wb()
Message-ID<pHkD0-27B-15@gated-at.bofh.it>
On Fri 22-05-15 17:13:50, Tejun Heo wrote:
> This will be used to implement bdi-wide operations which should be
> distributed across all its cgroup bdi_writebacks.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Jan Kara <jack@suse.cz>

One comment below.

> @@ -445,6 +500,14 @@ static inline void wb_blkcg_offline(struct blkcg *blkcg)
>  {
>  }
>  
> +struct wb_iter {
> +	int		next_id;
> +};
> +
> +#define bdi_for_each_wb(wb_cur, bdi, iter, start_blkcg_id)		\
> +	for ((iter)->next_id = (start_blkcg_id);			\
> +	     ({	(wb_cur) = !(iter)->next_id++ ? &(bdi)->wb : NULL; }); )
> +

This looks quite confusing. Won't it be easier to understand as:

struct wb_iter {
} __attribute__ ((unused));

#define bdi_for_each_wb(wb_cur, bdi, iter, start_blkcg_id) \
  if (((wb_cur) = (!start_blkcg_id ? &(bdi)->wb : NULL)))

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1176727

FromTejun Heo <tj@kernel.org>
Date2015-07-03 19:10 +0200
Message-ID<pIcDn-2PO-13@gated-at.bofh.it>
In reply to#1175033
On Fri, Jul 03, 2015 at 02:26:27PM +0200, Jan Kara wrote:
> That's a good point. Thanks for explanation. Maybe add a comment like:
> /*
>  * We use use this seemingly complicated 'for' loop so that 'break' and
>  * 'continue' continue to work as expected.
>  */

This kinda feel superflous for me.  This is something true for all
iteration wrappers which falls within the area of well-established
convention, I think.  If it's doing something weird like combining
if-else clause to do post-conditional processing, sure, but this is
really kinda standard.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web