Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7031154imm; Wed, 27 Jun 2018 18:37:53 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ2VE5ORmnw2DbfSTTS1AJTHwtbYMBCCQZtHqj9QEwrOHMSW9t7hFPhnoItzy+E5Xa5TPmr X-Received: by 2002:a17:902:8e87:: with SMTP id bg7-v6mr8344512plb.129.1530149873769; Wed, 27 Jun 2018 18:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530149873; cv=none; d=google.com; s=arc-20160816; b=YqMgrf+klacKEvOoUQ0+uude6kdlcNbaZFu1Zlec7XgT30VFa9pMuzMJYUOqATSeGE 9qtRi4QWQlj77jNlBBDskeJ+kVBZAIHZ9x5fv6TRbe1gVkw+bt9M7FTA9bSIaTAGhdsP hk0VRfJuXCtv30GLN28qN/i6iOkfx8rqMVfn4g+hiRpsjfl9eYikIW/cRkprT1/xRBE3 p/uFlAU0gEyzwDKfGWGZfP97QN5GMj1e778u7SOOtANqiGpxt8r560we9c7yzSEwskmU /rhpKGlBJuW+5A/osmr31jyo7JJuLZbmnTqZUcxze1VvnRfau2x3AXAPjZuZKvvCibY8 LPgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=DFtGjZ1Id7dRj82IE7ZApX3QJl9idCu4M6mkHUJjZgQ=; b=LMOZONAz6wyFhvVJ1FEa8gyzTLN3/41apEjghlYeycHxGC2V+jk/gYXHZXg37Nz2ee sK+54SvsSySz8MxYt+r9MYP9wSlzgHjE5HeYd2vpZGyD+ibNnTIKr/TruwQt61dkNOai CQ6kF0fqevo9HL3uKeg3oeFaIk/k5e+O1P7ieBKoIXdLQA6bIyQGLeL5MjTs33sPlx1r JS7vLkCDtISGSAaypaR0YLfOh4zFxIDl9U9SBYckHxYT1MpWmKRY7GB791TPL3Z6sT3A /VHRUYbRJDt4Zy15B0ONWmnCLCzWsAOn+YngIoh14StWjKCPxLGJ9TyMn3GgtStTH8Xq QwIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11-v6si4568672pgp.95.2018.06.27.18.37.39; Wed, 27 Jun 2018 18:37:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752281AbeF1B2l (ORCPT + 99 others); Wed, 27 Jun 2018 21:28:41 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55246 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751723AbeF1B2k (ORCPT ); Wed, 27 Jun 2018 21:28:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E40D814F0B8; Thu, 28 Jun 2018 01:28:39 +0000 (UTC) Received: from ming.t460p (ovpn-12-44.pek2.redhat.com [10.72.12.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CB86E111CA17; Thu, 28 Jun 2018 01:28:22 +0000 (UTC) Date: Thu, 28 Jun 2018 09:28:18 +0800 From: Ming Lei To: Coly Li Cc: Jens Axboe , Christoph Hellwig , Kent Overstreet , David Sterba , Huang Ying , Mike Snitzer , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , "Darrick J . Wong" , Filipe Manana , Randy Dunlap , linux-bcache@vger.kernel.org Subject: Re: [PATCH V7 20/24] bcache: avoid to use bio_for_each_segment_all() in bch_bio_alloc_pages() Message-ID: <20180628012816.GH7583@ming.t460p> References: <20180627124548.3456-1-ming.lei@redhat.com> <20180627124548.3456-21-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 28 Jun 2018 01:28:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 28 Jun 2018 01:28:39 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 27, 2018 at 11:55:33PM +0800, Coly Li wrote: > On 2018/6/27 8:45 PM, Ming Lei wrote: > > bch_bio_alloc_pages() is always called on one new bio, so it is safe > > to access the bvec table directly. Given it is the only kind of this > > case, open code the bvec table access since bio_for_each_segment_all() > > will be changed to support for iterating over multipage bvec. > > > > Cc: Coly Li > > Cc: linux-bcache@vger.kernel.org > > Signed-off-by: Ming Lei > > --- > > drivers/md/bcache/util.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c > > index fc479b026d6d..9f2a6fd5dfc9 100644 > > --- a/drivers/md/bcache/util.c > > +++ b/drivers/md/bcache/util.c > > @@ -268,7 +268,7 @@ int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp_mask) > > int i; > > struct bio_vec *bv; > > > > Hi Ming, > > > - bio_for_each_segment_all(bv, bio, i) { > > + for (i = 0, bv = bio->bi_io_vec; i < bio->bi_vcnt; bv++) { > > > Is it possible to treat this as a special condition of > bio_for_each_segement_all() ? I mean only iterate one time in > bvec_for_each_segment(). I hope the above change is not our last choice > before I reply an Acked-by :-) Now the bvec from bio_for_each_segement_all() can't be changed any more since the referenced 'bvec' is generated in-flight given we store real multipage bvec. BTW, this way is actually suggested by Christoph for saving one new helper of bio_for_each_bvec_all() as done in V6, and per previous discussion, seems both Kent and Christoph agrees to convert bcache into bio_add_page() finally. So I guess this open code style should be fine. Thanks, Ming