From: Kent Overstreet <kent.overstreet@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Coly Li <colyli@suse.de>,
linux-bcache@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 1/6] block: add a bio_reuse helper
Date: Tue, 12 Jun 2018 02:16:30 -0400 [thread overview]
Message-ID: <20180612061629.GA19281@kmo-pixel> (raw)
In-Reply-To: <20180611194806.13222-2-hch@lst.de>
On Mon, Jun 11, 2018 at 09:48:01PM +0200, Christoph Hellwig wrote:
> This abstracts out a way to reuse a bio without destroying the
> data pointers.
What is the point of this? What "data pointers" does it not destroy?
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/bio.c | 20 ++++++++++++++++++++
> include/linux/bio.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/block/bio.c b/block/bio.c
> index 70c4e1b6dd45..fa1b7ab50784 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -308,6 +308,26 @@ void bio_reset(struct bio *bio)
> }
> EXPORT_SYMBOL(bio_reset);
>
> +/**
> + * bio_reuse - prepare a bio for reuse
> + * @bio: bio to reuse
> + *
> + * Prepares an already setup and possible used bio for reusing it another
> + * time. Compared to bio_reset() this preserves the bio size and the
> + * layout and contents of the bio vectors.
> + */
> +void bio_reuse(struct bio *bio)
> +{
> + unsigned int size = bio->bi_iter.bi_size;
> + unsigned short vcnt = bio->bi_vcnt;
> +
> + bio_reset(bio);
> +
> + bio->bi_iter.bi_size = size;
> + bio->bi_vcnt = vcnt;
> +}
> +EXPORT_SYMBOL_GPL(bio_reuse);
> +
> static struct bio *__bio_chain_endio(struct bio *bio)
> {
> struct bio *parent = bio->bi_private;
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index f08f5fe7bd08..15c871ab50db 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -475,6 +475,7 @@ extern void bio_init(struct bio *bio, struct bio_vec *table,
> unsigned short max_vecs);
> extern void bio_uninit(struct bio *);
> extern void bio_reset(struct bio *);
> +void bio_reuse(struct bio *);
> void bio_chain(struct bio *, struct bio *);
>
> extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
> --
> 2.17.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-06-12 6:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 19:48 [RFC] cleanup bcache bio handling Christoph Hellwig
2018-06-11 19:48 ` [PATCH 1/6] block: add a bio_reuse helper Christoph Hellwig
2018-06-12 6:16 ` Kent Overstreet [this message]
2018-06-13 7:32 ` Christoph Hellwig
2018-06-13 8:54 ` Kent Overstreet
2018-06-13 13:59 ` Christoph Hellwig
2018-06-13 14:49 ` Kent Overstreet
2018-06-11 19:48 ` [PATCH 2/6] bcache: use bio_reuse instead of bio_reinit where applicable Christoph Hellwig
2018-06-11 19:48 ` [PATCH 3/6] bcache: clean up bio reuse for struct moving_io Christoph Hellwig
2018-06-11 19:48 ` [PATCH 4/6] bcache: clean up bio reuse for struct dirty_io Christoph Hellwig
2018-06-11 19:48 ` [PATCH 5/6] bcache: don't clone bio in bch_data_verify Christoph Hellwig
2018-06-11 19:48 ` [PATCH 6/6] bcache: use bio_add_page instead of open coded bio manipulation Christoph Hellwig
2018-06-12 4:40 ` [RFC] cleanup bcache bio handling Coly Li
2018-06-13 9:58 ` Kent Overstreet
2018-06-13 11:06 ` Ming Lei
2018-06-13 13:56 ` Christoph Hellwig
2018-06-13 14:54 ` Kent Overstreet
2018-06-14 1:55 ` Ming Lei
2018-06-14 7:20 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2018-06-13 13:51 [RFC] cleanup bcache bio handling v2 Christoph Hellwig
2018-06-13 13:51 ` [PATCH 1/6] block: add a bio_reuse helper Christoph Hellwig
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=20180612061629.GA19281@kmo-pixel \
--to=kent.overstreet@gmail.com \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--cc=hch@lst.de \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
/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.