* [PATCH] block: move bdev_read_only() into the header
@ 2021-10-18 17:44 Jens Axboe
2021-10-19 5:59 ` Christoph Hellwig
2021-10-19 6:20 ` Chaitanya Kulkarni
0 siblings, 2 replies; 3+ messages in thread
From: Jens Axboe @ 2021-10-18 17:44 UTC (permalink / raw)
To: linux-block
This is called for every write in the fast path, move it inline next
to get_disk_ro() which is called internally.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
diff --git a/block/genhd.c b/block/genhd.c
index 53495e3391e3..000e344265ca 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1390,12 +1390,6 @@ void set_disk_ro(struct gendisk *disk, bool read_only)
}
EXPORT_SYMBOL(set_disk_ro);
-int bdev_read_only(struct block_device *bdev)
-{
- return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
-}
-EXPORT_SYMBOL(bdev_read_only);
-
void inc_diskseq(struct gendisk *disk)
{
disk->diskseq = atomic64_inc_return(&diskseq);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 001f617f82da..d13d0f463b03 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -221,6 +221,11 @@ static inline int get_disk_ro(struct gendisk *disk)
test_bit(GD_READ_ONLY, &disk->state);
}
+static inline int bdev_read_only(struct block_device *bdev)
+{
+ return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
+}
+
extern void disk_block_events(struct gendisk *disk);
extern void disk_unblock_events(struct gendisk *disk);
extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
--
Jens Axboe
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block: move bdev_read_only() into the header
2021-10-18 17:44 [PATCH] block: move bdev_read_only() into the header Jens Axboe
@ 2021-10-19 5:59 ` Christoph Hellwig
2021-10-19 6:20 ` Chaitanya Kulkarni
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-10-19 5:59 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
On Mon, Oct 18, 2021 at 11:44:39AM -0600, Jens Axboe wrote:
> This is called for every write in the fast path, move it inline next
> to get_disk_ro() which is called internally.
>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: move bdev_read_only() into the header
2021-10-18 17:44 [PATCH] block: move bdev_read_only() into the header Jens Axboe
2021-10-19 5:59 ` Christoph Hellwig
@ 2021-10-19 6:20 ` Chaitanya Kulkarni
1 sibling, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-19 6:20 UTC (permalink / raw)
To: Jens Axboe, linux-block
On 10/18/2021 10:44 AM, Jens Axboe wrote:
> External email: Use caution opening links or attachments
>
>
> This is called for every write in the fast path, move it inline next
> to get_disk_ro() which is called internally.
>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>
> ---
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-19 6:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 17:44 [PATCH] block: move bdev_read_only() into the header Jens Axboe
2021-10-19 5:59 ` Christoph Hellwig
2021-10-19 6:20 ` Chaitanya Kulkarni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.