* [PATCH] block: replace blk_queue_nowait with bdev_nowait
@ 2022-09-27 7:58 Christoph Hellwig
2022-09-27 15:33 ` Pankaj Raghav
2022-09-27 15:59 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-09-27 7:58 UTC (permalink / raw)
To: axboe; +Cc: linux-block
Replace blk_queue_nowait with a bdev_nowait helpers that takes the
block_device given that the I/O submission path should not have to
look into the request_queue.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-core.c | 2 +-
drivers/md/dm-table.c | 4 +---
drivers/md/md.c | 4 ++--
include/linux/blkdev.h | 6 +++++-
io_uring/io_uring.c | 2 +-
5 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 052444c9b5948..dc1fa454ae301 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -713,7 +713,7 @@ void submit_bio_noacct(struct bio *bio)
* For a REQ_NOWAIT based request, return -EOPNOTSUPP
* if queue does not support NOWAIT.
*/
- if ((bio->bi_opf & REQ_NOWAIT) && !blk_queue_nowait(q))
+ if ((bio->bi_opf & REQ_NOWAIT) && !bdev_nowait(bdev))
goto not_supported;
if (should_fail_bio(bio))
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 332f96b582529..d8034ff0cb241 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1856,9 +1856,7 @@ static bool dm_table_supports_write_zeroes(struct dm_table *t)
static int device_not_nowait_capable(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 !blk_queue_nowait(q);
+ return !bdev_nowait(dev->bdev);
}
static bool dm_table_supports_nowait(struct dm_table *t)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9dc0175280b46..3e9a1a00776bd 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5844,7 +5844,7 @@ int md_run(struct mddev *mddev)
}
}
sysfs_notify_dirent_safe(rdev->sysfs_state);
- nowait = nowait && blk_queue_nowait(bdev_get_queue(rdev->bdev));
+ nowait = nowait && bdev_nowait(rdev->bdev);
}
if (!bioset_initialized(&mddev->bio_set)) {
@@ -6980,7 +6980,7 @@ static int hot_add_disk(struct mddev *mddev, dev_t dev)
* If the new disk does not support REQ_NOWAIT,
* disable on the whole MD.
*/
- if (!blk_queue_nowait(bdev_get_queue(rdev->bdev))) {
+ if (!bdev_nowait(rdev->bdev)) {
pr_info("%s: Disabling nowait because %pg does not support nowait\n",
mdname(mddev), rdev->bdev);
blk_queue_flag_clear(QUEUE_FLAG_NOWAIT, mddev->queue);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 84b13fdd34a71..4750772ef2289 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -618,7 +618,6 @@ bool blk_queue_flag_test_and_set(unsigned int flag, struct request_queue *q);
#define blk_queue_quiesced(q) test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags)
#define blk_queue_pm_only(q) atomic_read(&(q)->pm_only)
#define blk_queue_registered(q) test_bit(QUEUE_FLAG_REGISTERED, &(q)->queue_flags)
-#define blk_queue_nowait(q) test_bit(QUEUE_FLAG_NOWAIT, &(q)->queue_flags)
#define blk_queue_sq_sched(q) test_bit(QUEUE_FLAG_SQ_SCHED, &(q)->queue_flags)
extern void blk_set_pm_only(struct request_queue *q);
@@ -1280,6 +1279,11 @@ static inline bool bdev_fua(struct block_device *bdev)
return test_bit(QUEUE_FLAG_FUA, &bdev_get_queue(bdev)->queue_flags);
}
+static inline bool bdev_nowait(struct block_device *bdev)
+{
+ return test_bit(QUEUE_FLAG_NOWAIT, &bdev_get_queue(bdev)->queue_flags);
+}
+
static inline enum blk_zoned_model bdev_zoned_model(struct block_device *bdev)
{
struct request_queue *q = bdev_get_queue(bdev);
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index ebfdb2212ec25..b2c80c2aa4317 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1377,7 +1377,7 @@ static void io_iopoll_req_issued(struct io_kiocb *req, unsigned int issue_flags)
static bool io_bdev_nowait(struct block_device *bdev)
{
- return !bdev || blk_queue_nowait(bdev_get_queue(bdev));
+ return !bdev || bdev_nowait(bdev);
}
/*
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] block: replace blk_queue_nowait with bdev_nowait
2022-09-27 7:58 [PATCH] block: replace blk_queue_nowait with bdev_nowait Christoph Hellwig
@ 2022-09-27 15:33 ` Pankaj Raghav
2022-09-27 15:59 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Pankaj Raghav @ 2022-09-27 15:33 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: axboe, linux-block, Pankaj Raghav
On Tue, Sep 27, 2022 at 09:58:15AM +0200, Christoph Hellwig wrote:
> Replace blk_queue_nowait with a bdev_nowait helpers that takes the
> block_device given that the I/O submission path should not have to
> look into the request_queue.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/blk-core.c | 2 +-
> drivers/md/dm-table.c | 4 +---
> drivers/md/md.c | 4 ++--
> include/linux/blkdev.h | 6 +++++-
> io_uring/io_uring.c | 2 +-
> 5 files changed, 10 insertions(+), 8 deletions(-)
>
Looks good,
Reviewed-by: Pankaj Raghav <p.raghav@samsung.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: replace blk_queue_nowait with bdev_nowait
2022-09-27 7:58 [PATCH] block: replace blk_queue_nowait with bdev_nowait Christoph Hellwig
2022-09-27 15:33 ` Pankaj Raghav
@ 2022-09-27 15:59 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-09-27 15:59 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block
On Tue, 27 Sep 2022 09:58:15 +0200, Christoph Hellwig wrote:
> Replace blk_queue_nowait with a bdev_nowait helpers that takes the
> block_device given that the I/O submission path should not have to
> look into the request_queue.
>
>
Applied, thanks!
[1/1] block: replace blk_queue_nowait with bdev_nowait
commit: 568ec936bf1384fc15873908c96a9aeb62536edb
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-27 15:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-27 7:58 [PATCH] block: replace blk_queue_nowait with bdev_nowait Christoph Hellwig
2022-09-27 15:33 ` Pankaj Raghav
2022-09-27 15:59 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox