block: move the policy field to struct block_device

Move the policy field to struct block_device and rename it to the
more descriptive bd_read_only.  Also turn the field into a bool as it
is used as such.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2020-11-23 16:36:02 +01:00 committed by Jens Axboe
parent b309e99363
commit 83950d3590
6 changed files with 11 additions and 10 deletions

View file

@ -23,6 +23,7 @@ struct block_device {
sector_t bd_start_sect;
struct disk_stats __percpu *bd_stats;
unsigned long bd_stamp;
bool bd_read_only; /* read-only policy */
dev_t bd_dev;
int bd_openers;
struct inode * bd_inode; /* will die */

View file

@ -55,7 +55,7 @@ struct hd_struct {
struct block_device *bdev;
struct device __dev;
int policy, partno;
int partno;
struct rcu_work rcu_work;
};
@ -278,7 +278,7 @@ extern void set_disk_ro(struct gendisk *disk, int flag);
static inline int get_disk_ro(struct gendisk *disk)
{
return disk->part0.policy;
return disk->part0.bdev->bd_read_only;
}
extern void disk_block_events(struct gendisk *disk);