Skip to content

Commit 8328eb2

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: remove the disk argument to delete_partition
We can trivially derive the gendisk from the hd_struct. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f93af2a commit 8328eb2

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎block/blk.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ char *disk_name(struct gendisk *hd, int partno, char *buf);
361361
#define ADDPART_FLAG_NONE 0
362362
#define ADDPART_FLAG_RAID 1
363363
#define ADDPART_FLAG_WHOLEDISK 2
364-
void delete_partition(struct gendisk *disk, struct hd_struct *part);
364+
void delete_partition(struct hd_struct *part);
365365
int bdev_add_partition(struct block_device *bdev, int partno,
366366
sector_t start, sector_t length);
367367
int bdev_del_partition(struct block_device *bdev, int partno);

‎block/genhd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ void del_gendisk(struct gendisk *disk)
913913
DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE);
914914
while ((part = disk_part_iter_next(&piter))) {
915915
invalidate_partition(disk, part->partno);
916-
delete_partition(disk, part);
916+
delete_partition(part);
917917
}
918918
disk_part_iter_exit(&piter);
919919

‎block/partitions/core.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,17 @@ int hd_ref_init(struct hd_struct *part)
324324
* Must be called either with bd_mutex held, before a disk can be opened or
325325
* after all disk users are gone.
326326
*/
327-
void delete_partition(struct gendisk *disk, struct hd_struct *part)
327+
void delete_partition(struct hd_struct *part)
328328
{
329+
struct gendisk *disk = part_to_disk(part);
329330
struct disk_part_tbl *ptbl =
330331
rcu_dereference_protected(disk->part_tbl, 1);
331332

332333
/*
333334
* ->part_tbl is referenced in this part's release handler, so
334335
* we have to hold the disk device
335336
*/
336-
get_device(disk_to_dev(part_to_disk(part)));
337+
get_device(disk_to_dev(disk));
337338
rcu_assign_pointer(ptbl->part[part->partno], NULL);
338339
kobject_put(part->holder_dir);
339340
device_del(part_to_dev(part));
@@ -556,7 +557,7 @@ int bdev_del_partition(struct block_device *bdev, int partno)
556557
sync_blockdev(bdevp);
557558
invalidate_bdev(bdevp);
558559

559-
delete_partition(bdev->bd_disk, part);
560+
delete_partition(part);
560561
ret = 0;
561562
out_unlock:
562563
mutex_unlock(&bdev->bd_mutex);
@@ -636,7 +637,7 @@ int blk_drop_partitions(struct block_device *bdev)
636637

637638
disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY);
638639
while ((part = disk_part_iter_next(&piter)))
639-
delete_partition(bdev->bd_disk, part);
640+
delete_partition(part);
640641
disk_part_iter_exit(&piter);
641642

642643
return 0;

0 commit comments

Comments
 (0)