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:37:00 +0800 [thread overview]
Message-ID: <CACVXFVOZxK7jGUmMH1Q_djE7O=cK1v40O4XQJs4i7TGErJe8Qw@mail.gmail.com> (raw)
In-Reply-To: <20190407065205.GA8799@lst.de>
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.
>
> > diff --git a/include/linux/bvec.h b/include/linux/bvec.h
> > index f6275c4da13a..6e4996dfc847 100644
> > --- a/include/linux/bvec.h
> > +++ b/include/linux/bvec.h
> > @@ -48,7 +48,7 @@ struct bvec_iter {
> > struct bvec_iter_all {
> > struct bio_vec bv;
> > int idx;
> > - unsigned done;
> > + unsigned bv_done;
>
> Why the rename here?
'done' may be a bit misleading given we know this field is for recording how
many bytes we have done on the current bvec. Or .bvec_done?
>
> > +static inline void mp_bvec_advance(const struct bio_vec *bvec,
> > + struct bvec_iter_all *iter_all)
>
> If we rename this we should probably drop the mp_ prefix..
OK.
>
> Also not for this patch, but we should really consider moving this
> function out of line given how big it is.
It is fine for me, but I think they shouldn't belong to this fix.
Thanks,
Ming Lei
next prev parent reply other threads:[~2019-04-07 7:37 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 [this message]
2019-04-07 7:38 ` Christoph Hellwig
2019-04-07 7:54 ` Ming Lei
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='CACVXFVOZxK7jGUmMH1Q_djE7O=cK1v40O4XQJs4i7TGErJe8Qw@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).