提交 8328eb28 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

block: remove the disk argument to delete_partition

We can trivially derive the gendisk from the hd_struct.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 f93af2a4
...@@ -361,7 +361,7 @@ char *disk_name(struct gendisk *hd, int partno, char *buf); ...@@ -361,7 +361,7 @@ char *disk_name(struct gendisk *hd, int partno, char *buf);
#define ADDPART_FLAG_NONE 0 #define ADDPART_FLAG_NONE 0
#define ADDPART_FLAG_RAID 1 #define ADDPART_FLAG_RAID 1
#define ADDPART_FLAG_WHOLEDISK 2 #define ADDPART_FLAG_WHOLEDISK 2
void delete_partition(struct gendisk *disk, struct hd_struct *part); void delete_partition(struct hd_struct *part);
int bdev_add_partition(struct block_device *bdev, int partno, int bdev_add_partition(struct block_device *bdev, int partno,
sector_t start, sector_t length); sector_t start, sector_t length);
int bdev_del_partition(struct block_device *bdev, int partno); int bdev_del_partition(struct block_device *bdev, int partno);
......
...@@ -913,7 +913,7 @@ void del_gendisk(struct gendisk *disk) ...@@ -913,7 +913,7 @@ void del_gendisk(struct gendisk *disk)
DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE); DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE);
while ((part = disk_part_iter_next(&piter))) { while ((part = disk_part_iter_next(&piter))) {
invalidate_partition(disk, part->partno); invalidate_partition(disk, part->partno);
delete_partition(disk, part); delete_partition(part);
} }
disk_part_iter_exit(&piter); disk_part_iter_exit(&piter);
......
...@@ -324,8 +324,9 @@ int hd_ref_init(struct hd_struct *part) ...@@ -324,8 +324,9 @@ int hd_ref_init(struct hd_struct *part)
* Must be called either with bd_mutex held, before a disk can be opened or * Must be called either with bd_mutex held, before a disk can be opened or
* after all disk users are gone. * after all disk users are gone.
*/ */
void delete_partition(struct gendisk *disk, struct hd_struct *part) void delete_partition(struct hd_struct *part)
{ {
struct gendisk *disk = part_to_disk(part);
struct disk_part_tbl *ptbl = struct disk_part_tbl *ptbl =
rcu_dereference_protected(disk->part_tbl, 1); rcu_dereference_protected(disk->part_tbl, 1);
...@@ -333,7 +334,7 @@ void delete_partition(struct gendisk *disk, struct hd_struct *part) ...@@ -333,7 +334,7 @@ void delete_partition(struct gendisk *disk, struct hd_struct *part)
* ->part_tbl is referenced in this part's release handler, so * ->part_tbl is referenced in this part's release handler, so
* we have to hold the disk device * we have to hold the disk device
*/ */
get_device(disk_to_dev(part_to_disk(part))); get_device(disk_to_dev(disk));
rcu_assign_pointer(ptbl->part[part->partno], NULL); rcu_assign_pointer(ptbl->part[part->partno], NULL);
kobject_put(part->holder_dir); kobject_put(part->holder_dir);
device_del(part_to_dev(part)); device_del(part_to_dev(part));
...@@ -556,7 +557,7 @@ int bdev_del_partition(struct block_device *bdev, int partno) ...@@ -556,7 +557,7 @@ int bdev_del_partition(struct block_device *bdev, int partno)
sync_blockdev(bdevp); sync_blockdev(bdevp);
invalidate_bdev(bdevp); invalidate_bdev(bdevp);
delete_partition(bdev->bd_disk, part); delete_partition(part);
ret = 0; ret = 0;
out_unlock: out_unlock:
mutex_unlock(&bdev->bd_mutex); mutex_unlock(&bdev->bd_mutex);
...@@ -636,7 +637,7 @@ int blk_drop_partitions(struct block_device *bdev) ...@@ -636,7 +637,7 @@ int blk_drop_partitions(struct block_device *bdev)
disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY); disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY);
while ((part = disk_part_iter_next(&piter))) while ((part = disk_part_iter_next(&piter)))
delete_partition(bdev->bd_disk, part); delete_partition(part);
disk_part_iter_exit(&piter); disk_part_iter_exit(&piter);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册