Skip to content

Commit 01e198f

Browse files
author
Al Viro
committed
bdev: move ->bd_read_only to ->__bd_flags
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 1116b9f commit 01e198f

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

block/ioctl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,10 @@ static int blkdev_roset(struct block_device *bdev, unsigned cmd,
402402
if (ret)
403403
return ret;
404404
}
405-
bdev->bd_read_only = n;
405+
if (n)
406+
bdev_set_flag(bdev, BD_READ_ONLY);
407+
else
408+
bdev_clear_flag(bdev, BD_READ_ONLY);
406409
return 0;
407410
}
408411

include/linux/blk_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct block_device {
4747
unsigned long bd_stamp;
4848
atomic_t __bd_flags; // partition number + flags
4949
#define BD_PARTNO 255 // lower 8 bits; assign-once
50-
bool bd_read_only; /* read-only policy */
50+
#define BD_READ_ONLY (1u<<8) // read-only policy
5151
bool bd_write_holder;
5252
bool bd_has_submit_bio;
5353
dev_t bd_dev;

include/linux/blkdev.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,13 +742,13 @@ static inline void bdev_clear_flag(struct block_device *bdev, unsigned flag)
742742

743743
static inline int get_disk_ro(struct gendisk *disk)
744744
{
745-
return disk->part0->bd_read_only ||
745+
return bdev_test_flag(disk->part0, BD_READ_ONLY) ||
746746
test_bit(GD_READ_ONLY, &disk->state);
747747
}
748748

749749
static inline int bdev_read_only(struct block_device *bdev)
750750
{
751-
return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
751+
return bdev_test_flag(bdev, BD_READ_ONLY) || get_disk_ro(bdev->bd_disk);
752752
}
753753

754754
bool set_capacity_and_notify(struct gendisk *disk, sector_t size);

0 commit comments

Comments
 (0)