summaryrefslogtreecommitdiff
path: root/block/partitions/core.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-27 07:24:14 +0200
committerJens Axboe <axboe@kernel.dk>2020-05-27 05:21:23 -0600
commit58d4f14fc30ac26288cfed74d7e566921c22cf59 (patch)
treeb55c90cab60c05e5bc5676d45110827a3818a23b /block/partitions/core.c
parent9123bf6f21b015cce16f3ce066c72aac9fc78d2f (diff)
block: always use a percpu variable for disk stats
percpu variables have a perfectly fine working stub implementation for UP kernels, so use that. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/partitions/core.c')
-rw-r--r--block/partitions/core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 297004fd2264..78951e33b2d7 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -387,7 +387,8 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
if (!p)
return ERR_PTR(-EBUSY);
- if (!init_part_stats(p)) {
+ p->dkstats = alloc_percpu(struct disk_stats);
+ if (!p->dkstats) {
err = -ENOMEM;
goto out_free;
}
@@ -468,7 +469,7 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
out_free_info:
kfree(p->info);
out_free_stats:
- free_part_stats(p);
+ free_percpu(p->dkstats);
out_free:
kfree(p);
return ERR_PTR(err);