summary refs log tree commit diff
path: root/fs/partitions/check.c
diff options
context:
space:
mode:
authorJerome Marchand <jmarchan@redhat.com>2008-02-08 11:04:35 +0100
committerJens Axboe <jens.axboe@oracle.com>2008-02-08 12:41:56 +0100
commit6f2576af5ba5913538fda7dfb7c6a17771025477 (patch)
treeff55bc30686ccec8b0ce22eb3844e78a52aea875 /fs/partitions/check.c
parentea5c48ab2a76559d4af39e1f7de137c0851ac0a5 (diff)
downloadlinux-6f2576af5ba5913538fda7dfb7c6a17771025477.tar.gz
Enhanced partition statistics: update partition statitics
Updates the enhanced partition statistics in generic block layer
besides the disk statistics.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/partitions/check.c')
-rw-r--r--fs/partitions/check.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 9a64045ff845..f2ec7f1b0ec5 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -18,6 +18,7 @@
 #include <linux/fs.h>
 #include <linux/kmod.h>
 #include <linux/ctype.h>
+#include <linux/genhd.h>
 
 #include "check.h"
 
@@ -273,6 +274,7 @@ static struct attribute_group *part_attr_groups[] = {
 static void part_release(struct device *dev)
 {
 	struct hd_struct *p = dev_to_part(dev);
+	free_part_stats(p);
 	kfree(p);
 }
 
@@ -314,6 +316,7 @@ void delete_partition(struct gendisk *disk, int part)
 	p->nr_sects = 0;
 	p->ios[0] = p->ios[1] = 0;
 	p->sectors[0] = p->sectors[1] = 0;
+	part_stat_set_all(p, 0);
 	kobject_put(p->holder_dir);
 	device_del(&p->dev);
 	put_device(&p->dev);
@@ -336,6 +339,10 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
 	if (!p)
 		return;
 
+	if (!init_part_stats(p)) {
+		kfree(p);
+		return;
+	}
 	p->start_sect = start;
 	p->nr_sects = len;
 	p->partno = part;