The gendisk can be trivially deducted from the block_device.
Unified · Split
| @@ -603,23 +603,23 @@ static bool disk_unlock_native_capacity(struct gendisk *disk) · 602 unmodified lines | ||
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | −int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev) | |
| 606 | +int blk_drop_partitions(struct block_device *bdev) | |
| 607 | 607 | { |
| 608 | 608 | struct disk_part_iter piter; |
| 609 | 609 | struct hd_struct *part; |
| 610 | 610 | int res; |
| 611 | 611 | |
| 612 | − if (!disk_part_scan_enabled(disk)) | |
| 612 | + if (!disk_part_scan_enabled(bdev->bd_disk)) | |
| 613 | 613 | return 0; |
| 614 | 614 | if (bdev->bd_part_count || bdev->bd_openers > 1) |
| 615 | 615 | return -EBUSY; |
| 616 | − res = invalidate_partition(disk, 0); | |
| 616 | + res = invalidate_partition(bdev->bd_disk, 0); | |
| 617 | 617 | if (res) |
| 618 | 618 | return res; |
| 619 | 619 | |
| 620 | − disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); | |
| 620 | + disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY); | |
| 621 | 621 | while ((part = disk_part_iter_next(&piter))) |
| 622 | − delete_partition(disk, part); | |
| 622 | + delete_partition(bdev->bd_disk, part); | |
| 623 | 623 | disk_part_iter_exit(&piter); |
| 624 | 624 | |
| 625 | 625 | return 0; |
| @@ -1517,7 +1517,7 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate) · 1516 unmodified lines | ||
| 1517 | 1517 | lockdep_assert_held(&bdev->bd_mutex); |
| 1518 | 1518 | |
| 1519 | 1519 | rescan: |
| 1520 | − ret = blk_drop_partitions(disk, bdev); | |
| 1520 | + ret = blk_drop_partitions(bdev); | |
| 1521 | 1521 | if (ret) |
| 1522 | 1522 | return ret; |
| 1523 | 1523 | |
| @@ -339,7 +339,7 @@ extern dev_t blk_lookup_devt(const char *name, int partno); · 338 unmodified lines | ||
| 339 | 339 | |
| 340 | 340 | int bdev_disk_changed(struct block_device *bdev, bool invalidate); |
| 341 | 341 | int blk_add_partitions(struct gendisk *disk, struct block_device *bdev); |
| 342 | −int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev); | |
| 342 | +int blk_drop_partitions(struct block_device *bdev); | |
| 343 | 343 | extern void printk_all_partitions(void); |
| 344 | 344 | |
| 345 | 345 | extern struct gendisk *__alloc_disk_node(int minors, int node_id); |