Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753942AbbGCM0i (ORCPT ); Fri, 3 Jul 2015 08:26:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33698 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754973AbbGCM0d (ORCPT ); Fri, 3 Jul 2015 08:26:33 -0400 Date: Fri, 3 Jul 2015 14:26:27 +0200 From: Jan Kara To: Tejun Heo Cc: Jan Kara , axboe@kernel.dk, linux-kernel@vger.kernel.org, hch@infradead.org, hannes@cmpxchg.org, linux-fsdevel@vger.kernel.org, vgoyal@redhat.com, lizefan@huawei.com, cgroups@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.cz, clm@fb.com, fengguang.wu@intel.com, david@fromorbit.com, gthelen@google.com, khlebnikov@yandex-team.ru Subject: Re: [PATCH 36/51] writeback: implement bdi_for_each_wb() Message-ID: <20150703122627.GK23329@quack.suse.cz> References: <1432329245-5844-1-git-send-email-tj@kernel.org> <1432329245-5844-37-git-send-email-tj@kernel.org> <20150701072757.GW7252@quack.suse.cz> <20150702022226.GH26440@mtj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150702022226.GH26440@mtj.duckdns.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1194 Lines: 34 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 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/