bdev: move ->bd_read_only to ->__bd_flags
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
1116b9fa15
commit
01e198f01d
@ -402,7 +402,10 @@ static int blkdev_roset(struct block_device *bdev, unsigned cmd,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
bdev->bd_read_only = n;
|
if (n)
|
||||||
|
bdev_set_flag(bdev, BD_READ_ONLY);
|
||||||
|
else
|
||||||
|
bdev_clear_flag(bdev, BD_READ_ONLY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ struct block_device {
|
|||||||
unsigned long bd_stamp;
|
unsigned long bd_stamp;
|
||||||
atomic_t __bd_flags; // partition number + flags
|
atomic_t __bd_flags; // partition number + flags
|
||||||
#define BD_PARTNO 255 // lower 8 bits; assign-once
|
#define BD_PARTNO 255 // lower 8 bits; assign-once
|
||||||
bool bd_read_only; /* read-only policy */
|
#define BD_READ_ONLY (1u<<8) // read-only policy
|
||||||
bool bd_write_holder;
|
bool bd_write_holder;
|
||||||
bool bd_has_submit_bio;
|
bool bd_has_submit_bio;
|
||||||
dev_t bd_dev;
|
dev_t bd_dev;
|
||||||
|
@ -742,13 +742,13 @@ static inline void bdev_clear_flag(struct block_device *bdev, unsigned flag)
|
|||||||
|
|
||||||
static inline int get_disk_ro(struct gendisk *disk)
|
static inline int get_disk_ro(struct gendisk *disk)
|
||||||
{
|
{
|
||||||
return disk->part0->bd_read_only ||
|
return bdev_test_flag(disk->part0, BD_READ_ONLY) ||
|
||||||
test_bit(GD_READ_ONLY, &disk->state);
|
test_bit(GD_READ_ONLY, &disk->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int bdev_read_only(struct block_device *bdev)
|
static inline int bdev_read_only(struct block_device *bdev)
|
||||||
{
|
{
|
||||||
return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
|
return bdev_test_flag(bdev, BD_READ_ONLY) || get_disk_ro(bdev->bd_disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_capacity_and_notify(struct gendisk *disk, sector_t size);
|
bool set_capacity_and_notify(struct gendisk *disk, sector_t size);
|
||||||
|
Loading…
Reference in New Issue
Block a user