Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7769940imu; Thu, 15 Nov 2018 00:59:44 -0800 (PST) X-Google-Smtp-Source: AJdET5efg8oMAryWPRQkhW27/xjMQtZbn63h3DlG+97rXc+hmhgah78IfE8DwVt4sXz1cv0u/e2r X-Received: by 2002:a17:902:66e5:: with SMTP id e92-v6mr5294318plk.92.1542272383998; Thu, 15 Nov 2018 00:59:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542272383; cv=none; d=google.com; s=arc-20160816; b=VQSIj/ofY2LqUzdwc6mpBTOlNfJNnbgyosCnw/myXzCx+8yjDafKF1kmhbDCTexIJx HpN4rRaKRdxqNIqtHR7QWwHA4ZzquScVhbfenFIk5EPl7qBb15kho9BrAN4u/VpFsy0u wFI0ce3JW7LZC90htUhrkQVySgGqtD5a8D4HCWo4t+a0KmtpA1RM7W6Mj79xTa3TGB/X znYxQiserLtE8E0um/3P0rwXgG7+tcuv5z3ltTBSvZnfJnPXbJJCiXg+JkBVzy+LA1TD 9hqSUbQ71fpR1lAm79X0uMlaCCiqGWh7ZP6JrRtGl5qBeHeOnXQOX30ToFtl5OLkAKjB wZ7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=5mBS/Rubp9DSJ4BLHUaql/WAm+yy83Dk5w3S9m90Zg8=; b=O9oXuWBMu50ul5GswKGrrImPZmVa4JVItqOgdN+iV/gnhS9CPJSkgVFLbEIpLin6Ao XQ6xKD7zZ4ingyTVNlpty4QM3b5fW41QrFgVwSCSx64j7R6/twBcdEL+6XzgipCQGhfz 70M6RoqUERlC+GIK7nxtG9ISpYWFbvvcQlGH/7KwWQ0ByMBLlkq06DTiqCFWuOFqJXeU N/Nm7K1A/jsGdEz62yLaNF2ECs8s2oXJ1w+CqMO4HAgPcTyy8UTxs31kY6HBI3tCZvb0 WVoXZ9u7+Q0w4TN6+E0VMTVpp/odUzmoD5mtwoSDVEgDKl55IoR4aZ1fEuknShfFrNZi ra+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u34si25179352pgk.24.2018.11.15.00.59.29; Thu, 15 Nov 2018 00:59:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387904AbeKOTEH (ORCPT + 99 others); Thu, 15 Nov 2018 14:04:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40582 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728862AbeKOTEH (ORCPT ); Thu, 15 Nov 2018 14:04:07 -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 E085A308ED4B; Thu, 15 Nov 2018 08:57:11 +0000 (UTC) Received: from localhost (ovpn-8-23.pek2.redhat.com [10.72.8.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05ACA61491; Thu, 15 Nov 2018 08:56:45 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ming Lei , Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, linux-erofs@lists.ozlabs.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , Theodore Ts'o , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: [PATCH V10 14/19] block: enable multipage bvecs Date: Thu, 15 Nov 2018 16:53:01 +0800 Message-Id: <20181115085306.9910-15-ming.lei@redhat.com> In-Reply-To: <20181115085306.9910-1-ming.lei@redhat.com> References: <20181115085306.9910-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.44]); Thu, 15 Nov 2018 08:57:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch pulls the trigger for multi-page bvecs. Now any request queue which supports queue cluster will see multi-page bvecs. Cc: Dave Chinner Cc: Kent Overstreet Cc: Mike Snitzer Cc: dm-devel@redhat.com Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: Shaohua Li Cc: linux-raid@vger.kernel.org Cc: linux-erofs@lists.ozlabs.org Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Cc: Darrick J. Wong Cc: linux-xfs@vger.kernel.org Cc: Gao Xiang Cc: Christoph Hellwig Cc: Theodore Ts'o Cc: linux-ext4@vger.kernel.org Cc: Coly Li Cc: linux-bcache@vger.kernel.org Cc: Boaz Harrosh Cc: Bob Peterson Cc: cluster-devel@redhat.com Signed-off-by: Ming Lei --- block/bio.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/block/bio.c b/block/bio.c index 6486722d4d4b..ed6df6f8e63d 100644 --- a/block/bio.c +++ b/block/bio.c @@ -767,12 +767,24 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page, if (bio->bi_vcnt > 0) { struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; - - if (page == bv->bv_page && off == bv->bv_offset + bv->bv_len) { - bv->bv_len += len; - bio->bi_iter.bi_size += len; - return true; - } + struct request_queue *q = NULL; + + if (page == bv->bv_page && off == (bv->bv_offset + bv->bv_len) + && (off + len) <= PAGE_SIZE) + goto merge; + + if (bio->bi_disk) + q = bio->bi_disk->queue; + + /* disable multi-page bvec too if cluster isn't enabled */ + if (!q || !blk_queue_cluster(q) || + ((page_to_phys(bv->bv_page) + bv->bv_offset + bv->bv_len) != + (page_to_phys(page) + off))) + return false; + merge: + bv->bv_len += len; + bio->bi_iter.bi_size += len; + return true; } return false; } -- 2.9.5