diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:42:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:42:46 -0500 |
commit | 03054de1e0b90b33e9974107d84dabd2509f5898 (patch) | |
tree | a85e92d5387d94ef9e3d10bf11467136c681ad04 /fs | |
parent | b5eb9513f7c1bee862ada22bf1489f53752686bd (diff) | |
parent | 0e53c2be0495afa97c6b0d06397adcbff9c65347 (diff) |
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
Enhanced partition statistics: documentation update
Enhanced partition statistics: remove old partition statistics
Enhanced partition statistics: procfs
Enhanced partition statistics: sysfs
Enhanced partition statistics: aoe fix
Enhanced partition statistics: update partition statitics
Enhanced partition statistics: core statistics
block: fixup rq_init() a bit
Manually fixed conflict in drivers/block/aoe/aoecmd.c due to statistics
support.
Diffstat (limited to 'fs')
-rw-r--r-- | fs/partitions/check.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 9a64045ff845..03f808c5b79d 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/kmod.h> | 19 | #include <linux/kmod.h> |
20 | #include <linux/ctype.h> | 20 | #include <linux/ctype.h> |
21 | #include <linux/genhd.h> | ||
21 | 22 | ||
22 | #include "check.h" | 23 | #include "check.h" |
23 | 24 | ||
@@ -215,9 +216,25 @@ static ssize_t part_stat_show(struct device *dev, | |||
215 | { | 216 | { |
216 | struct hd_struct *p = dev_to_part(dev); | 217 | struct hd_struct *p = dev_to_part(dev); |
217 | 218 | ||
218 | return sprintf(buf, "%8u %8llu %8u %8llu\n", | 219 | preempt_disable(); |
219 | p->ios[0], (unsigned long long)p->sectors[0], | 220 | part_round_stats(p); |
220 | p->ios[1], (unsigned long long)p->sectors[1]); | 221 | preempt_enable(); |
222 | return sprintf(buf, | ||
223 | "%8lu %8lu %8llu %8u " | ||
224 | "%8lu %8lu %8llu %8u " | ||
225 | "%8u %8u %8u" | ||
226 | "\n", | ||
227 | part_stat_read(p, ios[READ]), | ||
228 | part_stat_read(p, merges[READ]), | ||
229 | (unsigned long long)part_stat_read(p, sectors[READ]), | ||
230 | jiffies_to_msecs(part_stat_read(p, ticks[READ])), | ||
231 | part_stat_read(p, ios[WRITE]), | ||
232 | part_stat_read(p, merges[WRITE]), | ||
233 | (unsigned long long)part_stat_read(p, sectors[WRITE]), | ||
234 | jiffies_to_msecs(part_stat_read(p, ticks[WRITE])), | ||
235 | p->in_flight, | ||
236 | jiffies_to_msecs(part_stat_read(p, io_ticks)), | ||
237 | jiffies_to_msecs(part_stat_read(p, time_in_queue))); | ||
221 | } | 238 | } |
222 | 239 | ||
223 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 240 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
@@ -273,6 +290,7 @@ static struct attribute_group *part_attr_groups[] = { | |||
273 | static void part_release(struct device *dev) | 290 | static void part_release(struct device *dev) |
274 | { | 291 | { |
275 | struct hd_struct *p = dev_to_part(dev); | 292 | struct hd_struct *p = dev_to_part(dev); |
293 | free_part_stats(p); | ||
276 | kfree(p); | 294 | kfree(p); |
277 | } | 295 | } |
278 | 296 | ||
@@ -312,8 +330,7 @@ void delete_partition(struct gendisk *disk, int part) | |||
312 | disk->part[part-1] = NULL; | 330 | disk->part[part-1] = NULL; |
313 | p->start_sect = 0; | 331 | p->start_sect = 0; |
314 | p->nr_sects = 0; | 332 | p->nr_sects = 0; |
315 | p->ios[0] = p->ios[1] = 0; | 333 | part_stat_set_all(p, 0); |
316 | p->sectors[0] = p->sectors[1] = 0; | ||
317 | kobject_put(p->holder_dir); | 334 | kobject_put(p->holder_dir); |
318 | device_del(&p->dev); | 335 | device_del(&p->dev); |
319 | put_device(&p->dev); | 336 | put_device(&p->dev); |
@@ -336,6 +353,10 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, | |||
336 | if (!p) | 353 | if (!p) |
337 | return; | 354 | return; |
338 | 355 | ||
356 | if (!init_part_stats(p)) { | ||
357 | kfree(p); | ||
358 | return; | ||
359 | } | ||
339 | p->start_sect = start; | 360 | p->start_sect = start; |
340 | p->nr_sects = len; | 361 | p->nr_sects = len; |
341 | p->partno = part; | 362 | p->partno = part; |