Commit 1e0dcca9 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

dm: use bdev_read_only to check if a device is read-only

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 6ee1d745
...@@ -449,7 +449,7 @@ static int __check_incompat_features(struct cache_disk_superblock *disk_super, ...@@ -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. * 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; return 0;
features = le32_to_cpu(disk_super->compat_ro_flags) & ~DM_CACHE_FEATURE_COMPAT_RO_SUPP; features = le32_to_cpu(disk_super->compat_ro_flags) & ~DM_CACHE_FEATURE_COMPAT_RO_SUPP;
......
...@@ -636,7 +636,7 @@ static int __check_incompat_features(struct thin_disk_superblock *disk_super, ...@@ -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. * 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; return 0;
features = le32_to_cpu(disk_super->compat_ro_flags) & ~THIN_FEATURE_COMPAT_RO_SUPP; features = le32_to_cpu(disk_super->compat_ro_flags) & ~THIN_FEATURE_COMPAT_RO_SUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment