Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2482494imu; Mon, 19 Nov 2018 01:01:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/V75cJ1vXGaDn7S7fFo3XKz+CHfGE6Bfbtcl7E9qnsnMuOcUW4l5M1mof25/VuT8OnloQv6 X-Received: by 2002:a17:902:4827:: with SMTP id s36mr2438640pld.168.1542618101186; Mon, 19 Nov 2018 01:01:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542618101; cv=none; d=google.com; s=arc-20160816; b=yaBw9BGWaBzcR9wNFwFbsIzJfwPsSyDFQF0Hy1Sa7i51jxLxpd5Z0TSxkOrYLYgHYE UtxdFrLzZFuhlf/xUWgbasKyPPyTV1ml48gTUq9RPvlhJa4geg+xWR1tuGlW7GUH3Kkn Dv5e72X6y51IEo6MNphT/eBVa3VR8ze+8rpwqBjogu88aOB4mUq8bF5foA5CvH8P3P/0 J8onLX4eKNfKY1ChvCbAW2MSb3ORhfi+1ZKqOVUvBaqyJ2Z/puxwI4c5DVwY2Gakb4A+ M7e+gAIOFP61L45svbcLbUiy/kni2dbgx9mAzEFUJQrq9YV1rz2Z0yHl38kCYStzUIlO EbgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NNMLdWTR7tP/EeDOHM9+aFtHGb8LiU/xe9JP+7HppDo=; b=eWiKapxTbZ/p+H1XrXnpGZPqriuaMhwRiXateqP2gTB1sOtLmd+IiG19eJegi51e0L bY4zfKjSudir4taGtBkIjMumB5g8yhtJRPTKje0uhq2Js1Wn4HDHET6QBtRtWkA3lrZM nkkDQixtVdxTTNQYw+keQeyDVGnu0plEGihFjV1Grfaqv+7OmO+bR7Zo0LB/DXCXJ2az lmVQfy1hXIWb4N73W3XPmET9yr3G8Ld1m+SlwoNwW89nfquHfUkQY9wyDhoN+9RFD4QB soGpjHFfS1DzjOOTCyspf15k21PygOrpwhVQ4KzmqPH6aMG9bKDCi82ukSXA2FM1NtYC p14g== 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 y10si11758033pgp.348.2018.11.19.01.01.26; Mon, 19 Nov 2018 01:01:41 -0800 (PST) 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 S1727247AbeKSTXu (ORCPT + 99 others); Mon, 19 Nov 2018 14:23:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52116 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbeKSTXu (ORCPT ); Mon, 19 Nov 2018 14:23:50 -0500 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 5008A30832D0; Mon, 19 Nov 2018 09:00:50 +0000 (UTC) Received: from ming.t460p (ovpn-8-26.pek2.redhat.com [10.72.8.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7722A5C223; Mon, 19 Nov 2018 09:00:26 +0000 (UTC) Date: Mon, 19 Nov 2018 17:00:22 +0800 From: Ming Lei To: Christoph Hellwig Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, 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 , Theodore Ts'o , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: Re: [PATCH V10 14/19] block: enable multipage bvecs Message-ID: <20181119090021.GL16736@ming.t460p> References: <20181115085306.9910-1-ming.lei@redhat.com> <20181115085306.9910-15-ming.lei@redhat.com> <20181116135308.GK3165@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181116135308.GK3165@lst.de> User-Agent: Mutt/1.9.1 (2017-09-22) 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]); Mon, 19 Nov 2018 09:00:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 16, 2018 at 02:53:08PM +0100, Christoph Hellwig wrote: > > - > > - 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) > > How could the page struct be the same, but the range beyond PAGE_SIZE > (at least with the existing callers)? > > Also no need for the inner btraces, and the && always goes on the > first line. OK. > > > + 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; > > Ok, this is scary, as it will give differen results depending on when > bi_disk is assigned. It is just merge or not, both can be handled well now. > But then again we shouldn't really do the cluster > check here, but rather when splitting the bio for the actual low-level > driver. Yeah, I thought of this way too, but it may cause tons of bio split for no-clustering, and there are quite a few scsi devices which require to disable clustering. [linux]$ git grep -n DISABLE_CLUSTERING ./drivers/scsi/ | wc -l 28 Or we may introduce bio_split_to_single_page_bvec() to allocate & convert to single-page bvec table for non-clustering, will try this approach in next version. > > (and eventually we should kill this clustering setting off in favor > of our normal segment limits). Yeah, it has been in my post-multi-page todo list already, :-) thanks, Ming