提交 b54e5ed8 编写于 作者: M Ming Lei 提交者: Jens Axboe

block: partition: introduce hd_free_part()

So the helper can be used in both generic partition
case and part0 case.
Signed-off-by: NMing Lei <tom.leiming@gmail.com>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 21bdb584
...@@ -1110,8 +1110,7 @@ static void disk_release(struct device *dev) ...@@ -1110,8 +1110,7 @@ static void disk_release(struct device *dev)
disk_release_events(disk); disk_release_events(disk);
kfree(disk->random); kfree(disk->random);
disk_replace_part_tbl(disk, NULL); disk_replace_part_tbl(disk, NULL);
free_part_stats(&disk->part0); hd_free_part(&disk->part0);
free_part_info(&disk->part0);
if (disk->queue) if (disk->queue)
blk_put_queue(disk->queue); blk_put_queue(disk->queue);
kfree(disk); kfree(disk);
......
...@@ -212,8 +212,7 @@ static void part_release(struct device *dev) ...@@ -212,8 +212,7 @@ static void part_release(struct device *dev)
{ {
struct hd_struct *p = dev_to_part(dev); struct hd_struct *p = dev_to_part(dev);
blk_free_devt(dev->devt); blk_free_devt(dev->devt);
free_part_stats(p); hd_free_part(p);
free_part_info(p);
kfree(p); kfree(p);
} }
......
...@@ -663,6 +663,12 @@ static inline void hd_struct_put(struct hd_struct *part) ...@@ -663,6 +663,12 @@ static inline void hd_struct_put(struct hd_struct *part)
__delete_partition(part); __delete_partition(part);
} }
static inline void hd_free_part(struct hd_struct *part)
{
free_part_stats(part);
free_part_info(part);
}
/* /*
* Any access of part->nr_sects which is not protected by partition * Any access of part->nr_sects which is not protected by partition
* bd_mutex or gendisk bdev bd_mutex, should be done using this * bd_mutex or gendisk bdev bd_mutex, should be done using this
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册