From patchwork Mon Dec 18 12:22:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10119299 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 C071460390 for ; Mon, 18 Dec 2017 12:34:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B28A328F70 for ; Mon, 18 Dec 2017 12:34:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A72D828B7E; Mon, 18 Dec 2017 12:34:40 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F49428B7E for ; Mon, 18 Dec 2017 12:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759077AbdLRMdK (ORCPT ); Mon, 18 Dec 2017 07:33:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39834 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759063AbdLRMdJ (ORCPT ); Mon, 18 Dec 2017 07:33:09 -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 EE709C0006F6; Mon, 18 Dec 2017 12:33:08 +0000 (UTC) Received: from localhost (ovpn-12-48.pek2.redhat.com [10.72.12.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB01D69282; Mon, 18 Dec 2017 12:32:58 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Alexander Viro , Kent Overstreet Cc: Huang Ying , 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 , Ming Lei Subject: [PATCH V4 42/45] block: enable multipage bvecs Date: Mon, 18 Dec 2017 20:22:44 +0800 Message-Id: <20171218122247.3488-43-ming.lei@redhat.com> In-Reply-To: <20171218122247.3488-1-ming.lei@redhat.com> References: <20171218122247.3488-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.31]); Mon, 18 Dec 2017 12:33:09 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch pulls the trigger for multipage bvecs. Now any request queue which supports queue cluster will see multipage bvecs. Signed-off-by: Ming Lei --- block/bio.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/block/bio.c b/block/bio.c index e82e4c815dbb..34af328681a8 100644 --- a/block/bio.c +++ b/block/bio.c @@ -845,6 +845,11 @@ int bio_add_page(struct bio *bio, struct page *page, * a consecutive offset. Optimize this special case. */ if (bio->bi_vcnt > 0) { + struct request_queue *q = NULL; + + if (bio->bi_disk) + q = bio->bi_disk->queue; + bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; if (page == bv->bv_page && @@ -852,6 +857,14 @@ int bio_add_page(struct bio *bio, struct page *page, bv->bv_len += len; goto done; } + + /* disable multipage bvec too if cluster isn't enabled */ + if (q && blk_queue_cluster(q) && + (bvec_to_phys(bv) + bv->bv_len == + page_to_phys(page) + offset)) { + bv->bv_len += len; + goto done; + } } if (bio->bi_vcnt >= bio->bi_max_vecs)