Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp540576imu; Mon, 26 Nov 2018 14:41:15 -0800 (PST) X-Google-Smtp-Source: AJdET5e/IusG7u1/PaEZgCstgkL65wUQ2HfsE5CjVRw7ekHuLjWp0401SG2V7Ckb0JOaxXQGTZRo X-Received: by 2002:a63:dd15:: with SMTP id t21mr25881476pgg.347.1543272075315; Mon, 26 Nov 2018 14:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543272075; cv=none; d=google.com; s=arc-20160816; b=a30ZP+DMrCYaMbzF8zHb1BcBx8biS52pU6f0PpCycjdlHh4xshbPT/zjc37bljjbN7 MpnS5Iv85c0htvwaMrUwJ/thxY3n0MQtNoXqPijG+vVxs/OMg7DOxSsNYMxQWT47PZEZ OXVIe+yCTGrtuMv0ezyExakCwQADngz9N2WCLd8QvhG2Uviw73DaUg/5eaKQ6p+6Cze7 Y6w2clJJIw38adFvNCR2/ubfqlyfficLVYI09iMEXP1IaDT/F6ks+etFrkzjt9ftWQf5 wxMmMk7QOI/EY96b0m8QgTU1kgthGfl/KgO5Ag6eCyczNYkQwqh/UoKelNhoDmSNG3+7 22jg== 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:dkim-signature; bh=7SO7oOEdYQMovzlJck3mc2068mng5do2HhlfyldvWPU=; b=LuSe3TcHqZRqFdx1NZ7aQYVNblviRW2PsG0VF8h0iSGAxn2zQ98txftaJ3E/VbfPd7 ifAWRioFXOR2dDZOeYUO49NSPFsz8MR/aleU2ou/BIXaIrOR8mP/NpL/Vj/6g1ESGyBU i5M+jTL2cYcoZ4WoAbX9Qa2jaiKZPer3oVULgYbGDaKj3hwVn+PxO7djwkVyszHMxe5z qhKHCJ8ZDt7KgxXLRjA5Wi7QPbEz3I4upbQKfU8nL7TvENDeNW09vpfRrRjcQMREMjSp zRrBmE9Q7b0ojt1ywzwU5yMHpkCoUnuxUqwAvSe9RVJ9bGprn2IoIRjlsmhdVGKowj6q h2/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=i3qnjehB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x128si1758469pfb.128.2018.11.26.14.41.00; Mon, 26 Nov 2018 14:41:15 -0800 (PST) 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; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=i3qnjehB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727654AbeK0Jfs (ORCPT + 99 others); Tue, 27 Nov 2018 04:35:48 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41385 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727629AbeK0Jfo (ORCPT ); Tue, 27 Nov 2018 04:35:44 -0500 Received: by mail-pl1-f194.google.com with SMTP id u6so14575849plm.8 for ; Mon, 26 Nov 2018 14:40:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7SO7oOEdYQMovzlJck3mc2068mng5do2HhlfyldvWPU=; b=i3qnjehBiyOqrFRjAHBr9Jb6QUj670RxC/4MexyY1O/JiJiZzrjd8nTLEhgSW7RAfc +FVQbE8UyT+he+H1Q/aEJn7aHCBC5DFtZgeBL+uBBaKIAdDIfovyVnEu86oD25w4aMJ3 bDQLit7fjyShtnmlwlIKSnMKWauICluAa5y02isaD/gK3jBbk0SVRWiSOASYM62FQd1D E0TxievofnMe9YDLX8FKtJ0j3ToCj7fKJfNyPMY1owCLnWL/ioXt1vjKxzo45yRN8OMG qi64+ePkHIswSk+nzc6tG7YZyrgg/qop0MKatM26GS0yrqjjnl2yv8qFAO7A1OlHW3pX JO3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7SO7oOEdYQMovzlJck3mc2068mng5do2HhlfyldvWPU=; b=ecz5n8+e1AyagGTeN7eoxZuN71EnNUZIBPVaZwI0tmZpl3m09zaaUZ4LYbJRERbhLG f5dzHRi7NyuWdFftZu7vVBA5KK1rQKo4GzZ3+xjiaHwUfqZ7Bxiro1OBswZlB+5f4kvL ZJngLtLWPj5bf/RrRm7k+Y0RnevkSMZJOyz0r5PDpRrTkpBxBCXiAle+tKWlKB02nQFs 4Knx5npUx3qFZHmG20eHCKexsKH3KywrrgvgH6BEnH438FWeMqya3nizAz4qAr9YDjee mgvksK9GXtiAHtFr7D/lkdkuym5RSVynBT/cv6ZdKZm+8ofsbpOqtbNixoOPicIpgf7L 9SbQ== X-Gm-Message-State: AA+aEWYuBqYzhGyU7JDo1Y+KYqDNtvd4NIoqxoeYkzioD2AC3Yi2uPVv gS6swR8zL8BZtqtRMqvA9fFHpA== X-Received: by 2002:a17:902:aa8c:: with SMTP id d12mr7815591plr.25.1543272005111; Mon, 26 Nov 2018 14:40:05 -0800 (PST) Received: from vader ([2601:602:8b00:55d3:e6a7:a0ff:fe0b:c9a8]) by smtp.gmail.com with ESMTPSA id t13sm3253245pgr.42.2018.11.26.14.40.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 14:40:04 -0800 (PST) Date: Mon, 26 Nov 2018 14:40:03 -0800 From: Omar Sandoval To: Ming Lei Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , Omar Sandoval , Sagi Grimberg , Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: Re: [PATCH V12 14/20] bcache: avoid to use bio_for_each_segment_all() in bch_bio_alloc_pages() Message-ID: <20181126224003.GK30411@vader> References: <20181126021720.19471-1-ming.lei@redhat.com> <20181126021720.19471-15-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181126021720.19471-15-ming.lei@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 26, 2018 at 10:17:14AM +0800, 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. > > Acked-by: Coly Li > Reviewed-by: Christoph Hellwig Reviewed-by: Omar Sandoval > Signed-off-by: Ming Lei > --- > drivers/md/bcache/util.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c > index 20eddeac1531..62fb917f7a4f 100644 > --- a/drivers/md/bcache/util.c > +++ b/drivers/md/bcache/util.c > @@ -270,7 +270,11 @@ int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp_mask) > int i; > struct bio_vec *bv; > > - bio_for_each_segment_all(bv, bio, i) { > + /* > + * This is called on freshly new bio, so it is safe to access the > + * bvec table directly. > + */ > + for (i = 0, bv = bio->bi_io_vec; i < bio->bi_vcnt; bv++, i++) { > bv->bv_page = alloc_page(gfp_mask); > if (!bv->bv_page) { > while (--bv >= bio->bi_io_vec) > -- > 2.9.5 >