This patch add a poll queue check, aims to help users to use poll tolls accurately. If users do polled IO but device doesn't have poll queues, they will get wrong perfromance data and waste CPU resources. So here adding a poll queue check, if users do this misconfiguration, it will return users that device does not support this operation, to help users adjust their configuration promptly. -- changes from v2: - move check into block layer - return -EOPNOTSUPP instead of print a warning in io_uring v2: https://lore.kernel.org/io-uring/20240711082430.609597-1-xue01.he@xxxxxxxxxxx/T/#u changes from v1: - without disrupting the original I/O process. - move judgement from block to io_uring. v1: https://lore.kernel.org/linux-block/ZlrQCaR6xEaghWdQ@xxxxxxxxxxxxx/T/#t Signed-off-by: hexue <xue01.he@xxxxxxxxxxx> --- block/blk-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 82c3ae22d76d..9788808bd488 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -791,8 +791,11 @@ void submit_bio_noacct(struct bio *bio) } } - if (!test_bit(QUEUE_FLAG_POLL, &q->queue_flags)) + if (!test_bit(QUEUE_FLAG_POLL, &q->queue_flags) && + (bio->bi_opf & REQ_POLLED)) { bio_clear_polled(bio); + goto not_supported; + } switch (bio_op(bio)) { case REQ_OP_READ: -- 2.40.1