From patchwork Fri May 25 03:46:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10426141 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 C7D0E602D8 for ; Fri, 25 May 2018 03:52:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B706A295A6 for ; Fri, 25 May 2018 03:52:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A38EE295B3; Fri, 25 May 2018 03:52:23 +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 4BFD8295A6 for ; Fri, 25 May 2018 03:52:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40C266B02C6; Thu, 24 May 2018 23:52:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3BD916B02C8; Thu, 24 May 2018 23:52:22 -0400 (EDT) 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 2D2376B02C9; Thu, 24 May 2018 23:52:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f197.google.com (mail-qt0-f197.google.com [209.85.216.197]) by kanga.kvack.org (Postfix) with ESMTP id 005556B02C6 for ; Thu, 24 May 2018 23:52:22 -0400 (EDT) Received: by mail-qt0-f197.google.com with SMTP id x2-v6so2836270qto.10 for ; Thu, 24 May 2018 20:52:21 -0700 (PDT) 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=xNSZsQhcTWf4Fi1+5kv/C+HXBI2hb81QgVCjYUqd4kQ=; b=O6LJPNKplSJOn8J/uNQuxelXGA9FrdLBpiqZMeKoM1P5eLDSbtFsZOnDCq6+EdBFNb U7QL8K0dvTlt497WPZylGtzwgcE/FH7N0ILK8SRAFe1MJO3iNZT4b+Bi5WD67ko3PWv8 K/tIUUv2E/v4BUSOUWE4sMDTLmWB0vg0oSdaRpbX4rHS+aHq5QYpu6xImEc/2HeyxOFl UIB/hbSKs8fUqcvbGYuUs/MMVvuTFnXDbqCqm8ZCnQNxi59aSHWeRc1FCB+sjRltFYHs m/Aiudhu024hpA3Ya5+qRxtzSrL2MlVMlscDF4BrYxa5T7LABXzjrCqW4XKWrRlN/22+ qotA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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: ALKqPwcxzWts/V8EVl2YFO9iioEDIxGBORHOgm/4YU2xUkrNmdxLFPQG 0QjX1wCzlx1j0/qT4LgbaKU+7kP03nFBV5h9S13uI2ABGDryEm807JLY5Vi2o3Ilzug97hre16J BNpswbAxNQHtKz7PBL/VGw0o8kL2FPOwAQhw2XJ+2QS3Y++MRWZUGZKRmmh/Lvpqrqw== X-Received: by 2002:a0c:96eb:: with SMTP id b40-v6mr602567qvd.135.1527220341811; Thu, 24 May 2018 20:52:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJOLLvFGGzWbB7JAShfqxYHDKOz6lT6gmnrJRzwyNXKld2e8tjr6ssXtQfuuPEtwwkQs/ay X-Received: by 2002:a0c:96eb:: with SMTP id b40-v6mr602549qvd.135.1527220341318; Thu, 24 May 2018 20:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527220341; cv=none; d=google.com; s=arc-20160816; b=BZVKyn2NBR6WZN49AJlc6cKDflMIH89Hp/wC56Ct+lKjSbmVZ/VtoQvMgUN0EfJJb3 mDeHbfV+SLzBr9fZnCNK0iYA7p0nBegi3QzjqNQz0FmRi+GKidLOiAo/hO8IiB3w1Bv7 tkyKLV9m0bFHtzAv/vt36u2a0MI1wkrK/AZdSm5JCQhwt423zdfJ61BCeDBSzhuiqSZR I1dRsiSvlqKRpmxU9G5xV0Mc8ab67elxxx5IaNt6ZK2iRnqnCeKSOg6YC/jVHFlHAJpH 3WzHA8j3tQOPayK9+HVCphkMo/hZZxys6l+bzXDmT2FNfGG5PE0fSsW30RjfdCdbbjPm KocA== 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 :arc-authentication-results; bh=xNSZsQhcTWf4Fi1+5kv/C+HXBI2hb81QgVCjYUqd4kQ=; b=LXKELvTQJG8OwaPMRGkIKnO83xGE7/24qF1lo3I9cKjGGtcLGpCcecrjt3AQ2RLFtK KQVNmqh8J3+LqsHEn+fEC1PttDFH5bVnR20RaRQ6yBIZir3C8hXLapHEdsDfrQmvsVyU 16GUcZEdZkWxuc6f1O7hQ7IuQf42i0CyWwG3RImkcdWocij6M1/zrjLNHguU3fio5qgA c+F90CcetBGavXWfSvjPy3j5Tp4C/qjjBRuV9C9tpjUQhecg5iBKACAgO81StASqQuGG 1vUozM17AR1qHCaRjGKThn66piL6u+2TyGBEJMMuao1vf+2JgOlxQE66ZRisN4k4T6aP +1HA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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 (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id t6-v6si8462748qto.159.2018.05.24.20.52.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 20:52:21 -0700 (PDT) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E081C401EF03; Fri, 25 May 2018 03:52:20 +0000 (UTC) Received: from localhost (ovpn-12-30.pek2.redhat.com [10.72.12.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C37432166BB2; Fri, 25 May 2018 03:52:13 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Alexander Viro , Kent Overstreet Cc: David Sterba , 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: [RESEND PATCH V5 30/33] block: enable multipage bvecs Date: Fri, 25 May 2018 11:46:18 +0800 Message-Id: <20180525034621.31147-31-ming.lei@redhat.com> In-Reply-To: <20180525034621.31147-1-ming.lei@redhat.com> References: <20180525034621.31147-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 25 May 2018 03:52:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 25 May 2018 03:52:21 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' 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 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 c160c143cc1b..bc3992f52fe8 100644 --- a/block/bio.c +++ b/block/bio.c @@ -876,6 +876,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 && @@ -883,6 +888,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)