Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8601581imu; Thu, 15 Nov 2018 14:20:58 -0800 (PST) X-Google-Smtp-Source: AJdET5erTLpuidAn4tgOz4myo2HAogNBbD/5H1iTH7GIMCVX85O154Jgj6p/cMlEVIxBvkBacMuz X-Received: by 2002:a63:ff16:: with SMTP id k22mr7582463pgi.244.1542320458496; Thu, 15 Nov 2018 14:20:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542320458; cv=none; d=google.com; s=arc-20160816; b=u2l8qBO+Z+L1C4rD6/25ZNAbO8B/QCZmndGWpP5bsn/nIbGDwfwbBAPTFykNJPz3ZZ fP/EEbE9XuKhZv6t/d/eIxK0UPw26NONUAW8aKWrI14fjADHS9g1uOxc6EaPzsquINeB 3HmnPdZs/XQ0FLTE5ZChvc+t/1VaVp5eHnW68Q8quBI8gcsk/h3ofPURpp5zMrBJ4nti voWO9TM2g0Msi+/CuJiRl79410oS4hak0ES0K6aZ049PwpQTej2aaThVL+yfoj3Gjdy+ ojkNAqjYgTMYt690mLN5E78zl7ciLcx5TqpydJxkJQ7sc2nt3L3J/RACrYgPfvmMKA66 fxqA== 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:dkim-signature; bh=eiPUQDMcyLe1qryFS+h85cw5yfttl+lBQ3gum2+5lr8=; b=GOD/Lr54dVRSI6QseYHHPqegorvIf21HJ2EnPgMO9zsK0hNcA8XNenhnppqr/izCZ5 Tc7ptbs0SARmtJSKzBRW4VXiPmVCfkufa/KFx2WcHCefs3deu0p0NIrwtHj7Qx/iA3CM 7du+urVJS5Y6j+HInh41bu/usbnIJNU33TfLsfH4wSjdge4KWQOtc5UK0b1E23AWdpL3 DPQOPCNy8lwrB3xz2Z9JF8CLCJt7bFsgzuIuezNZzQI/QMfyL1OoDAbA6u2Tu31J+Hnh BMpH//zYDJ2N/up/c1jxXcLIXokco5x4CxEnyY1c/t8G8QoUBusTWsnTFvgoo+QlEhum sH2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=IcBGrQSb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a91-v6si30151628pld.375.2018.11.15.14.20.44; Thu, 15 Nov 2018 14:20:58 -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; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=IcBGrQSb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726301AbeKPI2b (ORCPT + 99 others); Fri, 16 Nov 2018 03:28:31 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42628 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbeKPI2a (ORCPT ); Fri, 16 Nov 2018 03:28:30 -0500 Received: by mail-pl1-f194.google.com with SMTP id x21-v6so7403995pln.9 for ; Thu, 15 Nov 2018 14:18:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eiPUQDMcyLe1qryFS+h85cw5yfttl+lBQ3gum2+5lr8=; b=IcBGrQSbjZ9YgNwf/yIoRrh4U4kL4OAJ4bNfD0+z85sAsv1FBg0U0VIae+SOJL73gR m5iGIxNqBW3HbSYVz/575grywjRaIQ+RGxjIytA4AIFeJekWG/JDFpWafzQKa0GnzSWA t+WVZwoKjqt6U6KD32Wgy/c3yRwy5x7Jht3JYW1xNLqHB5kyNatXUkNL5XWDvyce9sek 72tN+JR7NdX/G5Sj7fXiC6ymfTWk28YPdL6hek7mirykIAXKa+8mwqTq4hRw7cO/5eyO bCzB2Yvk1uvS4sPUt1qoxfFM34TxVP3nUuhcYz7CyJLxKBHmIztLAsa5sJvC8xgd6+7C 8Gew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eiPUQDMcyLe1qryFS+h85cw5yfttl+lBQ3gum2+5lr8=; b=g6773IlF1MqQ3F5klE2MM4yowONxGu3DuZ8Niu3MqvROQFCYGfqCY5dhPWGurfGrSw 2nRfXFvabNXuPM9S9iClySSSnYaGygpoU49Kk1EWxZ7Zogj+iqvk7YbdojIh0oFJOYyx VCd5aNG6djkPybF80lacytT3TOuFOWVk2bM3TFoskcRA649aOANwrVjY2eWJH9cWt0nP XIEXK7Inv7wGQV4gyMTfJFlmpcEr+JDfIKvmH7KJ4kXtn8pYtXWB4A4mkt3avNLdrjga sll15+DYIUTIQGN4OQZUhVOfIaniDMvanjczqHpdun3Kma++cAsHK6IjYSvs5P+cf1kU NsTg== X-Gm-Message-State: AGRZ1gLkE0vD+jii4iPPN3+JouPEI08kRovepwstvd/HY0DqrNh/aPaf W4PJHKOluYMyBnPbH+nGRJkHMg== X-Received: by 2002:a17:902:3103:: with SMTP id w3-v6mr8286210plb.18.1542320330206; Thu, 15 Nov 2018 14:18:50 -0800 (PST) Received: from vader ([64.114.255.97]) by smtp.gmail.com with ESMTPSA id m12-v6sm34829559pff.173.2018.11.15.14.18.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 14:18:49 -0800 (PST) Date: Thu, 15 Nov 2018 14:18:47 -0800 From: Omar Sandoval To: Mike Snitzer Cc: Ming Lei , Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Dave Chinner , Kent Overstreet , 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 , Christoph Hellwig , 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 03/19] block: use bio_for_each_bvec() to compute multi-page bvec count Message-ID: <20181115221847.GD9348@vader> References: <20181115085306.9910-1-ming.lei@redhat.com> <20181115085306.9910-4-ming.lei@redhat.com> <20181115202028.GC9348@vader> <20181115210510.GA24908@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181115210510.GA24908@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 15, 2018 at 04:05:10PM -0500, Mike Snitzer wrote: > On Thu, Nov 15 2018 at 3:20pm -0500, > Omar Sandoval wrote: > > > On Thu, Nov 15, 2018 at 04:52:50PM +0800, Ming Lei wrote: > > > First it is more efficient to use bio_for_each_bvec() in both > > > blk_bio_segment_split() and __blk_recalc_rq_segments() to compute how > > > many multi-page bvecs there are in the bio. > > > > > > Secondly once bio_for_each_bvec() is used, the bvec may need to be > > > splitted because its length can be very longer than max segment size, > > > so we have to split the big bvec into several segments. > > > > > > Thirdly when splitting multi-page bvec into segments, the max segment > > > limit may be reached, so the bio split need to be considered under > > > this situation too. > > > > > > Cc: Dave Chinner > > > Cc: Kent Overstreet > > > Cc: Mike Snitzer > > > Cc: dm-devel@redhat.com > > > Cc: Alexander Viro > > > Cc: linux-fsdevel@vger.kernel.org > > > Cc: Shaohua Li > > > Cc: linux-raid@vger.kernel.org > > > Cc: linux-erofs@lists.ozlabs.org > > > Cc: David Sterba > > > Cc: linux-btrfs@vger.kernel.org > > > Cc: Darrick J. Wong > > > Cc: linux-xfs@vger.kernel.org > > > Cc: Gao Xiang > > > Cc: Christoph Hellwig > > > Cc: Theodore Ts'o > > > Cc: linux-ext4@vger.kernel.org > > > Cc: Coly Li > > > Cc: linux-bcache@vger.kernel.org > > > Cc: Boaz Harrosh > > > Cc: Bob Peterson > > > Cc: cluster-devel@redhat.com > > > Signed-off-by: Ming Lei > > > --- > > > block/blk-merge.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++--------- > > > 1 file changed, 76 insertions(+), 14 deletions(-) > > > > > > diff --git a/block/blk-merge.c b/block/blk-merge.c > > > index 91b2af332a84..6f7deb94a23f 100644 > > > --- a/block/blk-merge.c > > > +++ b/block/blk-merge.c > > > @@ -160,6 +160,62 @@ static inline unsigned get_max_io_size(struct request_queue *q, > > > return sectors; > > > } > > > > > > +/* > > > + * Split the bvec @bv into segments, and update all kinds of > > > + * variables. > > > + */ > > > +static bool bvec_split_segs(struct request_queue *q, struct bio_vec *bv, > > > + unsigned *nsegs, unsigned *last_seg_size, > > > + unsigned *front_seg_size, unsigned *sectors) > > > +{ > > > + bool need_split = false; > > > + unsigned len = bv->bv_len; > > > + unsigned total_len = 0; > > > + unsigned new_nsegs = 0, seg_size = 0; > > > > "unsigned int" here and everywhere else. > > Curious why? I've wondered what govens use of "unsigned" vs "unsigned > int" recently and haven't found _the_ reason to pick one over the other. My only reason to prefer unsigned int is consistency. unsigned int is much more common in the kernel: $ ag --cc -s 'unsigned\s+int' | wc -l 129632 $ ag --cc -s 'unsigned\s+(?!char|short|int|long)' | wc -l 22435 checkpatch also warns on plain unsigned.