Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp945922imu; Fri, 9 Nov 2018 08:30:31 -0800 (PST) X-Google-Smtp-Source: AJdET5fD2iQRzJdSOyHrOlwrxLw4myCBPNOqyttjFlhATwHETCDS8td+7BBZ+/aZx7970OyQoMgB X-Received: by 2002:a17:902:20b:: with SMTP id 11-v6mr9350114plc.147.1541781031401; Fri, 09 Nov 2018 08:30:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541781031; cv=none; d=google.com; s=arc-20160816; b=LCMogq7KBQFpfWComOPrbnCxx+fQf0xsypApQsgCQFU+I2t7rj4rvVjOPteOOyRm86 tcQXAv3Ma1SRHjuXgR8y7OrD3zH1i/SR+mse1AkBbtXu8UHU/tUfm8n3AXMhh048z20n 8L9GF1I6GiPP9df7K6utCycdW/0MxqmFgQ28PA0lAeXKLyjO19NK0InJUKhZIpSPFbWj EesckJ+MAIaWLKcxMpjnyHkYKJRmPqoj3IbgHYSjJpXHvPedW4q7E6A0QJw8AgCiujwL 2eTViRHYrvYqKlkL55hILo8cbVG+KvUBvyXeIl1IBS0XfvV7rwHxyWozwHrQKEJ+1g4v EiZg== 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=4KM+ia2Bd4RjxeLY4oEXzptY7Nz95tkF+Cllv35WTUk=; b=hqPBbLptMiFzLCfxl3HTeGU8QC/bgX5gaBsRfjVUoPnQ2Y7EhQ77PyPBqAadHnIT8F fa1R2zGJrKJcx6vMCrxlU6pqu/5lV89zXtxIwU/f9N48qMbSMckYRLEchzBtuWfJu9Q9 P0dFFq78zCLrwK8Cv2zjRkzneUt4hMvM5vFdd2CLG96aXwo98F85c1vBDWpRCWmNEL0V wmUg1n+H08p657KeTdXkwhHhFg9upQypf8GlpV5LSVsptWSTY4BhaIihHOElnrrCb6J7 NP9gVEkhNqvYMrQFoZwKekaabTJcahuZOZMk3DMlaR91n/DMfyEjDgNFdQlk+zvtXoo8 EJiQ== 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 g11-v6si858571pfe.186.2018.11.09.08.30.05; Fri, 09 Nov 2018 08:30:31 -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 S1728760AbeKJCIk (ORCPT + 99 others); Fri, 9 Nov 2018 21:08:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49718 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727828AbeKJCIk (ORCPT ); Fri, 9 Nov 2018 21:08:40 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 478A87F6A7; Fri, 9 Nov 2018 16:27:23 +0000 (UTC) Received: from localhost (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E7D526563; Fri, 9 Nov 2018 16:27:22 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Ming Lei , Coly Li , linux-bcache@vger.kernel.org, Christoph Hellwig Subject: [PATCH V8 11/18] bcache: avoid to use bio_for_each_segment_all() in bch_bio_alloc_pages() Date: Sat, 10 Nov 2018 00:26:03 +0800 Message-Id: <20181109162610.18981-12-ming.lei@redhat.com> In-Reply-To: <20181109162610.18981-1-ming.lei@redhat.com> References: <20181109162610.18981-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 09 Nov 2018 16:27:23 +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. Acked-by: Coly Li Cc: Coly Li Cc: linux-bcache@vger.kernel.org Cc: Christoph Hellwig 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