diff options
author | Tejun Heo <tj@kernel.org> | 2012-04-01 17:38:45 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-04-01 17:38:45 -0400 |
commit | 5bc4afb1ec6aa562fac4d9aba34d957ee42f5813 (patch) | |
tree | dfef1de2dcb71beab3150ffecf6ae564d326ffba /block/cfq-iosched.c | |
parent | d366e7ec41882791c970dfb7c67b737be8c3a174 (diff) |
blkcg: drop BLKCG_STAT_{PRIV|POL|OFF} macros
Now that all stat handling code lives in policy implementations,
there's no need to encode policy ID in cft->private.
* Export blkcg_prfill_[rw]stat() from blkcg, remove
blkcg_print_[rw]stat(), and implement cfqg_print_[rw]stat() which
use hard-code BLKIO_POLICY_PROP.
* Use cft->private for offset of the target field directly and drop
BLKCG_STAT_{PRIV|POL|OFF}().
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 85 |
1 files changed, 46 insertions, 39 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index fd505f721f61..cff8b5ba6208 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1441,6 +1441,26 @@ static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val) | |||
1441 | return 0; | 1441 | return 0; |
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft, | ||
1445 | struct seq_file *sf) | ||
1446 | { | ||
1447 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); | ||
1448 | |||
1449 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, BLKIO_POLICY_PROP, | ||
1450 | cft->private, false); | ||
1451 | return 0; | ||
1452 | } | ||
1453 | |||
1454 | static int cfqg_print_rwstat(struct cgroup *cgrp, struct cftype *cft, | ||
1455 | struct seq_file *sf) | ||
1456 | { | ||
1457 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); | ||
1458 | |||
1459 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, BLKIO_POLICY_PROP, | ||
1460 | cft->private, true); | ||
1461 | return 0; | ||
1462 | } | ||
1463 | |||
1444 | #ifdef CONFIG_DEBUG_BLK_CGROUP | 1464 | #ifdef CONFIG_DEBUG_BLK_CGROUP |
1445 | static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, void *pdata, int off) | 1465 | static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, void *pdata, int off) |
1446 | { | 1466 | { |
@@ -1482,51 +1502,43 @@ static struct cftype cfq_blkcg_files[] = { | |||
1482 | }, | 1502 | }, |
1483 | { | 1503 | { |
1484 | .name = "time", | 1504 | .name = "time", |
1485 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1505 | .private = offsetof(struct cfq_group, stats.time), |
1486 | offsetof(struct cfq_group, stats.time)), | 1506 | .read_seq_string = cfqg_print_stat, |
1487 | .read_seq_string = blkcg_print_stat, | ||
1488 | }, | 1507 | }, |
1489 | { | 1508 | { |
1490 | .name = "sectors", | 1509 | .name = "sectors", |
1491 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1510 | .private = offsetof(struct cfq_group, stats.sectors), |
1492 | offsetof(struct cfq_group, stats.sectors)), | 1511 | .read_seq_string = cfqg_print_stat, |
1493 | .read_seq_string = blkcg_print_stat, | ||
1494 | }, | 1512 | }, |
1495 | { | 1513 | { |
1496 | .name = "io_service_bytes", | 1514 | .name = "io_service_bytes", |
1497 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1515 | .private = offsetof(struct cfq_group, stats.service_bytes), |
1498 | offsetof(struct cfq_group, stats.service_bytes)), | 1516 | .read_seq_string = cfqg_print_rwstat, |
1499 | .read_seq_string = blkcg_print_rwstat, | ||
1500 | }, | 1517 | }, |
1501 | { | 1518 | { |
1502 | .name = "io_serviced", | 1519 | .name = "io_serviced", |
1503 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1520 | .private = offsetof(struct cfq_group, stats.serviced), |
1504 | offsetof(struct cfq_group, stats.serviced)), | 1521 | .read_seq_string = cfqg_print_rwstat, |
1505 | .read_seq_string = blkcg_print_rwstat, | ||
1506 | }, | 1522 | }, |
1507 | { | 1523 | { |
1508 | .name = "io_service_time", | 1524 | .name = "io_service_time", |
1509 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1525 | .private = offsetof(struct cfq_group, stats.service_time), |
1510 | offsetof(struct cfq_group, stats.service_time)), | 1526 | .read_seq_string = cfqg_print_rwstat, |
1511 | .read_seq_string = blkcg_print_rwstat, | ||
1512 | }, | 1527 | }, |
1513 | { | 1528 | { |
1514 | .name = "io_wait_time", | 1529 | .name = "io_wait_time", |
1515 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1530 | .private = offsetof(struct cfq_group, stats.wait_time), |
1516 | offsetof(struct cfq_group, stats.wait_time)), | 1531 | .read_seq_string = cfqg_print_rwstat, |
1517 | .read_seq_string = blkcg_print_rwstat, | ||
1518 | }, | 1532 | }, |
1519 | { | 1533 | { |
1520 | .name = "io_merged", | 1534 | .name = "io_merged", |
1521 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1535 | .private = offsetof(struct cfq_group, stats.merged), |
1522 | offsetof(struct cfq_group, stats.merged)), | 1536 | .read_seq_string = cfqg_print_rwstat, |
1523 | .read_seq_string = blkcg_print_rwstat, | ||
1524 | }, | 1537 | }, |
1525 | { | 1538 | { |
1526 | .name = "io_queued", | 1539 | .name = "io_queued", |
1527 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1540 | .private = offsetof(struct cfq_group, stats.queued), |
1528 | offsetof(struct cfq_group, stats.queued)), | 1541 | .read_seq_string = cfqg_print_rwstat, |
1529 | .read_seq_string = blkcg_print_rwstat, | ||
1530 | }, | 1542 | }, |
1531 | #ifdef CONFIG_DEBUG_BLK_CGROUP | 1543 | #ifdef CONFIG_DEBUG_BLK_CGROUP |
1532 | { | 1544 | { |
@@ -1535,33 +1547,28 @@ static struct cftype cfq_blkcg_files[] = { | |||
1535 | }, | 1547 | }, |
1536 | { | 1548 | { |
1537 | .name = "group_wait_time", | 1549 | .name = "group_wait_time", |
1538 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1550 | .private = offsetof(struct cfq_group, stats.group_wait_time), |
1539 | offsetof(struct cfq_group, stats.group_wait_time)), | 1551 | .read_seq_string = cfqg_print_stat, |
1540 | .read_seq_string = blkcg_print_stat, | ||
1541 | }, | 1552 | }, |
1542 | { | 1553 | { |
1543 | .name = "idle_time", | 1554 | .name = "idle_time", |
1544 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1555 | .private = offsetof(struct cfq_group, stats.idle_time), |
1545 | offsetof(struct cfq_group, stats.idle_time)), | 1556 | .read_seq_string = cfqg_print_stat, |
1546 | .read_seq_string = blkcg_print_stat, | ||
1547 | }, | 1557 | }, |
1548 | { | 1558 | { |
1549 | .name = "empty_time", | 1559 | .name = "empty_time", |
1550 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1560 | .private = offsetof(struct cfq_group, stats.empty_time), |
1551 | offsetof(struct cfq_group, stats.empty_time)), | 1561 | .read_seq_string = cfqg_print_stat, |
1552 | .read_seq_string = blkcg_print_stat, | ||
1553 | }, | 1562 | }, |
1554 | { | 1563 | { |
1555 | .name = "dequeue", | 1564 | .name = "dequeue", |
1556 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1565 | .private = offsetof(struct cfq_group, stats.dequeue), |
1557 | offsetof(struct cfq_group, stats.dequeue)), | 1566 | .read_seq_string = cfqg_print_stat, |
1558 | .read_seq_string = blkcg_print_stat, | ||
1559 | }, | 1567 | }, |
1560 | { | 1568 | { |
1561 | .name = "unaccounted_time", | 1569 | .name = "unaccounted_time", |
1562 | .private = BLKCG_STAT_PRIV(BLKIO_POLICY_PROP, | 1570 | .private = offsetof(struct cfq_group, stats.unaccounted_time), |
1563 | offsetof(struct cfq_group, stats.unaccounted_time)), | 1571 | .read_seq_string = cfqg_print_stat, |
1564 | .read_seq_string = blkcg_print_stat, | ||
1565 | }, | 1572 | }, |
1566 | #endif /* CONFIG_DEBUG_BLK_CGROUP */ | 1573 | #endif /* CONFIG_DEBUG_BLK_CGROUP */ |
1567 | { } /* terminate */ | 1574 | { } /* terminate */ |