Skip to content

Commit

Permalink
dm: use bdev_read_only to check if a device is read-only
Browse files Browse the repository at this point in the history
dm-thin and dm-cache also work on partitions, so use the proper
interface to check if the device is read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Jan 25, 2021
1 parent 6ee1d74 commit 1e0dcca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/md/dm-cache-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static int __check_incompat_features(struct cache_disk_superblock *disk_super,
/*
* Check for read-only metadata to skip the following RDWR checks.
*/
if (get_disk_ro(cmd->bdev->bd_disk))
if (bdev_read_only(cmd->bdev))
return 0;

features = le32_to_cpu(disk_super->compat_ro_flags) & ~DM_CACHE_FEATURE_COMPAT_RO_SUPP;
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-thin-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ static int __check_incompat_features(struct thin_disk_superblock *disk_super,
/*
* Check for read-only metadata to skip the following RDWR checks.
*/
if (get_disk_ro(pmd->bdev->bd_disk))
if (bdev_read_only(pmd->bdev))
return 0;

features = le32_to_cpu(disk_super->compat_ro_flags) & ~THIN_FEATURE_COMPAT_RO_SUPP;
Expand Down

0 comments on commit 1e0dcca

Please sign in to comment.