From patchwork Tue Dec 27 16:05:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9489511 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 8DE8F601D2 for ; Tue, 27 Dec 2016 16:08:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7ED1F1FFD6 for ; Tue, 27 Dec 2016 16:08:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 736D325E13; Tue, 27 Dec 2016 16:08:13 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 2DC261FFD6 for ; Tue, 27 Dec 2016 16:08:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933140AbcL0QHt (ORCPT ); Tue, 27 Dec 2016 11:07:49 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:32885 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933124AbcL0QHn (ORCPT ); Tue, 27 Dec 2016 11:07:43 -0500 Received: by mail-pf0-f195.google.com with SMTP id 127so8381772pfg.0; Tue, 27 Dec 2016 08:07:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QpLqnrhODscQfjhwqyuo9aHBNe/8a6lyKoo319trvlg=; b=sOnOaigUKAR+5LJ62B9KTBp+STcynkBTUciWETu2ReLMjQqv/DmaWbHoudaZRtZez3 BHEUT6Z/ZmmeO/p5PlkhrcowI0fhuGNXEHVgs+GruYI/Xz01qw3cjI1PgcvVHsIlpFhK N8UytpkEgY9ICGAyijGFe4C0Oz0MaUCc5cUj6uT1rW2lea/rcWqvLA5Cy67E+LjiMEv1 KTMJWgSMxMjnJNe2VPYLHqDvzmMn+wGTni0ZsabqYdZn60wdCLGNPqp03qmkILKY9Q9G 8LM0bqVUmo65N3avoWUUcCRurq3QtnpuI6FK4OWyfd4HhngNdrlgBqBbKKPAhvNJiLVR RMcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QpLqnrhODscQfjhwqyuo9aHBNe/8a6lyKoo319trvlg=; b=YEwUZRaD5T7NIDiR/9oIna9Il+MW45Iaed05SveEbJzotTlFtnvE9Bj/0xWmca05sN mh0wYie2W/fTkecoo/FMsDNR/bB8R/LPJ4d88TXTmQNh5w9pM+T3znZwYtDYbKs3jhH8 KZ9XwCKTn1pPIY77uRrEn0/i9dIxwMwfhYnpwcasVClT3ReS9MnbN3xLw4d59Zbt8GlA R23/5zP3skPGq0UsZw/OasfYlceu3gVxF7KTHYMYrhlHC448ezIFgV4U9Vn916Lh5r2V N1a/uNPOhbNeiSZY1rb4aPwhA7wsdS2GcTOU5ihQ6w0nVYnirq/03ii/Gq44H4EjZm+Z 0a6w== X-Gm-Message-State: AIkVDXLjhOjeVAqQVU48lzq8wTn+HjXYVHEhObnn5dGU2ROzDcnOjdogBNtfv6rp15NQfg== X-Received: by 10.84.206.37 with SMTP id f34mr68290679ple.127.1482854857092; Tue, 27 Dec 2016 08:07:37 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id 72sm90764005pfw.37.2016.12.27.08.07.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 08:07:35 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Jens Axboe Subject: [PATCH v1 54/54] block: enable multipage bvecs Date: Wed, 28 Dec 2016 00:05:03 +0800 Message-Id: <1482854706-14128-23-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482854706-14128-1-git-send-email-tom.leiming@gmail.com> References: <1482854706-14128-1-git-send-email-tom.leiming@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch pulls the trigger for multipage bvecs. Any request queue which doesn't set QUEUE_FLAG_NO_MP should support to handle 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 9acc3db0f2df..a2ad9c577aff 100644 --- a/block/bio.c +++ b/block/bio.c @@ -843,6 +843,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_bdev) + q = bdev_get_queue(bio->bi_bdev); + bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; if (page == bv->bv_page && @@ -850,6 +855,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_no_mp(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)