diff options
author | Ming Lei <tom.leiming@gmail.com> | 2015-07-15 23:16:44 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-07-17 10:41:53 -0400 |
commit | b54e5ed8f285d62c0d242c4ef9da90937994db02 (patch) | |
tree | ee9303a8a5df76206884f3ed4c61a1e9fd83721a | |
parent | 21bdb584af8cca7c6df3c44cba268be050a234eb (diff) |
block: partition: introduce hd_free_part()
So the helper can be used in both generic partition
case and part0 case.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | block/genhd.c | 3 | ||||
-rw-r--r-- | block/partition-generic.c | 3 | ||||
-rw-r--r-- | include/linux/genhd.h | 6 |
3 files changed, 8 insertions, 4 deletions
diff --git a/block/genhd.c b/block/genhd.c index 59a1395eedac..85df45292dba 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1110,8 +1110,7 @@ static void disk_release(struct device *dev) | |||
1110 | disk_release_events(disk); | 1110 | disk_release_events(disk); |
1111 | kfree(disk->random); | 1111 | kfree(disk->random); |
1112 | disk_replace_part_tbl(disk, NULL); | 1112 | disk_replace_part_tbl(disk, NULL); |
1113 | free_part_stats(&disk->part0); | 1113 | hd_free_part(&disk->part0); |
1114 | free_part_info(&disk->part0); | ||
1115 | if (disk->queue) | 1114 | if (disk->queue) |
1116 | blk_put_queue(disk->queue); | 1115 | blk_put_queue(disk->queue); |
1117 | kfree(disk); | 1116 | kfree(disk); |
diff --git a/block/partition-generic.c b/block/partition-generic.c index 0d9e5f97f0a8..eca0d02a607c 100644 --- a/block/partition-generic.c +++ b/block/partition-generic.c | |||
@@ -212,8 +212,7 @@ static void part_release(struct device *dev) | |||
212 | { | 212 | { |
213 | struct hd_struct *p = dev_to_part(dev); | 213 | struct hd_struct *p = dev_to_part(dev); |
214 | blk_free_devt(dev->devt); | 214 | blk_free_devt(dev->devt); |
215 | free_part_stats(p); | 215 | hd_free_part(p); |
216 | free_part_info(p); | ||
217 | kfree(p); | 216 | kfree(p); |
218 | } | 217 | } |
219 | 218 | ||
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index ec274e0f4ed2..a221220ffcb2 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -663,6 +663,12 @@ static inline void hd_struct_put(struct hd_struct *part) | |||
663 | __delete_partition(part); | 663 | __delete_partition(part); |
664 | } | 664 | } |
665 | 665 | ||
666 | static inline void hd_free_part(struct hd_struct *part) | ||
667 | { | ||
668 | free_part_stats(part); | ||
669 | free_part_info(part); | ||
670 | } | ||
671 | |||
666 | /* | 672 | /* |
667 | * Any access of part->nr_sects which is not protected by partition | 673 | * Any access of part->nr_sects which is not protected by partition |
668 | * bd_mutex or gendisk bdev bd_mutex, should be done using this | 674 | * bd_mutex or gendisk bdev bd_mutex, should be done using this |