[PATCH 7/8] bdev: move ->bd_ro_warned to ->__bd_flags

Al Viro
2024-04-28T05:19:41Z

block/blk-core.c | 5 +++--
include/linux/blk_types.h | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index f61460b65408..1be49be9fac4 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -514,10 +514,11 @@ static inline void bio_check_ro(struct bio *bio)
if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
return;

- if (bio->bi_bdev->bd_ro_warned)
+ if (bdev_test_flag(bio->bi_bdev, BD_RO_WARNED))
return;

- bio->bi_bdev->bd_ro_warned = true;
+ bdev_set_flag(bio->bi_bdev, BD_RO_WARNED);
+
/*
* Use ioctl to set underlying disk of raid/dm to read-only
* will trigger this.
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index c8f5364b24f1..59de93913cc4 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -65,7 +65,6 @@ struct block_device {
#ifdef CONFIG_FAIL_MAKE_REQUEST
bool bd_make_it_fail;
#endif
- bool bd_ro_warned;
int bd_writers;
/*
* keep this out-of-line as it's both big and not needed in the fast
@@ -87,6 +86,7 @@ enum {
BD_READ_ONLY, // read-only policy
BD_WRITE_HOLDER,
BD_HAS_SUBMIT_BIO,
+ BD_RO_WARNED,
};

/*
--
2.39.2