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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 01-07-15 22:22:26, Tejun Heo wrote:
> On Wed, Jul 01, 2015 at 09:27:57AM +0200, Jan Kara wrote:
> > > +#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)))
> 
> But then break or continue wouldn't work as expected.  It can get
> really confusing when it's wrapped by an outer loop.

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.
 */

								Honza

-- 
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux