diff options
author | Tejun Heo <tj@kernel.org> | 2013-08-08 20:11:24 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-08-08 20:11:24 -0400 |
commit | 182446d087906de40e514573a92a97b203695f71 (patch) | |
tree | 6aee96219c82d0a64b9d389c50666c1ce0ec27ee /block | |
parent | 67f4c36f83455b253445b2cb28ac9a2c4f85d99a (diff) |
cgroup: pass around cgroup_subsys_state instead of cgroup in file methods
cgroup is currently in the process of transitioning to using struct
cgroup_subsys_state * as the primary handle instead of struct cgroup.
Please see the previous commit which converts the subsystem methods
for rationale.
This patch converts all cftype file operations to take @css instead of
@cgroup. cftypes for the cgroup core files don't have their subsytem
pointer set. These will automatically use the dummy_css added by the
previous patch and can be converted the same way.
Most subsystem conversions are straight forwards but there are some
interesting ones.
* freezer: update_if_frozen() is also converted to take @css instead
of @cgroup for consistency. This will make the code look simpler
too once iterators are converted to use css.
* memory/vmpressure: mem_cgroup_from_css() needs to be exported to
vmpressure while mem_cgroup_from_cont() can be made static.
Updated accordingly.
* cpu: cgroup_tg() doesn't have any user left. Removed.
* cpuacct: cgroup_ca() doesn't have any user left. Removed.
* hugetlb: hugetlb_cgroup_form_cgroup() doesn't have any user left.
Removed.
* net_cls: cgrp_cls_state() doesn't have any user left. Removed.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Aristeu Rozanski <aris@redhat.com>
Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-cgroup.c | 6 | ||||
-rw-r--r-- | block/blk-throttle.c | 32 | ||||
-rw-r--r-- | block/cfq-iosched.c | 90 |
3 files changed, 64 insertions, 64 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 34063739745b..f46f3c69179c 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -437,10 +437,10 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl, | |||
437 | return &blkg->rl; | 437 | return &blkg->rl; |
438 | } | 438 | } |
439 | 439 | ||
440 | static int blkcg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, | 440 | static int blkcg_reset_stats(struct cgroup_subsys_state *css, |
441 | u64 val) | 441 | struct cftype *cftype, u64 val) |
442 | { | 442 | { |
443 | struct blkcg *blkcg = cgroup_to_blkcg(cgroup); | 443 | struct blkcg *blkcg = css_to_blkcg(css); |
444 | struct blkcg_gq *blkg; | 444 | struct blkcg_gq *blkg; |
445 | int i; | 445 | int i; |
446 | 446 | ||
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 08a32dfd3844..88bcfb651b0b 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -1293,10 +1293,10 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf, | |||
1293 | return __blkg_prfill_rwstat(sf, pd, &rwstat); | 1293 | return __blkg_prfill_rwstat(sf, pd, &rwstat); |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | static int tg_print_cpu_rwstat(struct cgroup *cgrp, struct cftype *cft, | 1296 | static int tg_print_cpu_rwstat(struct cgroup_subsys_state *css, |
1297 | struct seq_file *sf) | 1297 | struct cftype *cft, struct seq_file *sf) |
1298 | { | 1298 | { |
1299 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1299 | struct blkcg *blkcg = css_to_blkcg(css); |
1300 | 1300 | ||
1301 | blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkcg_policy_throtl, | 1301 | blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkcg_policy_throtl, |
1302 | cft->private, true); | 1302 | cft->private, true); |
@@ -1325,26 +1325,26 @@ static u64 tg_prfill_conf_uint(struct seq_file *sf, struct blkg_policy_data *pd, | |||
1325 | return __blkg_prfill_u64(sf, pd, v); | 1325 | return __blkg_prfill_u64(sf, pd, v); |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | static int tg_print_conf_u64(struct cgroup *cgrp, struct cftype *cft, | 1328 | static int tg_print_conf_u64(struct cgroup_subsys_state *css, |
1329 | struct seq_file *sf) | 1329 | struct cftype *cft, struct seq_file *sf) |
1330 | { | 1330 | { |
1331 | blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), tg_prfill_conf_u64, | 1331 | blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_u64, |
1332 | &blkcg_policy_throtl, cft->private, false); | 1332 | &blkcg_policy_throtl, cft->private, false); |
1333 | return 0; | 1333 | return 0; |
1334 | } | 1334 | } |
1335 | 1335 | ||
1336 | static int tg_print_conf_uint(struct cgroup *cgrp, struct cftype *cft, | 1336 | static int tg_print_conf_uint(struct cgroup_subsys_state *css, |
1337 | struct seq_file *sf) | 1337 | struct cftype *cft, struct seq_file *sf) |
1338 | { | 1338 | { |
1339 | blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), tg_prfill_conf_uint, | 1339 | blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_uint, |
1340 | &blkcg_policy_throtl, cft->private, false); | 1340 | &blkcg_policy_throtl, cft->private, false); |
1341 | return 0; | 1341 | return 0; |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | static int tg_set_conf(struct cgroup *cgrp, struct cftype *cft, const char *buf, | 1344 | static int tg_set_conf(struct cgroup_subsys_state *css, struct cftype *cft, |
1345 | bool is_u64) | 1345 | const char *buf, bool is_u64) |
1346 | { | 1346 | { |
1347 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1347 | struct blkcg *blkcg = css_to_blkcg(css); |
1348 | struct blkg_conf_ctx ctx; | 1348 | struct blkg_conf_ctx ctx; |
1349 | struct throtl_grp *tg; | 1349 | struct throtl_grp *tg; |
1350 | struct throtl_service_queue *sq; | 1350 | struct throtl_service_queue *sq; |
@@ -1403,16 +1403,16 @@ static int tg_set_conf(struct cgroup *cgrp, struct cftype *cft, const char *buf, | |||
1403 | return 0; | 1403 | return 0; |
1404 | } | 1404 | } |
1405 | 1405 | ||
1406 | static int tg_set_conf_u64(struct cgroup *cgrp, struct cftype *cft, | 1406 | static int tg_set_conf_u64(struct cgroup_subsys_state *css, struct cftype *cft, |
1407 | const char *buf) | 1407 | const char *buf) |
1408 | { | 1408 | { |
1409 | return tg_set_conf(cgrp, cft, buf, true); | 1409 | return tg_set_conf(css, cft, buf, true); |
1410 | } | 1410 | } |
1411 | 1411 | ||
1412 | static int tg_set_conf_uint(struct cgroup *cgrp, struct cftype *cft, | 1412 | static int tg_set_conf_uint(struct cgroup_subsys_state *css, struct cftype *cft, |
1413 | const char *buf) | 1413 | const char *buf) |
1414 | { | 1414 | { |
1415 | return tg_set_conf(cgrp, cft, buf, false); | 1415 | return tg_set_conf(css, cft, buf, false); |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | static struct cftype throtl_files[] = { | 1418 | static struct cftype throtl_files[] = { |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index d5bbdcfd0dab..dabb9d02cf9a 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1607,12 +1607,11 @@ static u64 cfqg_prfill_weight_device(struct seq_file *sf, | |||
1607 | return __blkg_prfill_u64(sf, pd, cfqg->dev_weight); | 1607 | return __blkg_prfill_u64(sf, pd, cfqg->dev_weight); |
1608 | } | 1608 | } |
1609 | 1609 | ||
1610 | static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft, | 1610 | static int cfqg_print_weight_device(struct cgroup_subsys_state *css, |
1611 | struct seq_file *sf) | 1611 | struct cftype *cft, struct seq_file *sf) |
1612 | { | 1612 | { |
1613 | blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), | 1613 | blkcg_print_blkgs(sf, css_to_blkcg(css), cfqg_prfill_weight_device, |
1614 | cfqg_prfill_weight_device, &blkcg_policy_cfq, 0, | 1614 | &blkcg_policy_cfq, 0, false); |
1615 | false); | ||
1616 | return 0; | 1615 | return 0; |
1617 | } | 1616 | } |
1618 | 1617 | ||
@@ -1626,35 +1625,34 @@ static u64 cfqg_prfill_leaf_weight_device(struct seq_file *sf, | |||
1626 | return __blkg_prfill_u64(sf, pd, cfqg->dev_leaf_weight); | 1625 | return __blkg_prfill_u64(sf, pd, cfqg->dev_leaf_weight); |
1627 | } | 1626 | } |
1628 | 1627 | ||
1629 | static int cfqg_print_leaf_weight_device(struct cgroup *cgrp, | 1628 | static int cfqg_print_leaf_weight_device(struct cgroup_subsys_state *css, |
1630 | struct cftype *cft, | 1629 | struct cftype *cft, |
1631 | struct seq_file *sf) | 1630 | struct seq_file *sf) |
1632 | { | 1631 | { |
1633 | blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), | 1632 | blkcg_print_blkgs(sf, css_to_blkcg(css), cfqg_prfill_leaf_weight_device, |
1634 | cfqg_prfill_leaf_weight_device, &blkcg_policy_cfq, 0, | 1633 | &blkcg_policy_cfq, 0, false); |
1635 | false); | ||
1636 | return 0; | 1634 | return 0; |
1637 | } | 1635 | } |
1638 | 1636 | ||
1639 | static int cfq_print_weight(struct cgroup *cgrp, struct cftype *cft, | 1637 | static int cfq_print_weight(struct cgroup_subsys_state *css, struct cftype *cft, |
1640 | struct seq_file *sf) | 1638 | struct seq_file *sf) |
1641 | { | 1639 | { |
1642 | seq_printf(sf, "%u\n", cgroup_to_blkcg(cgrp)->cfq_weight); | 1640 | seq_printf(sf, "%u\n", css_to_blkcg(css)->cfq_weight); |
1643 | return 0; | 1641 | return 0; |
1644 | } | 1642 | } |
1645 | 1643 | ||
1646 | static int cfq_print_leaf_weight(struct cgroup *cgrp, struct cftype *cft, | 1644 | static int cfq_print_leaf_weight(struct cgroup_subsys_state *css, |
1647 | struct seq_file *sf) | 1645 | struct cftype *cft, struct seq_file *sf) |
1648 | { | 1646 | { |
1649 | seq_printf(sf, "%u\n", | 1647 | seq_printf(sf, "%u\n", css_to_blkcg(css)->cfq_leaf_weight); |
1650 | cgroup_to_blkcg(cgrp)->cfq_leaf_weight); | ||
1651 | return 0; | 1648 | return 0; |
1652 | } | 1649 | } |
1653 | 1650 | ||
1654 | static int __cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft, | 1651 | static int __cfqg_set_weight_device(struct cgroup_subsys_state *css, |
1655 | const char *buf, bool is_leaf_weight) | 1652 | struct cftype *cft, const char *buf, |
1653 | bool is_leaf_weight) | ||
1656 | { | 1654 | { |
1657 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1655 | struct blkcg *blkcg = css_to_blkcg(css); |
1658 | struct blkg_conf_ctx ctx; | 1656 | struct blkg_conf_ctx ctx; |
1659 | struct cfq_group *cfqg; | 1657 | struct cfq_group *cfqg; |
1660 | int ret; | 1658 | int ret; |
@@ -1680,22 +1678,22 @@ static int __cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft, | |||
1680 | return ret; | 1678 | return ret; |
1681 | } | 1679 | } |
1682 | 1680 | ||
1683 | static int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft, | 1681 | static int cfqg_set_weight_device(struct cgroup_subsys_state *css, |
1684 | const char *buf) | 1682 | struct cftype *cft, const char *buf) |
1685 | { | 1683 | { |
1686 | return __cfqg_set_weight_device(cgrp, cft, buf, false); | 1684 | return __cfqg_set_weight_device(css, cft, buf, false); |
1687 | } | 1685 | } |
1688 | 1686 | ||
1689 | static int cfqg_set_leaf_weight_device(struct cgroup *cgrp, struct cftype *cft, | 1687 | static int cfqg_set_leaf_weight_device(struct cgroup_subsys_state *css, |
1690 | const char *buf) | 1688 | struct cftype *cft, const char *buf) |
1691 | { | 1689 | { |
1692 | return __cfqg_set_weight_device(cgrp, cft, buf, true); | 1690 | return __cfqg_set_weight_device(css, cft, buf, true); |
1693 | } | 1691 | } |
1694 | 1692 | ||
1695 | static int __cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val, | 1693 | static int __cfq_set_weight(struct cgroup_subsys_state *css, struct cftype *cft, |
1696 | bool is_leaf_weight) | 1694 | u64 val, bool is_leaf_weight) |
1697 | { | 1695 | { |
1698 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1696 | struct blkcg *blkcg = css_to_blkcg(css); |
1699 | struct blkcg_gq *blkg; | 1697 | struct blkcg_gq *blkg; |
1700 | 1698 | ||
1701 | if (val < CFQ_WEIGHT_MIN || val > CFQ_WEIGHT_MAX) | 1699 | if (val < CFQ_WEIGHT_MIN || val > CFQ_WEIGHT_MAX) |
@@ -1727,30 +1725,32 @@ static int __cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val, | |||
1727 | return 0; | 1725 | return 0; |
1728 | } | 1726 | } |
1729 | 1727 | ||
1730 | static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val) | 1728 | static int cfq_set_weight(struct cgroup_subsys_state *css, struct cftype *cft, |
1729 | u64 val) | ||
1731 | { | 1730 | { |
1732 | return __cfq_set_weight(cgrp, cft, val, false); | 1731 | return __cfq_set_weight(css, cft, val, false); |
1733 | } | 1732 | } |
1734 | 1733 | ||
1735 | static int cfq_set_leaf_weight(struct cgroup *cgrp, struct cftype *cft, u64 val) | 1734 | static int cfq_set_leaf_weight(struct cgroup_subsys_state *css, |
1735 | struct cftype *cft, u64 val) | ||
1736 | { | 1736 | { |
1737 | return __cfq_set_weight(cgrp, cft, val, true); | 1737 | return __cfq_set_weight(css, cft, val, true); |
1738 | } | 1738 | } |
1739 | 1739 | ||
1740 | static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft, | 1740 | static int cfqg_print_stat(struct cgroup_subsys_state *css, struct cftype *cft, |
1741 | struct seq_file *sf) | 1741 | struct seq_file *sf) |
1742 | { | 1742 | { |
1743 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1743 | struct blkcg *blkcg = css_to_blkcg(css); |
1744 | 1744 | ||
1745 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkcg_policy_cfq, | 1745 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkcg_policy_cfq, |
1746 | cft->private, false); | 1746 | cft->private, false); |
1747 | return 0; | 1747 | return 0; |
1748 | } | 1748 | } |
1749 | 1749 | ||
1750 | static int cfqg_print_rwstat(struct cgroup *cgrp, struct cftype *cft, | 1750 | static int cfqg_print_rwstat(struct cgroup_subsys_state *css, |
1751 | struct seq_file *sf) | 1751 | struct cftype *cft, struct seq_file *sf) |
1752 | { | 1752 | { |
1753 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1753 | struct blkcg *blkcg = css_to_blkcg(css); |
1754 | 1754 | ||
1755 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkcg_policy_cfq, | 1755 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkcg_policy_cfq, |
1756 | cft->private, true); | 1756 | cft->private, true); |
@@ -1773,20 +1773,20 @@ static u64 cfqg_prfill_rwstat_recursive(struct seq_file *sf, | |||
1773 | return __blkg_prfill_rwstat(sf, pd, &sum); | 1773 | return __blkg_prfill_rwstat(sf, pd, &sum); |
1774 | } | 1774 | } |
1775 | 1775 | ||
1776 | static int cfqg_print_stat_recursive(struct cgroup *cgrp, struct cftype *cft, | 1776 | static int cfqg_print_stat_recursive(struct cgroup_subsys_state *css, |
1777 | struct seq_file *sf) | 1777 | struct cftype *cft, struct seq_file *sf) |
1778 | { | 1778 | { |
1779 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1779 | struct blkcg *blkcg = css_to_blkcg(css); |
1780 | 1780 | ||
1781 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_stat_recursive, | 1781 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_stat_recursive, |
1782 | &blkcg_policy_cfq, cft->private, false); | 1782 | &blkcg_policy_cfq, cft->private, false); |
1783 | return 0; | 1783 | return 0; |
1784 | } | 1784 | } |
1785 | 1785 | ||
1786 | static int cfqg_print_rwstat_recursive(struct cgroup *cgrp, struct cftype *cft, | 1786 | static int cfqg_print_rwstat_recursive(struct cgroup_subsys_state *css, |
1787 | struct seq_file *sf) | 1787 | struct cftype *cft, struct seq_file *sf) |
1788 | { | 1788 | { |
1789 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1789 | struct blkcg *blkcg = css_to_blkcg(css); |
1790 | 1790 | ||
1791 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_rwstat_recursive, | 1791 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_rwstat_recursive, |
1792 | &blkcg_policy_cfq, cft->private, true); | 1792 | &blkcg_policy_cfq, cft->private, true); |
@@ -1810,10 +1810,10 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, | |||
1810 | } | 1810 | } |
1811 | 1811 | ||
1812 | /* print avg_queue_size */ | 1812 | /* print avg_queue_size */ |
1813 | static int cfqg_print_avg_queue_size(struct cgroup *cgrp, struct cftype *cft, | 1813 | static int cfqg_print_avg_queue_size(struct cgroup_subsys_state *css, |
1814 | struct seq_file *sf) | 1814 | struct cftype *cft, struct seq_file *sf) |
1815 | { | 1815 | { |
1816 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1816 | struct blkcg *blkcg = css_to_blkcg(css); |
1817 | 1817 | ||
1818 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, | 1818 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, |
1819 | &blkcg_policy_cfq, 0, false); | 1819 | &blkcg_policy_cfq, 0, false); |