Skip to content

Commit

Permalink
bdev: move ->bd_write_holder into ->__bd_flags
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed May 2, 2024
1 parent 01e198f commit 4c80105
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions block/bdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/blk_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 4c80105

Please sign in to comment.