diff options
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 49913804e8dd..effd89489506 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -624,29 +624,12 @@ static inline void cfq_blkiocg_update_dispatch_stats(struct blkio_group *blkg, | |||
624 | struct blkio_policy_type *pol, uint64_t bytes, | 624 | struct blkio_policy_type *pol, uint64_t bytes, |
625 | bool direction, bool sync) | 625 | bool direction, bool sync) |
626 | { | 626 | { |
627 | struct blkio_group_stats *stats = &blkg->pd[pol->plid]->stats; | ||
627 | int rw = (direction ? REQ_WRITE : 0) | (sync ? REQ_SYNC : 0); | 628 | int rw = (direction ? REQ_WRITE : 0) | (sync ? REQ_SYNC : 0); |
628 | struct blkg_policy_data *pd = blkg->pd[pol->plid]; | ||
629 | struct blkio_group_stats_cpu *stats_cpu; | ||
630 | unsigned long flags; | ||
631 | 629 | ||
632 | /* If per cpu stats are not allocated yet, don't do any accounting. */ | 630 | blkg_stat_add(&stats->sectors, bytes >> 9); |
633 | if (pd->stats_cpu == NULL) | 631 | blkg_rwstat_add(&stats->serviced, rw, 1); |
634 | return; | 632 | blkg_rwstat_add(&stats->service_bytes, rw, bytes); |
635 | |||
636 | /* | ||
637 | * Disabling interrupts to provide mutual exclusion between two | ||
638 | * writes on same cpu. It probably is not needed for 64bit. Not | ||
639 | * optimizing that case yet. | ||
640 | */ | ||
641 | local_irq_save(flags); | ||
642 | |||
643 | stats_cpu = this_cpu_ptr(pd->stats_cpu); | ||
644 | |||
645 | blkg_stat_add(&stats_cpu->sectors, bytes >> 9); | ||
646 | blkg_rwstat_add(&stats_cpu->serviced, rw, 1); | ||
647 | blkg_rwstat_add(&stats_cpu->service_bytes, rw, bytes); | ||
648 | |||
649 | local_irq_restore(flags); | ||
650 | } | 633 | } |
651 | 634 | ||
652 | static inline void cfq_blkiocg_update_completion_stats(struct blkio_group *blkg, | 635 | static inline void cfq_blkiocg_update_completion_stats(struct blkio_group *blkg, |
@@ -1520,20 +1503,20 @@ static struct cftype cfq_blkcg_files[] = { | |||
1520 | { | 1503 | { |
1521 | .name = "sectors", | 1504 | .name = "sectors", |
1522 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1505 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, |
1523 | offsetof(struct blkio_group_stats_cpu, sectors)), | 1506 | offsetof(struct blkio_group_stats, sectors)), |
1524 | .read_seq_string = blkcg_print_cpu_stat, | 1507 | .read_seq_string = blkcg_print_stat, |
1525 | }, | 1508 | }, |
1526 | { | 1509 | { |
1527 | .name = "io_service_bytes", | 1510 | .name = "io_service_bytes", |
1528 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1511 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, |
1529 | offsetof(struct blkio_group_stats_cpu, service_bytes)), | 1512 | offsetof(struct blkio_group_stats, service_bytes)), |
1530 | .read_seq_string = blkcg_print_cpu_rwstat, | 1513 | .read_seq_string = blkcg_print_rwstat, |
1531 | }, | 1514 | }, |
1532 | { | 1515 | { |
1533 | .name = "io_serviced", | 1516 | .name = "io_serviced", |
1534 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1517 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, |
1535 | offsetof(struct blkio_group_stats_cpu, serviced)), | 1518 | offsetof(struct blkio_group_stats, serviced)), |
1536 | .read_seq_string = blkcg_print_cpu_rwstat, | 1519 | .read_seq_string = blkcg_print_rwstat, |
1537 | }, | 1520 | }, |
1538 | { | 1521 | { |
1539 | .name = "io_service_time", | 1522 | .name = "io_service_time", |