Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6311514imm; Wed, 27 Jun 2018 05:52:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfY01m2f4BdGjkyEQYQzQ/fnEYA2KbWZxzUPlezqV9clrrRoxqbLqcxtT4cOwMd+BwmCvQl X-Received: by 2002:a62:d693:: with SMTP id a19-v6mr1168732pfl.248.1530103936578; Wed, 27 Jun 2018 05:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530103936; cv=none; d=google.com; s=arc-20160816; b=wZ22rfmoZx/b8OWexDoubNRWiqIMUk6AIyOt37Z67V9tZdm551S+/e+wXMPIaEfnIP 5UcfBXP4ldlSWCy6FFyL6/zKn1WXciWoGl755iTlXexnDVgOlPG18p3npPMOv/CceZoz 1pSdYcwMxMOo1jBPhdJsZyGMLWj549lQm6h0TOBy/e/DsNF5/CZxHf4cTxLvCs1p6Eh8 xEuqDTUavfne0b+2O1PqECgqlJyr8P4jIx+bSjwHvdIjdSwNkdl8GTn+FFGPOL65Vgbr DYj7hmNkngo3wvCVeletDFLBytOiPdiwXSEZO78UNXrrwNNtOfg69xwjZPx+TsZDSuQ+ c9lw== 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:arc-authentication-results; bh=sl1T2g2EwRCyJbh3geKgy5pIZaule4/WNWjulowZ7dw=; b=Ret9oeRczM8TPBcvQs7iHvbst9nCKk5amxrVBEyvwm7J8LcOI0kecG1Jh/hU6vZne0 jgHKW7t3ZvIz0u7P4DXL5LCU+WIDJtz1hvjYFqlD5zgGBmmme5JJc2aHuCrWXDWzd0/9 um7MATc3kSizdQ6TXXJJeAYMYHov95Gm85KIBWU5Agb/3c6SFjr2eQyDcdp4SMd6H2OP mjZ5uZ9ha55zNADxCoq8z3HqrAOeggwLhH3UBJGjjdvec/zcuV0jdTZHKt5eanSxVGuH mJZuea0+agFFWBypr/OYZreH7VRHtLfu/6lhKTp5hfVrWuGNzuYzFBXzm2upK4Xz8lNd Ix4Q== 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 u20-v6si3435856pga.279.2018.06.27.05.52.02; Wed, 27 Jun 2018 05:52:16 -0700 (PDT) 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 S965277AbeF0Mu3 (ORCPT + 99 others); Wed, 27 Jun 2018 08:50:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39362 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933051AbeF0Mu1 (ORCPT ); Wed, 27 Jun 2018 08:50:27 -0400 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:'' 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 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; } -- 2.9.5