summaryrefslogtreecommitdiff
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-24 11:34:00 +0300
committerJens Axboe <axboe@kernel.dk>2020-12-02 00:53:40 +0300
commit15e3d2c5cd53298272e59ad9072d3468f9dd3781 (patch)
treee526446b6b09c036e9aed966dbe2bdd252f5bb98 /block/genhd.c
parenta782483cc1f875355690625d8253a232f2581418 (diff)
downloadlinux-15e3d2c5cd53298272e59ad9072d3468f9dd3781.tar.xz
block: move disk stat accounting to struct block_device
Move the dkstats and stamp field to struct block_device in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/block/genhd.c b/block/genhd.c
index c65f485b9db5..2cbda8139556 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -112,7 +112,7 @@ static void part_stat_read_all(struct hd_struct *part, struct disk_stats *stat)
memset(stat, 0, sizeof(struct disk_stats));
for_each_possible_cpu(cpu) {
- struct disk_stats *ptr = per_cpu_ptr(part->dkstats, cpu);
+ struct disk_stats *ptr = per_cpu_ptr(part->bdev->bd_stats, cpu);
int group;
for (group = 0; group < NR_STAT_GROUPS; group++) {
@@ -891,7 +891,7 @@ void del_gendisk(struct gendisk *disk)
kobject_put(disk->slave_dir);
part_stat_set_all(&disk->part0, 0);
- disk->part0.stamp = 0;
+ disk->part0.bdev->bd_stamp = 0;
if (!sysfs_deprecated)
sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk)));
pm_runtime_set_memalloc_noio(disk_to_dev(disk), false);
@@ -1628,19 +1628,15 @@ struct gendisk *__alloc_disk_node(int minors, int node_id)
if (!disk->part0.bdev)
goto out_free_disk;
- disk->part0.dkstats = alloc_percpu(struct disk_stats);
- if (!disk->part0.dkstats)
- goto out_bdput;
-
disk->node_id = node_id;
if (disk_expand_part_tbl(disk, 0))
- goto out_free_bdstats;
+ goto out_bdput;
ptbl = rcu_dereference_protected(disk->part_tbl, 1);
rcu_assign_pointer(ptbl->part[0], &disk->part0);
if (hd_ref_init(&disk->part0))
- goto out_free_bdstats;
+ goto out_bdput;
disk->minors = minors;
rand_initialize_disk(disk);
@@ -1649,8 +1645,6 @@ struct gendisk *__alloc_disk_node(int minors, int node_id)
device_initialize(disk_to_dev(disk));
return disk;
-out_free_bdstats:
- free_percpu(disk->part0.dkstats);
out_bdput:
bdput(disk->part0.bdev);
out_free_disk: