diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 31ee5a857f71..0832c7830f3a 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -32,6 +32,7 @@ #include <linux/cleancache.h> #include <linux/task_io_accounting_ops.h> #include <linux/falloc.h> +#include <linux/part_stat.h> #include <linux/uaccess.h> #include <linux/suspend.h> #include "internal.h" @@ -781,6 +782,10 @@ static struct inode *bdev_alloc_inode(struct super_block *sb) static void bdev_free_inode(struct inode *inode) { + struct block_device *bdev = I_BDEV(inode); + + free_percpu(bdev->bd_stats); + kmem_cache_free(bdev_cachep, BDEV_I(inode)); } @@ -875,6 +880,11 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno) #ifdef CONFIG_SYSFS INIT_LIST_HEAD(&bdev->bd_holder_disks); #endif + bdev->bd_stats = alloc_percpu(struct disk_stats); + if (!bdev->bd_stats) { + iput(inode); + return NULL; + } return bdev; } |