From patchwork Thu Nov 15 08:53:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10683857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BC4C14D6 for ; Thu, 15 Nov 2018 08:57:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B553299C2 for ; Thu, 15 Nov 2018 08:57:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D48A2B678; Thu, 15 Nov 2018 08:57:16 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A73D1299C2 for ; Thu, 15 Nov 2018 08:57:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD92D6B0287; Thu, 15 Nov 2018 03:57:14 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A61146B0288; Thu, 15 Nov 2018 03:57:14 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92A696B0289; Thu, 15 Nov 2018 03:57:14 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 641F16B0287 for ; Thu, 15 Nov 2018 03:57:14 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id s19so43898374qke.20 for ; Thu, 15 Nov 2018 00:57:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=5mBS/Rubp9DSJ4BLHUaql/WAm+yy83Dk5w3S9m90Zg8=; b=jitwg3Tzvm6+PKRRLDz0mTVTNLl9YsYPvdlPeNEmufwJtL1H4wyJ/Ni5maQ9Z+gye7 lNBfch9sBgRXky4CJIMpYwTjQYBoT9HZPhMA9ZRRwthVumyuiunNf/p8WgCunFjahxCu pXrxglYRrH2wcNx+ezmZMjmhGYo3L5JIHKSha7YSHruy1H03qXIQFJ21OiSTSR75cUXi jN33vuC9joei8qdjcxdtHwfTF5ZR8IwWnFCFksZewMtj0gSNzkIZ5QgpiY/IqF2zk8C6 De2Sia8tXR11zM1y5S6o7SAQJJBg9khJ38az1Co5ZCi8rMO0b9SjvQ1cBB/DzTZORUGB yQSA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AGRZ1gLiCvDLG0LMLlaUlJ4g+FGIP97MxE3dppzUeRke1L8k4Ba4gD/m JySnSHCWEKk14PQIdjk4o+XpyPFhJfwFqLkyx1idiSSZXr/qUePw//GRz7vx57+1wyR05h3NN6y FliMNPXQ0PEWI7sjEYg2lr0j9x9L9nuq4Y2fHDBD03Kj/WU9aSljpLq858zh/AZ/Apg== X-Received: by 2002:a37:9181:: with SMTP id t123mr4401426qkd.187.1542272234185; Thu, 15 Nov 2018 00:57:14 -0800 (PST) X-Google-Smtp-Source: AJdET5eIKfS/vpZy0Zwywl3XeGjsYYUNOQY46qnojvFUwgBvP694dR/eKXNZumevzLyxtBQ3Q/uY X-Received: by 2002:a37:9181:: with SMTP id t123mr4401410qkd.187.1542272233680; Thu, 15 Nov 2018 00:57:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542272233; cv=none; d=google.com; s=arc-20160816; b=qu8GJ0hWYvcN5PG0Q+GGg4RL2nwLBjIelLXqDh/H3TAWP31iNN0uTVcnF1/lZ2eM9R itX7aA5jQ9+YkvKfQJLXQYRtFcQCNN2XuHYknSqF2ff9MHYkRhiwI/ujCMkHa93I17vy bY/VUnllraryj50dK7RXMaERgM6zJDLwK5XA1pu+Y+6sm5xvsBlxlcDBlXJVj9Wx2ElO TROiJlYcaLywrKW9JtOKjvRtaSUYPB/hWlbuU1Fq35gCCqfUpIqqBg201B5yzx5NtS+R RBXkPZBgbWD0WPgG5QxwuzHdGaSyFsp4aI8z+tHelFd54EYLL9cHDiVCP6MGg/FbGnsb faqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=5mBS/Rubp9DSJ4BLHUaql/WAm+yy83Dk5w3S9m90Zg8=; b=M5TAiXgO1QoSUiEmQaDzANZWVMDdzTwTLEs5pdbCtZkGry8rRsZyT9QZsDnzVYfmUi DAEoCXlqtHVqHR2bDiQp5PLMUewDAVC5Ifgc9B0EoPQBjp1RtpEJAzAODGBOtLRvSKsm YcriH0/vOF7IGCW697kQT82sfRi8ZluEyS0eBc1E56ZC+8cuXg15W7C7e8smWfuA68vX g1pWBX8OSjYdsjI58wKjaUxT/HNBwrIrbekBHnyFhL3T6pmaBooMHvUYKm7rL1huL/nV miKuBkDyAp6dC+SuzQpa5QafRFYPQqRmt8C1b2tvWVJqxkPV1V29qqsOJNVNg41Gk6Gq Tjjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id s60si1766713qtd.374.2018.11.15.00.57.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Nov 2018 00:57:13 -0800 (PST) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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; }