Skip to content

Commit 73e59d3

Browse files
xue01-heaxboe
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 8a47e33 commit 73e59d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

block/blk-core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,11 @@ void submit_bio_noacct(struct bio *bio)
791791
}
792792
}
793793

794-
if (!(q->limits.features & BLK_FEAT_POLL))
794+
if (!(q->limits.features & BLK_FEAT_POLL) &&
795+
(bio->bi_opf & REQ_POLLED)) {
795796
bio_clear_polled(bio);
797+
goto not_supported;
798+
}
796799

797800
switch (bio_op(bio)) {
798801
case REQ_OP_READ:

0 commit comments

Comments
 (0)