From patchwork Wed Jun 27 12:45:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10491441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CFEFA602B3 for ; Wed, 27 Jun 2018 12:49:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C029028C9A for ; Wed, 27 Jun 2018 12:49:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B44A728D92; Wed, 27 Jun 2018 12:49:59 +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=ham 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 4469928C9A for ; Wed, 27 Jun 2018 12:49:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 663EE6B028E; Wed, 27 Jun 2018 08:49:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 63A106B0290; Wed, 27 Jun 2018 08:49:58 -0400 (EDT) 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 52BFA6B0291; Wed, 27 Jun 2018 08:49:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id 27F736B028E for ; Wed, 27 Jun 2018 08:49:58 -0400 (EDT) Received: by mail-qt0-f198.google.com with SMTP id z26-v6so1773317qto.17 for ; Wed, 27 Jun 2018 05:49:58 -0700 (PDT) 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=Ac8fyN3C3k6xValkk7vzjvabHfR1+7WYLitMJmSal7U=; b=GJ+RtHc6m+KMRglugBzF91zk2hbtTPOOF9XtKmMnIU5KhXusu6mxERQSy2BRNOF0Dj UC6euMSFiv4zycsC6rKKVRcpL135q1w6mMABJ6AGmCiHZsKVOP8b5fNXYJ1zpNs4ePZh CX39j30XFSR7ACv0sXnu+au6i5NvRL9Iph5MGNFt0mzCMBTrEMUMFTFG++YW0hj/psJy RFWR47vMdB3ZnFqT1ogqI2118rhJ2Uymwcs3mTeJnGdOszHOMFseHoaqGlX0BVS1VN54 /NGltkNqN6/fxve7kyVZdHc4XX9Tl0lntON6PD8h2u5iT6svAXItJcxMS0ZHenVo7HRh DQJA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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: APt69E2LhwD9tzsuu1ohcoNOG1XP17bYa5bKJ0nn5e5UITQn/pA3VO/J pMhXD5cIWz7LTEUqrlpqAAzNQYyr1gy3J7kgRmjnq1LCcln5R+dRuGh6ST7bM0okpqihvCmEzSr x4ODxHAD4X/E3k7VSodYbzpmscWxTY3wx9oWdoSlGuPUM6vSfz6IZhncKtJi2CdWKoQ== X-Received: by 2002:ac8:3209:: with SMTP id x9-v6mr5368061qta.128.1530103797879; Wed, 27 Jun 2018 05:49:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcagVXrq0/dow9rcIxFcq/BTgbmHrBusks6NPpex3eOcJ2QFNzHN+5Halk9QTfujh7kQBH3 X-Received: by 2002:ac8:3209:: with SMTP id x9-v6mr5368025qta.128.1530103797287; Wed, 27 Jun 2018 05:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530103797; cv=none; d=google.com; s=arc-20160816; b=tcFRRQjxiKQyiadfFHFUSBlWNTxuTHMf+OuzoSMDd5NHrwGo3Q1rE3j+5OH5qcT8/z 2om/qaxhLVYPaFV7XiIGtkL7UJuBu9dfUYRGCnn19oDxD9+nFcxAU/8fNMym/n3k3KNq FNZM4IdhHLZ70eZwM6h4ASdY24WhoB/srCbfXXwnf7DMCXGPyYwhW56ipfgCFrAA5dsm soqyJkUV9fpHJ26K0Vlvy9BoBLQdVvjmatBawVaN7TnvahVgwQKH/yj6Us/XmkZp7GZv 7rMmVjvOdD1FU3Fx9oT0mXmLP3dizGMSyllO2jzj7tcYMJRy95jLKtBawzLlATPjh5qO +BJA== 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 :arc-authentication-results; bh=Ac8fyN3C3k6xValkk7vzjvabHfR1+7WYLitMJmSal7U=; b=VVa4akMAOckkoUdkyP8BXxe/eMjWauEFKH22Mad3+/H2Sqyn5sDxp1MxpV4ghIc1Wm +e09DmUdjY2wzapH4h2lOJxP2SLHycQxck3KqYWiX6Eo7xd6wmYohRf6nTElC141GRbi xXCC+2PNA5nfaSbi+UOo5xa1vxSKVIvIl9zsRkb41FRNSz/JdsoGRbdi+2ASNiffqJv0 MXWE4Yxbl8rVB37iyEIZHOjUCkoezEswnnUtEIol2eDQvM1Q0Fpxs/jqcWCJhWOj0SAA F/d/6IYkKx5bF4DoPANY4/iBlweb7GvbIZ5+CW/EG1IMQrXGaTWzD8jGIjK8taeqHoRE mjGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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 (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id g24-v6si3626945qvi.238.2018.06.27.05.49.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 05:49:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1272818F043; Wed, 27 Jun 2018 12:49:56 +0000 (UTC) Received: from localhost (ovpn-12-44.pek2.redhat.com [10.72.12.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8F591C5B9; Wed, 27 Jun 2018 12:49:48 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Kent Overstreet Cc: 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" , Coly Li , Filipe Manana , Randy Dunlap , Ming Lei , linux-bcache@vger.kernel.org Subject: [PATCH V7 20/24] bcache: avoid to use bio_for_each_segment_all() in bch_bio_alloc_pages() Date: Wed, 27 Jun 2018 20:45:44 +0800 Message-Id: <20180627124548.3456-21-ming.lei@redhat.com> In-Reply-To: <20180627124548.3456-1-ming.lei@redhat.com> References: <20180627124548.3456-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 27 Jun 2018 12:49:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 27 Jun 2018 12:49:56 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' 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: Coly Li Cc: linux-bcache@vger.kernel.org Signed-off-by: Ming Lei Acked-by: Coly Li --- 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; - 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)