From patchwork Wed Jun 27 12:45:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10491453 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 59FA360325 for ; Wed, 27 Jun 2018 12:50:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46E3528E06 for ; Wed, 27 Jun 2018 12:50:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44EB428E3F; Wed, 27 Jun 2018 12:50:29 +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 DF3B328E57 for ; Wed, 27 Jun 2018 12:50:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3FCB6B0293; Wed, 27 Jun 2018 08:50:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CF04E6B0294; Wed, 27 Jun 2018 08:50:27 -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 BB9FC6B0295; Wed, 27 Jun 2018 08:50:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f200.google.com (mail-qt0-f200.google.com [209.85.216.200]) by kanga.kvack.org (Postfix) with ESMTP id 91A056B0293 for ; Wed, 27 Jun 2018 08:50:27 -0400 (EDT) Received: by mail-qt0-f200.google.com with SMTP id v14-v6so1888250qto.5 for ; Wed, 27 Jun 2018 05:50:27 -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=sl1T2g2EwRCyJbh3geKgy5pIZaule4/WNWjulowZ7dw=; b=aU4kXjC4Ng69WCRQxxZ2bXbDNw6J/kNPJHJah+3CP9te82WgbjW+vblabKxHtQO/iq gIP7oCHOXGvrGT731t9SHU1wJ6etdDBAWhRp/MRK/N+qBwsA6r3CvFCDJ/PxjDC9rJn8 P+P3kE+21yMXcaiw6b5FKdXRoDxjOeeP999egcB8KfBDjiukGtJxN2HqZ2Wvz1fU/P4d wgwBjZVAcdHCBpGlVjF9WpaaKTuJJ4JZ3OiYH/CFPAUyOmZMRUBe1e7VpSngJNt7uKz6 b4phg/6R8JCu4/2wmbLA/wdSi0le2WDQfaBFoXW4mI8wvfe6V8tO+V56SSBAiHAfh/ba 37Bg== 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: APt69E3yOHvYkabcDYdd2kV5voL7Z03tUDMdAI4STu0wLRShdQHbQJuK k6IUSwvp09uIbjddnYTm45a6jhxoNniz7R9IKXKoyvHsIYHg9LSOUwj8LNuDXHXMGv4kuj6sI3T Afa6Rb5CisupF7UCeMGs63l8hqgH9DHwtj2xjRiZXkwvD9hhRkJXhBohCHepgZMYZPQ== X-Received: by 2002:ac8:c8:: with SMTP id d8-v6mr5282868qtg.202.1530103827382; Wed, 27 Jun 2018 05:50:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdrIYK+AquYemVWOIHVhSY7NnwOpaUnh+ZR74yqBna88hGGIxLobv8NRbplY2xIDDJhyzPb X-Received: by 2002:ac8:c8:: with SMTP id d8-v6mr5282836qtg.202.1530103826821; Wed, 27 Jun 2018 05:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530103826; cv=none; d=google.com; s=arc-20160816; b=kHUNleFpNiK0Gf4f0q28VmQsTdLCIXIlLSC5rxAol1O68tYvSbGDLR1sEdE/QqkxR+ czme+IdWKDp5/Ucxl6LoUbqnmfSOp2Mm1OaedzvHJGmDljxCrG+JvuRc0X2V9PEpiJuZ DaIP9umxCZZr9ddXeIRKfGFxKMZDr63WoqMmU5D5h1ROMuoI8+wR0givwl05pNhpjX1s iKc7NIaVmyTmUsw3Bd2QKv86A1UGefWrZ2+YOKtlxi3R5kfGUx2LfvRAFo3dNiOPjqh6 DtlRku6tfiI4YjiVPOBfpQDlQaBr08O2/Q4YSZy4d1Jn32BF6B/4zaEXnlAU+7OtwX8S UvfA== 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=sl1T2g2EwRCyJbh3geKgy5pIZaule4/WNWjulowZ7dw=; b=pLnOWT3uR96n9c9bQMBGUJ24HgYe0cJ3s4Mc1xQjbxbwpm7IQq3G73IQMVXb3IkdvT NqGog9OQrDR4Mo39VSenBTKXB1KJ/M3bimNRq7PfrSHESpgix+7FL7Ys2GgORswr5vnC dLqfM260aid1d2dRqlXfNfUXN6Z0DZbgEQAT4/qkuLfH3IzL9Xl5np3maA+DgmcJDJVr ElLU0lbGj+qUDNItwGbCUQbhJ778R4Y/j9eOekwtZDwGkki6RkAeWHvL8MYvIeLxjDXy a37s+641w3oXarI9T8zS8+as2f8d4asZwnygiE50XLy+IbrH3swvWNYUTlQA6pmDM0qb XzTA== 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 c6-v6si3911713qvo.55.2018.06.27.05.50.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 05:50:26 -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-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61529407C56D; Wed, 27 Jun 2018 12:50:26 +0000 (UTC) Received: from localhost (ovpn-12-44.pek2.redhat.com [10.72.12.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id E27C11C5B9; Wed, 27 Jun 2018 12:50:14 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Kent Overstreet Cc: David Sterba , Huang Ying , Mike Snitzer , 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 , Randy Dunlap , Ming Lei Subject: [PATCH V7 22/24] block: enable multipage bvecs Date: Wed, 27 Jun 2018 20:45:46 +0800 Message-Id: <20180627124548.3456-23-ming.lei@redhat.com> In-Reply-To: <20180627124548.3456-1-ming.lei@redhat.com> References: <20180627124548.3456-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 27 Jun 2018 12:50:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 27 Jun 2018 12:50:26 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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 | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/block/bio.c b/block/bio.c index 22c6c83a7c8b..1dc3361fd5f9 100644 --- a/block/bio.c +++ b/block/bio.c @@ -765,12 +765,23 @@ 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) + goto merge; + + if (bio->bi_disk) + q = bio->bi_disk->queue; + + /* 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) + off)) + return false; + merge: + bv->bv_len += len; + bio->bi_iter.bi_size += len; + return true; } return false; }