From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EF14C282DE for ; Sun, 7 Apr 2019 07:58:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 795AC20B1F for ; Sun, 7 Apr 2019 07:58:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726114AbfDGH6N (ORCPT ); Sun, 7 Apr 2019 03:58:13 -0400 Received: from verein.lst.de ([213.95.11.211]:35982 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbfDGH6N (ORCPT ); Sun, 7 Apr 2019 03:58:13 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id C729868B02; Sun, 7 Apr 2019 09:58:00 +0200 (CEST) Date: Sun, 7 Apr 2019 09:58:00 +0200 From: Christoph Hellwig To: Ming Lei Cc: Christoph Hellwig , Ming Lei , Jens Axboe , linux-block , Qu Wenruo , Btrfs BTRFS , Linux FS Devel , Omar Sandoval Subject: Re: [PATCH] block: don't use for-inside-for in bio_for_each_segment_all Message-ID: <20190407075800.GA9925@lst.de> References: <20190406215428.3131-1-ming.lei@redhat.com> <20190407065205.GA8799@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Sun, Apr 07, 2019 at 03:54:16PM +0800, Ming Lei wrote: > > OK, will move index check into mp_bvec_advance. > > oops, I recall the above line, because: > > 1) the index check expression is quite straight-forward > > 2) it has been in my todo list to re-use bvec_advance() to re-write > iterate_bvec() > given bvec_advance() is much light-weight than for_each_bvec(). If we > move the index check into bvec_advance(), the helper has to be moved > to bio.h, then we can't use that for iterate_bvec(). You can always create a tiny wrapper around bvec_advance() that sits in bio.h. Which in general is much better style than complex expressions inside of loops inside of macros..