From patchwork Thu Nov 15 08:52:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10683819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D3E8814D6 for ; Thu, 15 Nov 2018 08:56:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C48A1299C2 for ; Thu, 15 Nov 2018 08:56:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B88DD2B334; Thu, 15 Nov 2018 08:56:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 573A5299C2 for ; Thu, 15 Nov 2018 08:56:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 929D76B0280; Thu, 15 Nov 2018 03:56:29 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8DABE6B0282; Thu, 15 Nov 2018 03:56:29 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CA2A6B0283; Thu, 15 Nov 2018 03:56:29 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by kanga.kvack.org (Postfix) with ESMTP id 548F06B0280 for ; Thu, 15 Nov 2018 03:56:29 -0500 (EST) Received: by mail-qk1-f200.google.com with SMTP id f22so42868106qkm.11 for ; Thu, 15 Nov 2018 00:56:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=KsK+yW7qYUQuHCvE6rEDlffDmIoBa+mM4kNBOYDMPlI=; b=Mbsi8qS9Kkykk36Tr1zLbhdt71YXmYOwjpY7piWhRGbHcDh+UdMjUac6+PyQp8Zs9D xP5legV5JVPCDs3SzJgnSt0nSEnIhJzczIfUOfd7wMmUB7mXCWvUoXNmMfdfLeoXkJag qfuWB/KK1A6BUwdYkjPkTkC/Aym6MJMMRvDZKx0+wWlZkChregw0WBxVYv1MQS4IOI3I E8+ST6zEsr89X93MpIyX7Ih3MOavbv5X+9+44ITOX8iM5XCE8/Fs5rpf/N1XzkY6zj9e LoKp9jlM5QV3mzra7MHT/CP8zAf8BWV1U2VR91B3CeLbBjYlC7gHml9Csytg6tZ7RB5G iB2g== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AGRZ1gLmQbtbywnkdp/QGPSoUZaG4ZF76yxfd8wVSJoEgWDdKaJqXNra 0y39bmQ3ei011skMfOjtXNw6oTJoID70o8jnEkmut6Ph9hBAcPP9ZlQ9okxf09nY0c8vVUvhkdQ 6C+LdWifav28HsZ21vzhnDJZzLlNYeJtmrM5w8LoXF9sCf2MlI5ybP62mN0vKWls0pg== X-Received: by 2002:a0c:93e2:: with SMTP id g31mr5299639qvg.194.1542272189118; Thu, 15 Nov 2018 00:56:29 -0800 (PST) X-Google-Smtp-Source: AJdET5e2W+I0463+dz0GLGuTs+mhDrC6bkhBSauoWyHEcvN14FevWKSqc4Lqm3yeqoZQIxAySQPS X-Received: by 2002:a0c:93e2:: with SMTP id g31mr5299613qvg.194.1542272188631; Thu, 15 Nov 2018 00:56:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542272188; cv=none; d=google.com; s=arc-20160816; b=yuT3Or8QmTZE+WgLK4a22vRTGN/wJaS77TOf4ZYqeECVKBhol0h7sqlXjEhyE8ajF9 F5AG17z3NeKUZglqWpam6vnib3WAr2KgGV8HQgACPkpLLC63Xo/MxldOc208wscE7B9F /I5EO7GgXxigotd9VrI1WsWGPh5SIXdflBx3rpNQbWXQxwfixua6Igbur44bgUPPk7wP /BxPq/5qafp/FHe0j0RX5SLa/ENzhR3BAIo28ql8xgE72jh5pTFBRKXgRwvF8/klCvHM JFqBd+trJlwaYnRuCXftnhdt/+nuhQOX4WBSOTDHRxeenmxOkyQ+tMDy62zK37LEiP2O azeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=KsK+yW7qYUQuHCvE6rEDlffDmIoBa+mM4kNBOYDMPlI=; b=rflODseFMWpfx6RyepkHRsu8jHBwbP7vGHBI0cdzhfD1ZFJz4sXNEWgcpZUSLf7Iwr +GYPnQ+pJdfwJHVj99C5YiFM2r8g5naxwZhQffH0IKWHMP9k8h6Ad0KPTtD6pOEqaAv6 O+Cc5airE7XKI2jNkHcVxWbN7xvCrdPqIjs2jk8PF3whPl8ErlDhXgohrwkAgBOcFaOF ELGZj/KNPtHViaQO/FgNI0i63XOTGeDFpxh0iVnXRyT5SxVN0LWG2wdJTa0IuOj+rSsH rgAI1kS3LE4BuVbTI1V6N2nYzD2GHZH7/bETxV9+dwQw7QiSbmMcya72UxIdCTJQVk1D NAGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id a62si8941325qke.165.2018.11.15.00.56.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Nov 2018 00:56:28 -0800 (PST) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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)