From patchwork Sat Jun 9 12:30:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10455641 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 21CFB60467 for ; Sat, 9 Jun 2018 12:35:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13A751FF83 for ; Sat, 9 Jun 2018 12:35:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 082CA223A6; Sat, 9 Jun 2018 12:35:52 +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 A345B1FF83 for ; Sat, 9 Jun 2018 12:35:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8AA5F6B0298; Sat, 9 Jun 2018 08:35:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 859E86B029A; Sat, 9 Jun 2018 08:35:50 -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 770D56B029B; Sat, 9 Jun 2018 08:35:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f200.google.com (mail-qk0-f200.google.com [209.85.220.200]) by kanga.kvack.org (Postfix) with ESMTP id 4E3986B0298 for ; Sat, 9 Jun 2018 08:35:50 -0400 (EDT) Received: by mail-qk0-f200.google.com with SMTP id u127-v6so15542228qka.9 for ; Sat, 09 Jun 2018 05:35:50 -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=VxsFoOYTsXys8o2lbveXL1eJup8cqpTIEjb6TmjMxcc=; b=EfFsx0ZG1ac6P4tGyFTCLfNgzRab+a5KUgM/LWLsqITTbhZSnR/+crKh7nZTVHrcns qX5y43FylupAOQcbGiR/rjUw7DUfb9YqBbBFejRGP13Jcxu5HOudQ9wmF91cc7aEGl9c 2xta49SVgx4ZBVre1u9JS4sXUg0KUSnlYAg7ZswcZSHHt2fwPNCUbinslKLlBBX2HaNL WCaCIE29577/gJSK/eXchUUNJSY7Kk45DXDA3rO4Ab/X/2OmmEPrKi1OzIt6QI1b0Ps8 kZus4T4e7N9TYzdUWIMEfNlFfsN0/ZkTYoZaCFj7aKU0FATQc4gBjBMa0tNpvCsVMtGq 49kg== 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: APt69E1+rvubRM1U72rSWgUfMi/Tua2pnlP3+rKcevL8k9w8j/oUSoM8 YpV7nXkQh0q7KIIyDJ2L6h+6eMfELIUFVgVOozPB7L9WdlBNMA2wBcoxyl9OMLBg6fssKuMFA8m mkp1ebqLIO0iXeGB54TjJ1XZ7n3dHdFwKTnp673iLyYXl4WqryXxDRBIPWUGf5B4Mew== X-Received: by 2002:ac8:388:: with SMTP id t8-v6mr9413793qtg.194.1528547750138; Sat, 09 Jun 2018 05:35:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIJUC2sdRPu8PciXFMy61oFG0EXao/Fmk1vIHB0ISuOOjHCDrCNcEwsSkam7rQVDZ2wIt0P X-Received: by 2002:ac8:388:: with SMTP id t8-v6mr9413772qtg.194.1528547749486; Sat, 09 Jun 2018 05:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528547749; cv=none; d=google.com; s=arc-20160816; b=tqq+Z/oOWtH+dj4Ity8tA8OC84uuMsCNcVzYTsFzQ5rwYrSQkjk2+lOXZ52V1GYVVs sT7tkndgId4gTsKWfXx+9i8jowBpi9mEL5s8310L8/29FVwxZC+oz4Cbldot7w3eDrCk wuAPFq4WWe7cNFZV14eUQxBo3BA+A9r7pcziMBOdqzsQA8K11NhrQ1b8qU4RXXnIfjnQ n6hKDlqfUrwjLwWUkNhtiLy2QcI4ItB0jt+Nuxd2xI3PtSz+ZZZcFXAFvrw0HvBzczen 5sycGJFaw4QluYM8AOGNbiMmX/g0aif4K/GdLFqudhLIVpQEMEvEWaipKgbmNBZYEoDg tskg== 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=VxsFoOYTsXys8o2lbveXL1eJup8cqpTIEjb6TmjMxcc=; b=quWeNJoYcv+VWwAyFuQ9O71UZukSe7TYLc1Sbdo4bkA/Vw65tO2dz+caYQt0RzN+b1 8nQQo37o/zQ8ZMhidxBnXCQMqDsKixQdos1sxSp3txW4KPHfRCkpEs4HSijtHmoO5uol ExDP8MGinCMb9k/y6ig6G4JS2w4uwwLnR+EYueb9Y0FAcpQxLbnJDvFOLLFD3Kmoxh2C 80fFGyvR7anam5Gzp5YI9VwAyJpZSP3VenLn9enq5rsE02GwY93GxM4l6qE1Mgdl7Ju1 L4E50ghi9AvAOuC0hVLzJgoWl2Rd0iXyJocubfSwWhv1bgm5KwLOX668g0DryCtOmzNm Ks7Q== 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 c85-v6si335091qkj.206.2018.06.09.05.35.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Jun 2018 05:35:49 -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 E0AB54022407; Sat, 9 Jun 2018 12:35:48 +0000 (UTC) Received: from localhost (ovpn-12-40.pek2.redhat.com [10.72.12.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74402422BA; Sat, 9 Jun 2018 12:35:39 +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 , Randy Dunlap , Ming Lei Subject: [PATCH V6 28/30] block: enable multipage bvecs Date: Sat, 9 Jun 2018 20:30:12 +0800 Message-Id: <20180609123014.8861-29-ming.lei@redhat.com> In-Reply-To: <20180609123014.8861-1-ming.lei@redhat.com> References: <20180609123014.8861-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.6]); Sat, 09 Jun 2018 12:35:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sat, 09 Jun 2018 12:35:49 +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 276fc35ec559..284085ab97e7 100644 --- a/block/bio.c +++ b/block/bio.c @@ -870,12 +870,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; }