summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorhexue <xue01.he@samsung.com>2024-07-18 15:08:17 +0800
committerJens Axboe <axboe@kernel.dk>2024-07-19 09:35:35 -0600
commit73e59d3eeca4feaf0814a077df8ec5edc53ccf77 (patch)
tree9f22094233f67b0c7029f58882c9ebdb4d4bc5fc /block
parent8a47e33f50dd779f94bc277c6d3de81672463c5e (diff)
block: avoid polling configuration errors
This patch adds a poll queue check, aiming to help users use polled IO accurately. If users do polled IO but the device doesn't have poll queues, they will get suboptimal performance data and waste CPU resources. Add a poll queue check batching this. If users don't have the device properly configured, or if it simply doesn't support polled IO, it will error the IO with -EOPNOTSUPP. This is similar to what we used to do for sync polled IO, which is no longer supported. Signed-off-by: hexue <xue01.he@samsung.com> Link: https://lore.kernel.org/r/20240718070817.1031494-1-xue01.he@samsung.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 02bceeb36f2c..1217c2cd66dd 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -791,8 +791,11 @@ void submit_bio_noacct(struct bio *bio)
}
}
- if (!(q->limits.features & BLK_FEAT_POLL))
+ if (!(q->limits.features & BLK_FEAT_POLL) &&
+ (bio->bi_opf & REQ_POLLED)) {
bio_clear_polled(bio);
+ goto not_supported;
+ }
switch (bio_op(bio)) {
case REQ_OP_READ: