From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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> Sender: linux-block-owner@vger.kernel.org List-Id: linux-block@vger.kernel.org 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) -- 2.9.5 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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> Sender: owner-linux-mm@kvack.org List-ID: 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) -- 2.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org