bdev: move ->bd_write_holder into ->__bd_flags

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2024-04-12 01:18:24 -04:00
parent 01e198f01d
commit 4c80105e39
2 changed files with 6 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -48,7 +48,7 @@ struct block_device {
atomic_t __bd_flags; // partition number + flags
#define BD_PARTNO 255 // lower 8 bits; assign-once
#define BD_READ_ONLY (1u<<8) // read-only policy
bool bd_write_holder;
#define BD_WRITE_HOLDER (1u<<9)
bool bd_has_submit_bio;
dev_t bd_dev;
struct inode *bd_inode; /* will die */