Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8375824imu; Thu, 15 Nov 2018 10:30:28 -0800 (PST) X-Google-Smtp-Source: AJdET5caYH40Af/ABE5Is0SFQdIPPwA5yfW5oLddfoQoSrqs2ABqScWchfrXEB0XEjDfB1bU9Bj8 X-Received: by 2002:a63:194f:: with SMTP id 15mr6910703pgz.192.1542306628338; Thu, 15 Nov 2018 10:30:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542306628; cv=none; d=google.com; s=arc-20160816; b=gY0gitfwcgspu+00gZkJXnWDPDn2FHWGi3V8Lnj8oe2Kjrk9yp7A7bsti84JB4Bmw8 ygqf98EYqirdfJKAXUEMgq5qGsyykee3vE0ClLb1Kl7KnPbmWquAQ1sf0iTgib6p8EG3 rRTjOysdYaEYwH763VwPF+MWJnHLzM0TqraCltCML6P/oIFtPXJcKozYOUs0ghBVt3+n SHaQtWNZ5pA8hUf2xed2xgKyOLBnjFtrFblNQHTavIsAgE9ZQyVbIAzg/1thZh8hm/PN ApWkWsAbjDorS3mzy+EZogJUakh380YM8/T7fvIc8i6+bI+ecTWcdioO9pxCx/MOd6pC 2kEA== 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=cKqxCmj+g8wylWj4eAfctUKW1L6Qx1DV5mBadTwoHi0=; b=rOWq5e1GRxHcF8ELOagMcMLDurE8yY2uZQKpiSZWGBqhmTt8/CgxRZ3afkJPRjPxrN xV4FInKRFQ91g58ZrL0SO9BjggDcj4arGxIYRX6B5iOczopAy47V13qLnARbOUMvo11L cj3CdNfHqD2E4Tx+u6lIwjaS7K6knCqx898z7OobLkRuj+BJweoZYVqO1PWx070kUXlI J8clLwPaxghKxh45IAc8p9+ahlzmHTxyOwKNskPgkvH9VNfFrKMMkuXYpW8P32xeeZCf BZv5j3KJA+PiqMitG9aSJCtuuwZTFBcjom4h/RD2xttMEd6qjuuFtS27XuOobVOiRhjY Hs0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=aYeBtxCK; 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 a5-v6si24534441plh.157.2018.11.15.10.30.10; Thu, 15 Nov 2018 10:30:28 -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=aYeBtxCK; 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 S2388898AbeKPEhv (ORCPT + 99 others); Thu, 15 Nov 2018 23:37:51 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38175 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388821AbeKPEhu (ORCPT ); Thu, 15 Nov 2018 23:37:50 -0500 Received: by mail-pf1-f196.google.com with SMTP id q1so2096597pfi.5 for ; Thu, 15 Nov 2018 10:28:56 -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=cKqxCmj+g8wylWj4eAfctUKW1L6Qx1DV5mBadTwoHi0=; b=aYeBtxCKN4fkLNjtgzi/IbgY/RCrYdQBDjus/pC7t2KKIOWW41bLlF0BI3wKNkM6MV XipZqHXMqDKk1Z2fjnHTdMlF78IHpC05xrExzrwEnR044plj42lc60XwAYtybmSMLbXd QU7qyfv8LoQ7Xl0Mdriw1X36qDSz0ir0+R3AfuTOhkQXGe43pSVGXn6LkHZ/SMTwbn8I kkShBdyZ5HroecyXfNNxRrjiyWqSsew3pII+uQ9ToybQq6bzpyWQCNc3PGYVprSXPIxy LPb8+ar3qE9hO8eQ18F8kWROsZ3+jbd1MxdOUkMib1xTGn4X3uFLEemxqbvSKec5wxfS AK1Q== 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=cKqxCmj+g8wylWj4eAfctUKW1L6Qx1DV5mBadTwoHi0=; b=QYYuTEa1gpDJw3rEf0yMwSrQdP5o8lBz9SAdUGECs5zUwg5U9CjMXoUsMdNqkbeLQX yt7rdWeeerhohg3Wu50DALQXMJcyhoE8Ou3IP5G004R73Q1L8R2dX9kUwfuz+uvZR0hc VLXUyCvJTY1Ink5hI5gg7n5OfrcixZ5TlWai8PN4nldbeCXA4mnUM7PSlnSwtj9l+CZI ZtbKD0Mqto6vKuPXaYOsLI0lFNJlgUQQ0aD4jXEVqJST+mBlNfo+Gymb8fbS6GUEMAZy M+8xvN2utDnDhOrEIfX+DGD6JcWngunvvGvEhBxqrp5/b0CxCV9qke72peaSV2fmi6xa 9E2w== X-Gm-Message-State: AGRZ1gLcKi6xwJGu01aaffUoIMdrxNshsBfOeSEFLh/KEaVubdLJVaKH XdDV5D0Xuvl1g10kgbFNHE1bVA== X-Received: by 2002:a63:790e:: with SMTP id u14mr6781823pgc.452.1542306535815; Thu, 15 Nov 2018 10:28:55 -0800 (PST) Received: from vader ([64.114.255.97]) by smtp.gmail.com with ESMTPSA id f6-v6sm35792916pfg.128.2018.11.15.10.28.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 10:28:55 -0800 (PST) Date: Thu, 15 Nov 2018 10:28:54 -0800 From: Omar Sandoval To: Ming Lei 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 , 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 02/19] block: introduce bio_for_each_bvec() Message-ID: <20181115182854.GB9348@vader> References: <20181115085306.9910-1-ming.lei@redhat.com> <20181115085306.9910-3-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181115085306.9910-3-ming.lei@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:52:49PM +0800, Ming Lei wrote: > This helper is used for iterating over multi-page bvec for bio > split & merge code. > > 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 Reviewed-by: Omar Sandoval One comment below. > Signed-off-by: Ming Lei > --- > include/linux/bio.h | 34 +++++++++++++++++++++++++++++++--- > include/linux/bvec.h | 36 ++++++++++++++++++++++++++++++++---- > 2 files changed, 63 insertions(+), 7 deletions(-) > > diff --git a/include/linux/bio.h b/include/linux/bio.h > index 056fb627edb3..1f0dcf109841 100644 > --- a/include/linux/bio.h > +++ b/include/linux/bio.h > @@ -76,6 +76,9 @@ > #define bio_data_dir(bio) \ > (op_is_write(bio_op(bio)) ? WRITE : READ) > > +#define bio_iter_mp_iovec(bio, iter) \ > + mp_bvec_iter_bvec((bio)->bi_io_vec, (iter)) > + > /* > * Check whether this bio carries any data or not. A NULL bio is allowed. > */ > @@ -135,18 +138,33 @@ static inline bool bio_full(struct bio *bio) > #define bio_for_each_segment_all(bvl, bio, i) \ > for (i = 0, bvl = (bio)->bi_io_vec; i < (bio)->bi_vcnt; i++, bvl++) > > -static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter, > - unsigned bytes) > +static inline void __bio_advance_iter(struct bio *bio, struct bvec_iter *iter, > + unsigned bytes, bool mp) > { > iter->bi_sector += bytes >> 9; > > if (bio_no_advance_iter(bio)) > iter->bi_size -= bytes; > else > - bvec_iter_advance(bio->bi_io_vec, iter, bytes); > + if (!mp) > + bvec_iter_advance(bio->bi_io_vec, iter, bytes); > + else > + mp_bvec_iter_advance(bio->bi_io_vec, iter, bytes); if (!foo) {} else {} hurts my brain, please do if (mp) mp_bvec_iter_advance(bio->bi_io_vec, iter, bytes); else bvec_iter_advance(bio->bi_io_vec, iter, bytes);