diff mbox series

[5/8] bdev: move ->bd_write_holder into ->__bd_flags

Message ID 20240428051813.GE1549798@ZenIV (mailing list archive)
State New, archived
Headers show
Series [1/8] Use bdev_is_paritition() instead of open-coding it | expand

Commit Message

Al Viro April 28, 2024, 5:18 a.m. UTC
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 block/bdev.c              | 9 +++++----
 include/linux/blk_types.h | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/block/bdev.c b/block/bdev.c
index 0c55f7abaac3..24c1dd6de8a9 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -624,7 +624,7 @@  static void bd_end_claim(struct block_device *bdev, void *holder)
 		bdev->bd_holder = NULL;
 		bdev->bd_holder_ops = NULL;
 		mutex_unlock(&bdev->bd_holder_lock);
-		if (bdev->bd_write_holder)
+		if (bdev_test_flag(bdev, BD_WRITE_HOLDER))
 			unblock = true;
 	}
 	if (!whole->bd_holders)
@@ -640,7 +640,7 @@  static void bd_end_claim(struct block_device *bdev, void *holder)
 	 */
 	if (unblock) {
 		disk_unblock_events(bdev->bd_disk);
-		bdev->bd_write_holder = false;
+		bdev_clear_flag(bdev, BD_WRITE_HOLDER);
 	}
 }
 
@@ -892,9 +892,10 @@  int bdev_open(struct block_device *bdev, blk_mode_t mode, void *holder,
 		 * writeable reference is too fragile given the way @mode is
 		 * used in blkdev_get/put().
 		 */
-		if ((mode & BLK_OPEN_WRITE) && !bdev->bd_write_holder &&
+		if ((mode & BLK_OPEN_WRITE) &&
+		    !bdev_test_flag(bdev, BD_WRITE_HOLDER) &&
 		    (disk->event_flags & DISK_EVENT_FLAG_BLOCK_ON_EXCL_WRITE)) {
-			bdev->bd_write_holder = true;
+			bdev_set_flag(bdev, BD_WRITE_HOLDER);
 			unblock_events = false;
 		}
 	}
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 1aa41b651614..8a336053b5fa 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -46,7 +46,6 @@  struct block_device {
 	struct disk_stats __percpu *bd_stats;
 	unsigned long		bd_stamp;
 	u32			__bd_flags;	// partition number + flags
-	bool			bd_write_holder;
 	bool			bd_has_submit_bio;
 	dev_t			bd_dev;
 	struct inode		*bd_inode;	/* will die */
@@ -87,6 +86,7 @@  struct block_device {
 
 enum {
 	BD_READ_ONLY,		// read-only policy
+	BD_WRITE_HOLDER,
 };
 
 /*