Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ming Lei and committed by
Jens Axboe
b54e5ed8 21bdb584

+8 -4
+1 -2
block/genhd.c
··· 1110 1110 disk_release_events(disk); 1111 1111 kfree(disk->random); 1112 1112 disk_replace_part_tbl(disk, NULL); 1113 - free_part_stats(&disk->part0); 1114 - free_part_info(&disk->part0); 1113 + hd_free_part(&disk->part0); 1115 1114 if (disk->queue) 1116 1115 blk_put_queue(disk->queue); 1117 1116 kfree(disk);
+1 -2
block/partition-generic.c
··· 212 212 { 213 213 struct hd_struct *p = dev_to_part(dev); 214 214 blk_free_devt(dev->devt); 215 - free_part_stats(p); 216 - free_part_info(p); 215 + hd_free_part(p); 217 216 kfree(p); 218 217 } 219 218
+6
include/linux/genhd.h
··· 663 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 673 * Any access of part->nr_sects which is not protected by partition 668 674 * bd_mutex or gendisk bdev bd_mutex, should be done using this