From: JeffleXu <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
[email protected]
Subject: Re: [dm-devel] [PATCH RFC 7/7] dm: add support for IO polling
Date: Fri, 8 Jan 2021 11:12:26 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 12/23/20 7:26 PM, Jeffle Xu wrote:
> Enable iopoll when all underlying target devices supports iopoll.
>
> Signed-off-by: Jeffle Xu <[email protected]>
> ---
> drivers/md/dm-table.c | 28 ++++++++++++++++++++++++++++
> drivers/md/dm.c | 1 +
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index 188f41287f18..b0cd5bf58c3c 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -1791,6 +1791,31 @@ static bool dm_table_requires_stable_pages(struct dm_table *t)
> return false;
> }
>
> +static int device_supports_poll(struct dm_target *ti, struct dm_dev *dev,
> + sector_t start, sector_t len, void *data)
> +{
> + struct request_queue *q = bdev_get_queue(dev->bdev);
> +
> + return q && test_bit(QUEUE_FLAG_POLL, &q->queue_flags);
> +}
> +
> +static bool dm_table_supports_poll(struct dm_table *t)
> +{
> + struct dm_target *ti;
> + unsigned int i;
> +
> + /* Ensure that all targets support iopoll. */
> + for (i = 0; i < dm_table_get_num_targets(t); i++) {
> + ti = dm_table_get_target(t, i);
> +
> + if (!ti->type->iterate_devices ||
> + !ti->type->iterate_devices(ti, device_supports_poll, NULL))
> + return false;
> + }
> +
> + return true;
> +}
> +
> void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
> struct queue_limits *limits)
> {
> @@ -1883,6 +1908,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
> #endif
>
> blk_queue_update_readahead(q);
> +
> + if (dm_table_supports_poll(t))
> + blk_queue_flag_set(QUEUE_FLAG_POLL, q);
> }
>
This works in arbitrary bio-based DM stacking. Suppose the following
device stack:
dm0
dm1
nvme0 nvme1
dm 0 will check if dm1 has QUEUE_FLAG_POLL flag set.
> unsigned int dm_table_get_num_targets(struct dm_table *t)
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index 03c2b867acaa..ffd2c5ead256 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -3049,6 +3049,7 @@ static const struct pr_ops dm_pr_ops = {
> };
>
> static const struct block_device_operations dm_blk_dops = {
> + .iopoll = blk_bio_poll,
> .submit_bio = dm_submit_bio,
> .open = dm_blk_open,
> .release = dm_blk_close,
>
--
Thanks,
Jeffle
next prev parent reply other threads:[~2021-01-08 3:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-23 11:26 [PATCH RFC 0/7] dm: add support of iopoll Jeffle Xu
2020-12-23 11:26 ` [PATCH RFC 1/7] block: move definition of blk_qc_t to types.h Jeffle Xu
2021-01-07 19:04 ` Mike Snitzer
2020-12-23 11:26 ` [PATCH RFC 2/7] block: add helper function fetching gendisk from queue Jeffle Xu
2021-01-07 20:31 ` Mike Snitzer
2020-12-23 11:26 ` [PATCH RFC 3/7] block: add iopoll method for non-mq device Jeffle Xu
2021-01-07 21:47 ` Mike Snitzer
2021-01-08 3:24 ` [dm-devel] " JeffleXu
2021-01-08 17:33 ` Mike Snitzer
2021-01-11 7:50 ` [dm-devel] " JeffleXu
2020-12-23 11:26 ` [PATCH RFC 4/7] block: define blk_qc_t as uintptr_t Jeffle Xu
2021-01-07 21:52 ` Mike Snitzer
2020-12-23 11:26 ` [PATCH RFC 5/7] dm: always return BLK_QC_T_NONE for bio-based device Jeffle Xu
2021-01-07 21:54 ` Mike Snitzer
2020-12-23 11:26 ` [PATCH RFC 6/7] block: track cookies of split bios " Jeffle Xu
2021-01-07 22:18 ` Mike Snitzer
2021-01-08 3:08 ` [dm-devel] " JeffleXu
2021-01-08 17:26 ` Mike Snitzer
2021-01-12 5:46 ` [dm-devel] " JeffleXu
2021-01-12 16:13 ` Mike Snitzer
2021-01-14 9:16 ` [dm-devel] " JeffleXu
2021-01-14 14:30 ` Mike Snitzer
2021-01-12 7:11 ` [dm-devel] " JeffleXu
2020-12-23 11:26 ` [PATCH RFC 7/7] dm: add support for IO polling Jeffle Xu
2021-01-08 3:12 ` JeffleXu [this message]
2021-01-07 1:14 ` [dm-devel] [PATCH RFC 0/7] dm: add support of iopoll JeffleXu
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=c052e81f-1ade-dbd2-f5cb-259aca9d5b0f@linux.alibaba.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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