Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7768469imu; Thu, 15 Nov 2018 00:57:55 -0800 (PST) X-Google-Smtp-Source: AJdET5dK73wB/OolmB8fE0vC03r5EqcvsM1/KHMxlUBwvqnOqLxCTDgRJY58wGbAPXT/Q//3tbiM X-Received: by 2002:a17:902:d206:: with SMTP id t6mr5472142ply.193.1542272275272; Thu, 15 Nov 2018 00:57:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542272275; cv=none; d=google.com; s=arc-20160816; b=0lhML+qiMHmsKQmTCH4LUy8nRhZfVVrLtxSaBa6fEAE3vs9G5LY8nJ34ti2sbZVkvt gZTVVr848rNpL6OAnqD7aXPQvjSWtWeosOb1tcyBrUN9uIRASayrhOH16GE9MK2w0apy BcpviwK7mnBqKlh5cMij+tlGMy3wcBovsSUspeHbkBu5pc8bA6XSZ3bg+whZYx0wTwdz vIt+la8vWPzjh5T+J7PSty6st34uU9CDRO97usqTPn8+QvA50cmKdB/3hDyUg7sgn5aa GCY2t90YHoRSFScmOSaOtUUwON2ByrQFTBwVnrgczEhRcAc/i+aSnp3txvCyDnbwkvBK ETcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=KsK+yW7qYUQuHCvE6rEDlffDmIoBa+mM4kNBOYDMPlI=; b=A23x7MnRsmkqDiQU4Cj9o3/+HoGQKTVgjer7eCHupzggRtbEdH8DAG6RgkOgirWYTU aA7Q/L+EaWABF0KZ4KxZX+cC0LpGEsWLE4Adm56Ttk2MA0sBZurC2FuW8jLmECibXFjU lkqabEZrJHB72N73/6fmVXz1Q9TuNWrMVuvbECL6caUsB36yL5O4bXuULQoojYqDzmB6 f0A5jMsrJcbGJcps1dinp0PhLPWuqeAa2fS163hsVh64wmUufwa3HGTYTMqBdEHeR61v 5WPajnJCr87VPqEBCbQaikXhZjrEQxlm/dHaPRo9kAosWSDunQPhjNsjbWnQlnd223Q9 +zIA== 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 b6-v6si20069194plr.386.2018.11.15.00.57.40; Thu, 15 Nov 2018 00:57:55 -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; 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 S2388113AbeKOTDW (ORCPT + 99 others); Thu, 15 Nov 2018 14:03:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40096 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728527AbeKOTDV (ORCPT ); Thu, 15 Nov 2018 14:03:21 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EE95308ED4B; Thu, 15 Nov 2018 08:56:27 +0000 (UTC) Received: from localhost (ovpn-8-23.pek2.redhat.com [10.72.8.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4796A5E1BF; Thu, 15 Nov 2018 08:55:59 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ming Lei , Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, linux-erofs@lists.ozlabs.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , Theodore Ts'o , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: [PATCH V10 11/19] bcache: avoid to use bio_for_each_segment_all() in bch_bio_alloc_pages() Date: Thu, 15 Nov 2018 16:52:58 +0800 Message-Id: <20181115085306.9910-12-ming.lei@redhat.com> In-Reply-To: <20181115085306.9910-1-ming.lei@redhat.com> References: <20181115085306.9910-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 15 Nov 2018 08:56:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Dave Chinner Cc: Kent Overstreet Acked-by: Coly Li Cc: Mike Snitzer Cc: dm-devel@redhat.com Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: Shaohua Li Cc: linux-raid@vger.kernel.org Cc: linux-erofs@lists.ozlabs.org Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Cc: Darrick J. Wong Cc: linux-xfs@vger.kernel.org Cc: Gao Xiang Cc: Christoph Hellwig Cc: Theodore Ts'o Cc: linux-ext4@vger.kernel.org Cc: Coly Li Cc: linux-bcache@vger.kernel.org Cc: Boaz Harrosh Cc: Bob Peterson Cc: cluster-devel@redhat.com 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 20eddeac1531..8517aebcda2d 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -270,7 +270,7 @@ 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) { + for (i = 0, bv = bio->bi_io_vec; i < bio->bi_vcnt; bv++) { bv->bv_page = alloc_page(gfp_mask); if (!bv->bv_page) { while (--bv >= bio->bi_io_vec) -- 2.9.5