aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/genhd.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2005-11-01 03:26:16 -0500
committerJens Axboe <axboe@suse.de>2005-11-01 03:26:16 -0500
commita362357b6cd62643d4dda3b152639303d78473da (patch)
treefe4ce823e638ded151edcb142f28a240860f0d33 /drivers/block/genhd.c
parentd72d904a5367ad4ca3f2c9a2ce8c3a68f0b28bf0 (diff)
[BLOCK] Unify the seperate read/write io stat fields into arrays
Instead of having ->read_sectors and ->write_sectors, combine the two into ->sectors[2] and similar for the other fields. This saves a branch several places in the io path, since we don't have to care for what the actual io direction is. On my x86-64 box, that's 200 bytes less text in just the core (not counting the various drivers). Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'drivers/block/genhd.c')
-rw-r--r--drivers/block/genhd.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c
index 486ce1fdeb8c..54aec4a1ae13 100644
--- a/drivers/block/genhd.c
+++ b/drivers/block/genhd.c
@@ -391,13 +391,12 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page)
391 "%8u %8u %8llu %8u " 391 "%8u %8u %8llu %8u "
392 "%8u %8u %8u" 392 "%8u %8u %8u"
393 "\n", 393 "\n",
394 disk_stat_read(disk, reads), disk_stat_read(disk, read_merges), 394 disk_stat_read(disk, ios[0]), disk_stat_read(disk, merges[0]),
395 (unsigned long long)disk_stat_read(disk, read_sectors), 395 (unsigned long long)disk_stat_read(disk, sectors[0]),
396 jiffies_to_msecs(disk_stat_read(disk, read_ticks)), 396 jiffies_to_msecs(disk_stat_read(disk, ticks[0])),
397 disk_stat_read(disk, writes), 397 disk_stat_read(disk, ios[1]), disk_stat_read(disk, merges[1]),
398 disk_stat_read(disk, write_merges), 398 (unsigned long long)disk_stat_read(disk, sectors[1]),
399 (unsigned long long)disk_stat_read(disk, write_sectors), 399 jiffies_to_msecs(disk_stat_read(disk, ticks[1])),
400 jiffies_to_msecs(disk_stat_read(disk, write_ticks)),
401 disk->in_flight, 400 disk->in_flight,
402 jiffies_to_msecs(disk_stat_read(disk, io_ticks)), 401 jiffies_to_msecs(disk_stat_read(disk, io_ticks)),
403 jiffies_to_msecs(disk_stat_read(disk, time_in_queue))); 402 jiffies_to_msecs(disk_stat_read(disk, time_in_queue)));
@@ -583,12 +582,12 @@ static int diskstats_show(struct seq_file *s, void *v)
583 preempt_enable(); 582 preempt_enable();
584 seq_printf(s, "%4d %4d %s %u %u %llu %u %u %u %llu %u %u %u %u\n", 583 seq_printf(s, "%4d %4d %s %u %u %llu %u %u %u %llu %u %u %u %u\n",
585 gp->major, n + gp->first_minor, disk_name(gp, n, buf), 584 gp->major, n + gp->first_minor, disk_name(gp, n, buf),
586 disk_stat_read(gp, reads), disk_stat_read(gp, read_merges), 585 disk_stat_read(gp, ios[0]), disk_stat_read(gp, merges[0]),
587 (unsigned long long)disk_stat_read(gp, read_sectors), 586 (unsigned long long)disk_stat_read(gp, sectors[0]),
588 jiffies_to_msecs(disk_stat_read(gp, read_ticks)), 587 jiffies_to_msecs(disk_stat_read(gp, ticks[0])),
589 disk_stat_read(gp, writes), disk_stat_read(gp, write_merges), 588 disk_stat_read(gp, ios[1]), disk_stat_read(gp, merges[1]),
590 (unsigned long long)disk_stat_read(gp, write_sectors), 589 (unsigned long long)disk_stat_read(gp, sectors[1]),
591 jiffies_to_msecs(disk_stat_read(gp, write_ticks)), 590 jiffies_to_msecs(disk_stat_read(gp, ticks[1])),
592 gp->in_flight, 591 gp->in_flight,
593 jiffies_to_msecs(disk_stat_read(gp, io_ticks)), 592 jiffies_to_msecs(disk_stat_read(gp, io_ticks)),
594 jiffies_to_msecs(disk_stat_read(gp, time_in_queue))); 593 jiffies_to_msecs(disk_stat_read(gp, time_in_queue)));
@@ -601,8 +600,8 @@ static int diskstats_show(struct seq_file *s, void *v)
601 seq_printf(s, "%4d %4d %s %u %u %u %u\n", 600 seq_printf(s, "%4d %4d %s %u %u %u %u\n",
602 gp->major, n + gp->first_minor + 1, 601 gp->major, n + gp->first_minor + 1,
603 disk_name(gp, n + 1, buf), 602 disk_name(gp, n + 1, buf),
604 hd->reads, hd->read_sectors, 603 hd->ios[0], hd->sectors[0],
605 hd->writes, hd->write_sectors); 604 hd->ios[1], hd->sectors[1]);
606 } 605 }
607 606
608 return 0; 607 return 0;