All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>,
	linux-block <linux-block@vger.kernel.org>,
	Qu Wenruo <quwenruo.btrfs@gmx.com>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	Omar Sandoval <osandov@fb.com>
Subject: Re: [PATCH] block: don't use for-inside-for in bio_for_each_segment_all
Date: Sun, 7 Apr 2019 15:54:16 +0800	[thread overview]
Message-ID: <CACVXFVO9EAFtnspU0H4BNr4UCTry3q6icuHcXDB=c6Ura6BtMw@mail.gmail.com> (raw)
In-Reply-To: <CACVXFVOZxK7jGUmMH1Q_djE7O=cK1v40O4XQJs4i7TGErJe8Qw@mail.gmail.com>

On Sun, Apr 7, 2019 at 3:37 PM Ming Lei <tom.leiming@gmail.com> wrote:
>
> On Sun, Apr 7, 2019 at 2:53 PM Christoph Hellwig <hch@lst.de> wrote:
> >
> > The change itself looks fine to be, but a few comments on semingly
> > unrelated changes:
> >
> > > +#define bio_for_each_segment_all(bvl, bio, i, iter_all)                      \
> > > +     for (i = 0, bvl = bvec_init_iter_all(&iter_all);                \
> > > +             iter_all.idx < (bio)->bi_vcnt &&                        \
> > > +             (mp_bvec_advance(&((bio)->bi_io_vec[iter_all.idx]),     \
> > > +                              &iter_all), 1); i++)
> >
> > Instead of the complicated expression inside the for loop test
> > expression can't we move the index check into mp_bvec_advance and let
> > it return a bool?
>
> OK, will move index check into mp_bvec_advance.

oops, I recall the above line, because:

1) the index check expression is quite straight-forward

2) it has been in my todo list to re-use bvec_advance() to re-write
iterate_bvec()
given bvec_advance() is much light-weight than for_each_bvec(). If we
move the index check into bvec_advance(), the helper has to be moved
to bio.h, then we can't use that for iterate_bvec().

thanks,
Ming Lei

  parent reply	other threads:[~2019-04-07  7:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-06 21:54 [PATCH] block: don't use for-inside-for in bio_for_each_segment_all Ming Lei
2019-04-07  6:52 ` Christoph Hellwig
2019-04-07  7:37   ` Ming Lei
2019-04-07  7:38     ` Christoph Hellwig
2019-04-07  7:54     ` Ming Lei [this message]
2019-04-07  7:58       ` Christoph Hellwig
2019-04-07  8:13         ` Ming Lei
2019-04-08  6:07   ` Hannes Reinecke
2019-04-08 14:12     ` Matthew Wilcox
2019-04-09  9:48       ` Christoph Hellwig
2019-04-09 10:25         ` Johannes Thumshirn
2019-04-09 11:38         ` Matthew Wilcox
2019-04-09 15:36           ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACVXFVO9EAFtnspU0H4BNr4UCTry3q6icuHcXDB=c6Ura6BtMw@mail.gmail.com' \
    --to=tom.leiming@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=osandov@fb.com \
    --cc=quwenruo.btrfs@gmx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.