Re: [PATCH 05/10] block: remove the disk argument from blk_drop_partitions

Johannes Thumshirn
2020-04-09T11:33:28Z

On 08/04/2020 21:45, Christoph Hellwig wrote:
> -int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)
> +int blk_drop_partitions(struct block_device *bdev)
> {
> struct disk_part_iter piter;
> struct hd_struct *part;
> int res;
>
> - if (!disk_part_scan_enabled(disk))
> + if (!disk_part_scan_enabled(bdev->bd_disk))
> return 0;
> if (bdev->bd_part_count || bdev->bd_openers)
> return -EBUSY;
> - res = invalidate_partition(disk, 0);
> + res = invalidate_partition(bdev->bd_disk, 0);
> if (res)
> return res;
>
> - disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
> + disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY);
> while ((part = disk_part_iter_next(&piter)))
> - delete_partition(disk, part);
> + delete_partition(bdev->bd_disk, part);
> disk_part_iter_exit(&piter);

I would have probably added a local 'struct gendisk *disk' variable, but
that's personal preference I guess.