]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
dm: use bdev_read_only to check if a device is read-only
authorChristoph Hellwig <hch@lst.de>
Sat, 9 Jan 2021 10:42:49 +0000 (11:42 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Jan 2021 01:15:57 +0000 (18:15 -0700)
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>
drivers/md/dm-cache-metadata.c
drivers/md/dm-thin-metadata.c

index af6d4f898e4c1de8d9b72f053beb454d5617a1e8..89a73204dbf47f50f918d5ba1bf92aec481a6474 100644 (file)
@@ -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;
index 6ebb2127f3e2e0742a7a4fab8d242797af3330b6..e75b20480e460eb8e26efe460537d5d652cf06bb 100644 (file)
@@ -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;