Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966537AbcJ2IQw (ORCPT ); Sat, 29 Oct 2016 04:16:52 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33585 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933044AbcJ2IQ2 (ORCPT ); Sat, 29 Oct 2016 04:16:28 -0400 From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , "Kirill A . Shutemov" , Ming Lei , Jens Axboe Subject: [PATCH 60/60] block: enable multipage bvecs Date: Sat, 29 Oct 2016 16:08:59 +0800 Message-Id: <1477728600-12938-61-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> References: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1135 Lines: 43 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 c9cf0a81cca3..b73777dc59c3 100644 --- a/block/bio.c +++ b/block/bio.c @@ -838,6 +838,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 && @@ -845,6 +850,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) -- 2.7.4