From: Jens Axboe <axboe@kernel.dk>
To: linux-block@vger.kernel.org
Cc: snitzer@redhat.com, kent.overstreet@gmail.com, liwang@redhat.com,
vrbagal1@linux.vnet.ibm.com, chuhu.ncepu@gmail.com,
Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 1/2] block: add bioset_init_from_src() helper
Date: Thu, 7 Jun 2018 14:45:40 -0600 [thread overview]
Message-ID: <20180607204541.13491-2-axboe@kernel.dk> (raw)
In-Reply-To: <20180607204541.13491-1-axboe@kernel.dk>
Add a helper that allows a caller to initialize a new bio_set,
using the settings from an existing bio_set.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
block/bio.c | 18 ++++++++++++++++++
include/linux/bio.h | 1 +
2 files changed, 19 insertions(+)
diff --git a/block/bio.c b/block/bio.c
index 595663e0281a..bf516d873ce9 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1967,6 +1967,24 @@ int bioset_init(struct bio_set *bs,
}
EXPORT_SYMBOL(bioset_init);
+/*
+ * Initialize and setup a new bio_set, based on the settings from
+ * another bio_set.
+ */
+int bioset_init_from_src(struct bio_set *bs, struct bio_set *src)
+{
+ int flags;
+
+ flags = 0;
+ if (src->bvec_pool.min_nr)
+ flags |= BIOSET_NEED_BVECS;
+ if (src->rescue_workqueue)
+ flags |= BIOSET_NEED_RESCUER;
+
+ return bioset_init(bs, src->bio_pool.min_nr, src->front_pad, flags);
+}
+EXPORT_SYMBOL(bioset_init_from_src);
+
#ifdef CONFIG_BLK_CGROUP
/**
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 810a8bee8f85..84abd1706dcb 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -417,6 +417,7 @@ enum {
extern int bioset_init(struct bio_set *, unsigned int, unsigned int, int flags);
extern void bioset_exit(struct bio_set *);
extern int biovec_init_pool(mempool_t *pool, int pool_entries);
+extern int bioset_init_from_src(struct bio_set *bs, struct bio_set *src);
extern struct bio *bio_alloc_bioset(gfp_t, unsigned int, struct bio_set *);
extern void bio_put(struct bio *);
--
2.17.1
next prev parent reply other threads:[~2018-06-07 20:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 20:45 [PATCH 0/2] Fix bio_set copy Jens Axboe
2018-06-07 20:45 ` Jens Axboe [this message]
2018-06-07 20:45 ` [PATCH 2/2] dm: use bioset_init_from_src() to copy bio_set Jens Axboe
2018-06-08 6:12 ` [PATCH 0/2] Fix bio_set copy Li Wang
2018-06-08 9:33 ` vrbagal1
2018-06-08 13:13 ` Jens Axboe
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=20180607204541.13491-2-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=chuhu.ncepu@gmail.com \
--cc=kent.overstreet@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=liwang@redhat.com \
--cc=snitzer@redhat.com \
--cc=vrbagal1@linux.vnet.ibm.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.