lkml.org 
[lkml]   [2015]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 36/51] writeback: implement bdi_for_each_wb()
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


\
 
 \ /
  Last update: 2015-07-01 10:01    [W:0.403 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site