From: Ming Lei <ming.lei@redhat.com> To: Jens Axboe <axboe@kernel.dk>, Mike Snitzer <snitzer@redhat.com> Cc: linux-block@vger.kernel.org, dm-devel@redhat.com, Ming Lei <ming.lei@redhat.com> Subject: [PATCH 2/3] block: add blk_alloc_disk_srcu Date: Tue, 21 Dec 2021 22:14:58 +0800 [thread overview] Message-ID: <20211221141459.1368176-3-ming.lei@redhat.com> (raw) In-Reply-To: <20211221141459.1368176-1-ming.lei@redhat.com> Add blk_alloc_disk_srcu() so that we can allocate srcu inside request queue for supporting blocking ->queue_rq(). dm-rq needs this API. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- block/genhd.c | 5 +++-- include/linux/genhd.h | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 3c139a1b6f04..d21786fbb7bb 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1333,12 +1333,13 @@ struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id, } EXPORT_SYMBOL(__alloc_disk_node); -struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass) +struct gendisk *__blk_alloc_disk(int node, bool alloc_srcu, + struct lock_class_key *lkclass) { struct request_queue *q; struct gendisk *disk; - q = blk_alloc_queue(node, false); + q = blk_alloc_queue(node, alloc_srcu); if (!q) return NULL; diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 6906a45bc761..20259340b962 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -227,23 +227,27 @@ void blk_drop_partitions(struct gendisk *disk); struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id, struct lock_class_key *lkclass); extern void put_disk(struct gendisk *disk); -struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass); +struct gendisk *__blk_alloc_disk(int node, bool alloc_srcu, + struct lock_class_key *lkclass); /** - * blk_alloc_disk - allocate a gendisk structure + * __alloc_disk - allocate a gendisk structure * @node_id: numa node to allocate on + * @alloc_srcu: allocate srcu instance for supporting blocking ->queue_rq * * Allocate and pre-initialize a gendisk structure for use with BIO based * drivers. * * Context: can sleep */ -#define blk_alloc_disk(node_id) \ +#define __alloc_disk(node_id, alloc_srcu) \ ({ \ static struct lock_class_key __key; \ \ - __blk_alloc_disk(node_id, &__key); \ + __blk_alloc_disk(node_id, alloc_srcu, &__key); \ }) +#define blk_alloc_disk(node_id) __alloc_disk(node_id, false) +#define blk_alloc_disk_srcu(node_id) __alloc_disk(node_id, true) void blk_cleanup_disk(struct gendisk *disk); int __register_blkdev(unsigned int major, const char *name, -- 2.31.1
WARNING: multiple messages have this Message-ID (diff)
From: Ming Lei <ming.lei@redhat.com> To: Jens Axboe <axboe@kernel.dk>, Mike Snitzer <snitzer@redhat.com> Cc: linux-block@vger.kernel.org, dm-devel@redhat.com, Ming Lei <ming.lei@redhat.com> Subject: [dm-devel] [PATCH 2/3] block: add blk_alloc_disk_srcu Date: Tue, 21 Dec 2021 22:14:58 +0800 [thread overview] Message-ID: <20211221141459.1368176-3-ming.lei@redhat.com> (raw) In-Reply-To: <20211221141459.1368176-1-ming.lei@redhat.com> Add blk_alloc_disk_srcu() so that we can allocate srcu inside request queue for supporting blocking ->queue_rq(). dm-rq needs this API. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- block/genhd.c | 5 +++-- include/linux/genhd.h | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 3c139a1b6f04..d21786fbb7bb 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1333,12 +1333,13 @@ struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id, } EXPORT_SYMBOL(__alloc_disk_node); -struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass) +struct gendisk *__blk_alloc_disk(int node, bool alloc_srcu, + struct lock_class_key *lkclass) { struct request_queue *q; struct gendisk *disk; - q = blk_alloc_queue(node, false); + q = blk_alloc_queue(node, alloc_srcu); if (!q) return NULL; diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 6906a45bc761..20259340b962 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -227,23 +227,27 @@ void blk_drop_partitions(struct gendisk *disk); struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id, struct lock_class_key *lkclass); extern void put_disk(struct gendisk *disk); -struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass); +struct gendisk *__blk_alloc_disk(int node, bool alloc_srcu, + struct lock_class_key *lkclass); /** - * blk_alloc_disk - allocate a gendisk structure + * __alloc_disk - allocate a gendisk structure * @node_id: numa node to allocate on + * @alloc_srcu: allocate srcu instance for supporting blocking ->queue_rq * * Allocate and pre-initialize a gendisk structure for use with BIO based * drivers. * * Context: can sleep */ -#define blk_alloc_disk(node_id) \ +#define __alloc_disk(node_id, alloc_srcu) \ ({ \ static struct lock_class_key __key; \ \ - __blk_alloc_disk(node_id, &__key); \ + __blk_alloc_disk(node_id, alloc_srcu, &__key); \ }) +#define blk_alloc_disk(node_id) __alloc_disk(node_id, false) +#define blk_alloc_disk_srcu(node_id) __alloc_disk(node_id, true) void blk_cleanup_disk(struct gendisk *disk); int __register_blkdev(unsigned int major, const char *name, -- 2.31.1 -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2021-12-21 14:16 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-21 14:14 [PATCH 0/3] blk-mq/dm-rq: support BLK_MQ_F_BLOCKING for dm-rq Ming Lei 2021-12-21 14:14 ` [dm-devel] " Ming Lei 2021-12-21 14:14 ` [PATCH 1/3] block: split having srcu from queue blocking Ming Lei 2021-12-21 14:14 ` [dm-devel] " Ming Lei 2022-01-11 18:13 ` Jeff Moyer 2022-01-11 18:13 ` Jeff Moyer 2021-12-21 14:14 ` Ming Lei [this message] 2021-12-21 14:14 ` [dm-devel] [PATCH 2/3] block: add blk_alloc_disk_srcu Ming Lei 2022-01-11 18:13 ` Jeff Moyer 2022-01-11 18:13 ` Jeff Moyer 2021-12-21 14:14 ` [PATCH 3/3] dm: mark dm queue as blocking if any underlying is blocking Ming Lei 2021-12-21 14:14 ` [dm-devel] " Ming Lei 2022-01-06 15:40 ` Mike Snitzer 2022-01-06 15:40 ` [dm-devel] " Mike Snitzer 2022-01-06 15:51 ` Ming Lei 2022-01-06 15:51 ` [dm-devel] " Ming Lei 2022-01-10 19:23 ` Mike Snitzer 2022-01-10 19:23 ` [dm-devel] " Mike Snitzer 2022-01-11 18:14 ` Jeff Moyer 2022-01-11 18:14 ` Jeff Moyer 2021-12-21 16:21 ` [PATCH 0/3] blk-mq/dm-rq: support BLK_MQ_F_BLOCKING for dm-rq Christoph Hellwig 2021-12-21 16:21 ` [dm-devel] " Christoph Hellwig 2021-12-23 4:16 ` Ming Lei 2021-12-23 4:16 ` [dm-devel] " Ming Lei 2021-12-28 21:30 ` Mike Snitzer 2021-12-28 21:30 ` [dm-devel] " Mike Snitzer 2022-01-10 19:26 ` Mike Snitzer 2022-01-10 19:26 ` [dm-devel] " Mike Snitzer 2022-01-11 8:34 ` Christoph Hellwig 2022-01-11 8:34 ` Christoph Hellwig 2022-01-11 16:15 ` Mike Snitzer 2022-01-11 16:15 ` [dm-devel] " Mike Snitzer 2022-01-17 8:08 ` Christoph Hellwig 2022-01-17 8:08 ` Christoph Hellwig 2022-01-11 18:23 ` Jeff Moyer 2022-01-11 18:23 ` Jeff Moyer 2022-01-17 8:10 ` Christoph Hellwig 2022-01-17 8:10 ` Christoph Hellwig 2022-01-19 21:03 ` Mike Snitzer 2022-01-19 21:03 ` [dm-devel] " Mike Snitzer
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=20211221141459.1368176-3-ming.lei@redhat.com \ --to=ming.lei@redhat.com \ --cc=axboe@kernel.dk \ --cc=dm-devel@redhat.com \ --cc=linux-block@vger.kernel.org \ --cc=snitzer@redhat.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: linkBe 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.