aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-12-05 12:28:04 -0500
committerTejun Heo <tj@kernel.org>2013-12-05 12:28:04 -0500
commit2da8ca822d49c8b8781800ad155aaa00e7bb5f1a (patch)
tree9ec6b0a7a009d76d0c607640eae64d3e9ed666a9 /block/cfq-iosched.c
parent7da112792753d71aed44b918395892a1fc53048a (diff)
cgroup: replace cftype->read_seq_string() with cftype->seq_show()
In preparation of conversion to kernfs, cgroup file handling is updated so that it can be easily mapped to kernfs. This patch replaces cftype->read_seq_string() with cftype->seq_show() which is not limited to single_open() operation and will map directcly to kernfs seq_file interface. The conversions are mechanical. As ->seq_show() doesn't have @css and @cft, the functions which make use of them are converted to use seq_css() and seq_cft() respectively. In several occassions, e.f. if it has seq_string in its name, the function name is updated to fit the new method better. This patch does not introduce any behavior changes. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Aristeu Rozanski <arozansk@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Michal Hocko <mhocko@suse.cz> Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Acked-by: Li Zefan <lizefan@huawei.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Balbir Singh <bsingharora@gmail.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Neil Horman <nhorman@tuxdriver.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c131
1 files changed, 58 insertions, 73 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 4d5cec1ad80d..744833b630c6 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1632,11 +1632,11 @@ static u64 cfqg_prfill_weight_device(struct seq_file *sf,
1632 return __blkg_prfill_u64(sf, pd, cfqg->dev_weight); 1632 return __blkg_prfill_u64(sf, pd, cfqg->dev_weight);
1633} 1633}
1634 1634
1635static int cfqg_print_weight_device(struct cgroup_subsys_state *css, 1635static int cfqg_print_weight_device(struct seq_file *sf, void *v)
1636 struct cftype *cft, struct seq_file *sf)
1637{ 1636{
1638 blkcg_print_blkgs(sf, css_to_blkcg(css), cfqg_prfill_weight_device, 1637 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)),
1639 &blkcg_policy_cfq, 0, false); 1638 cfqg_prfill_weight_device, &blkcg_policy_cfq,
1639 0, false);
1640 return 0; 1640 return 0;
1641} 1641}
1642 1642
@@ -1650,26 +1650,23 @@ static u64 cfqg_prfill_leaf_weight_device(struct seq_file *sf,
1650 return __blkg_prfill_u64(sf, pd, cfqg->dev_leaf_weight); 1650 return __blkg_prfill_u64(sf, pd, cfqg->dev_leaf_weight);
1651} 1651}
1652 1652
1653static int cfqg_print_leaf_weight_device(struct cgroup_subsys_state *css, 1653static int cfqg_print_leaf_weight_device(struct seq_file *sf, void *v)
1654 struct cftype *cft,
1655 struct seq_file *sf)
1656{ 1654{
1657 blkcg_print_blkgs(sf, css_to_blkcg(css), cfqg_prfill_leaf_weight_device, 1655 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)),
1658 &blkcg_policy_cfq, 0, false); 1656 cfqg_prfill_leaf_weight_device, &blkcg_policy_cfq,
1657 0, false);
1659 return 0; 1658 return 0;
1660} 1659}
1661 1660
1662static int cfq_print_weight(struct cgroup_subsys_state *css, struct cftype *cft, 1661static int cfq_print_weight(struct seq_file *sf, void *v)
1663 struct seq_file *sf)
1664{ 1662{
1665 seq_printf(sf, "%u\n", css_to_blkcg(css)->cfq_weight); 1663 seq_printf(sf, "%u\n", css_to_blkcg(seq_css(sf))->cfq_weight);
1666 return 0; 1664 return 0;
1667} 1665}
1668 1666
1669static int cfq_print_leaf_weight(struct cgroup_subsys_state *css, 1667static int cfq_print_leaf_weight(struct seq_file *sf, void *v)
1670 struct cftype *cft, struct seq_file *sf)
1671{ 1668{
1672 seq_printf(sf, "%u\n", css_to_blkcg(css)->cfq_leaf_weight); 1669 seq_printf(sf, "%u\n", css_to_blkcg(seq_css(sf))->cfq_leaf_weight);
1673 return 0; 1670 return 0;
1674} 1671}
1675 1672
@@ -1762,23 +1759,17 @@ static int cfq_set_leaf_weight(struct cgroup_subsys_state *css,
1762 return __cfq_set_weight(css, cft, val, true); 1759 return __cfq_set_weight(css, cft, val, true);
1763} 1760}
1764 1761
1765static int cfqg_print_stat(struct cgroup_subsys_state *css, struct cftype *cft, 1762static int cfqg_print_stat(struct seq_file *sf, void *v)
1766 struct seq_file *sf)
1767{ 1763{
1768 struct blkcg *blkcg = css_to_blkcg(css); 1764 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_stat,
1769 1765 &blkcg_policy_cfq, seq_cft(sf)->private, false);
1770 blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkcg_policy_cfq,
1771 cft->private, false);
1772 return 0; 1766 return 0;
1773} 1767}
1774 1768
1775static int cfqg_print_rwstat(struct cgroup_subsys_state *css, 1769static int cfqg_print_rwstat(struct seq_file *sf, void *v)
1776 struct cftype *cft, struct seq_file *sf)
1777{ 1770{
1778 struct blkcg *blkcg = css_to_blkcg(css); 1771 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_rwstat,
1779 1772 &blkcg_policy_cfq, seq_cft(sf)->private, true);
1780 blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkcg_policy_cfq,
1781 cft->private, true);
1782 return 0; 1773 return 0;
1783} 1774}
1784 1775
@@ -1798,23 +1789,19 @@ static u64 cfqg_prfill_rwstat_recursive(struct seq_file *sf,
1798 return __blkg_prfill_rwstat(sf, pd, &sum); 1789 return __blkg_prfill_rwstat(sf, pd, &sum);
1799} 1790}
1800 1791
1801static int cfqg_print_stat_recursive(struct cgroup_subsys_state *css, 1792static int cfqg_print_stat_recursive(struct seq_file *sf, void *v)
1802 struct cftype *cft, struct seq_file *sf)
1803{ 1793{
1804 struct blkcg *blkcg = css_to_blkcg(css); 1794 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)),
1805 1795 cfqg_prfill_stat_recursive, &blkcg_policy_cfq,
1806 blkcg_print_blkgs(sf, blkcg, cfqg_prfill_stat_recursive, 1796 seq_cft(sf)->private, false);
1807 &blkcg_policy_cfq, cft->private, false);
1808 return 0; 1797 return 0;
1809} 1798}
1810 1799
1811static int cfqg_print_rwstat_recursive(struct cgroup_subsys_state *css, 1800static int cfqg_print_rwstat_recursive(struct seq_file *sf, void *v)
1812 struct cftype *cft, struct seq_file *sf)
1813{ 1801{
1814 struct blkcg *blkcg = css_to_blkcg(css); 1802 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)),
1815 1803 cfqg_prfill_rwstat_recursive, &blkcg_policy_cfq,
1816 blkcg_print_blkgs(sf, blkcg, cfqg_prfill_rwstat_recursive, 1804 seq_cft(sf)->private, true);
1817 &blkcg_policy_cfq, cft->private, true);
1818 return 0; 1805 return 0;
1819} 1806}
1820 1807
@@ -1835,13 +1822,11 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
1835} 1822}
1836 1823
1837/* print avg_queue_size */ 1824/* print avg_queue_size */
1838static int cfqg_print_avg_queue_size(struct cgroup_subsys_state *css, 1825static int cfqg_print_avg_queue_size(struct seq_file *sf, void *v)
1839 struct cftype *cft, struct seq_file *sf)
1840{ 1826{
1841 struct blkcg *blkcg = css_to_blkcg(css); 1827 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)),
1842 1828 cfqg_prfill_avg_queue_size, &blkcg_policy_cfq,
1843 blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, 1829 0, false);
1844 &blkcg_policy_cfq, 0, false);
1845 return 0; 1830 return 0;
1846} 1831}
1847#endif /* CONFIG_DEBUG_BLK_CGROUP */ 1832#endif /* CONFIG_DEBUG_BLK_CGROUP */
@@ -1851,14 +1836,14 @@ static struct cftype cfq_blkcg_files[] = {
1851 { 1836 {
1852 .name = "weight_device", 1837 .name = "weight_device",
1853 .flags = CFTYPE_ONLY_ON_ROOT, 1838 .flags = CFTYPE_ONLY_ON_ROOT,
1854 .read_seq_string = cfqg_print_leaf_weight_device, 1839 .seq_show = cfqg_print_leaf_weight_device,
1855 .write_string = cfqg_set_leaf_weight_device, 1840 .write_string = cfqg_set_leaf_weight_device,
1856 .max_write_len = 256, 1841 .max_write_len = 256,
1857 }, 1842 },
1858 { 1843 {
1859 .name = "weight", 1844 .name = "weight",
1860 .flags = CFTYPE_ONLY_ON_ROOT, 1845 .flags = CFTYPE_ONLY_ON_ROOT,
1861 .read_seq_string = cfq_print_leaf_weight, 1846 .seq_show = cfq_print_leaf_weight,
1862 .write_u64 = cfq_set_leaf_weight, 1847 .write_u64 = cfq_set_leaf_weight,
1863 }, 1848 },
1864 1849
@@ -1866,26 +1851,26 @@ static struct cftype cfq_blkcg_files[] = {
1866 { 1851 {
1867 .name = "weight_device", 1852 .name = "weight_device",
1868 .flags = CFTYPE_NOT_ON_ROOT, 1853 .flags = CFTYPE_NOT_ON_ROOT,
1869 .read_seq_string = cfqg_print_weight_device, 1854 .seq_show = cfqg_print_weight_device,
1870 .write_string = cfqg_set_weight_device, 1855 .write_string = cfqg_set_weight_device,
1871 .max_write_len = 256, 1856 .max_write_len = 256,
1872 }, 1857 },
1873 { 1858 {
1874 .name = "weight", 1859 .name = "weight",
1875 .flags = CFTYPE_NOT_ON_ROOT, 1860 .flags = CFTYPE_NOT_ON_ROOT,
1876 .read_seq_string = cfq_print_weight, 1861 .seq_show = cfq_print_weight,
1877 .write_u64 = cfq_set_weight, 1862 .write_u64 = cfq_set_weight,
1878 }, 1863 },
1879 1864
1880 { 1865 {
1881 .name = "leaf_weight_device", 1866 .name = "leaf_weight_device",
1882 .read_seq_string = cfqg_print_leaf_weight_device, 1867 .seq_show = cfqg_print_leaf_weight_device,
1883 .write_string = cfqg_set_leaf_weight_device, 1868 .write_string = cfqg_set_leaf_weight_device,
1884 .max_write_len = 256, 1869 .max_write_len = 256,
1885 }, 1870 },
1886 { 1871 {
1887 .name = "leaf_weight", 1872 .name = "leaf_weight",
1888 .read_seq_string = cfq_print_leaf_weight, 1873 .seq_show = cfq_print_leaf_weight,
1889 .write_u64 = cfq_set_leaf_weight, 1874 .write_u64 = cfq_set_leaf_weight,
1890 }, 1875 },
1891 1876
@@ -1893,114 +1878,114 @@ static struct cftype cfq_blkcg_files[] = {
1893 { 1878 {
1894 .name = "time", 1879 .name = "time",
1895 .private = offsetof(struct cfq_group, stats.time), 1880 .private = offsetof(struct cfq_group, stats.time),
1896 .read_seq_string = cfqg_print_stat, 1881 .seq_show = cfqg_print_stat,
1897 }, 1882 },
1898 { 1883 {
1899 .name = "sectors", 1884 .name = "sectors",
1900 .private = offsetof(struct cfq_group, stats.sectors), 1885 .private = offsetof(struct cfq_group, stats.sectors),
1901 .read_seq_string = cfqg_print_stat, 1886 .seq_show = cfqg_print_stat,
1902 }, 1887 },
1903 { 1888 {
1904 .name = "io_service_bytes", 1889 .name = "io_service_bytes",
1905 .private = offsetof(struct cfq_group, stats.service_bytes), 1890 .private = offsetof(struct cfq_group, stats.service_bytes),
1906 .read_seq_string = cfqg_print_rwstat, 1891 .seq_show = cfqg_print_rwstat,
1907 }, 1892 },
1908 { 1893 {
1909 .name = "io_serviced", 1894 .name = "io_serviced",
1910 .private = offsetof(struct cfq_group, stats.serviced), 1895 .private = offsetof(struct cfq_group, stats.serviced),
1911 .read_seq_string = cfqg_print_rwstat, 1896 .seq_show = cfqg_print_rwstat,
1912 }, 1897 },
1913 { 1898 {
1914 .name = "io_service_time", 1899 .name = "io_service_time",
1915 .private = offsetof(struct cfq_group, stats.service_time), 1900 .private = offsetof(struct cfq_group, stats.service_time),
1916 .read_seq_string = cfqg_print_rwstat, 1901 .seq_show = cfqg_print_rwstat,
1917 }, 1902 },
1918 { 1903 {
1919 .name = "io_wait_time", 1904 .name = "io_wait_time",
1920 .private = offsetof(struct cfq_group, stats.wait_time), 1905 .private = offsetof(struct cfq_group, stats.wait_time),
1921 .read_seq_string = cfqg_print_rwstat, 1906 .seq_show = cfqg_print_rwstat,
1922 }, 1907 },
1923 { 1908 {
1924 .name = "io_merged", 1909 .name = "io_merged",
1925 .private = offsetof(struct cfq_group, stats.merged), 1910 .private = offsetof(struct cfq_group, stats.merged),
1926 .read_seq_string = cfqg_print_rwstat, 1911 .seq_show = cfqg_print_rwstat,
1927 }, 1912 },
1928 { 1913 {
1929 .name = "io_queued", 1914 .name = "io_queued",
1930 .private = offsetof(struct cfq_group, stats.queued), 1915 .private = offsetof(struct cfq_group, stats.queued),
1931 .read_seq_string = cfqg_print_rwstat, 1916 .seq_show = cfqg_print_rwstat,
1932 }, 1917 },
1933 1918
1934 /* the same statictics which cover the cfqg and its descendants */ 1919 /* the same statictics which cover the cfqg and its descendants */
1935 { 1920 {
1936 .name = "time_recursive", 1921 .name = "time_recursive",
1937 .private = offsetof(struct cfq_group, stats.time), 1922 .private = offsetof(struct cfq_group, stats.time),
1938 .read_seq_string = cfqg_print_stat_recursive, 1923 .seq_show = cfqg_print_stat_recursive,
1939 }, 1924 },
1940 { 1925 {
1941 .name = "sectors_recursive", 1926 .name = "sectors_recursive",
1942 .private = offsetof(struct cfq_group, stats.sectors), 1927 .private = offsetof(struct cfq_group, stats.sectors),
1943 .read_seq_string = cfqg_print_stat_recursive, 1928 .seq_show = cfqg_print_stat_recursive,
1944 }, 1929 },
1945 { 1930 {
1946 .name = "io_service_bytes_recursive", 1931 .name = "io_service_bytes_recursive",
1947 .private = offsetof(struct cfq_group, stats.service_bytes), 1932 .private = offsetof(struct cfq_group, stats.service_bytes),
1948 .read_seq_string = cfqg_print_rwstat_recursive, 1933 .seq_show = cfqg_print_rwstat_recursive,
1949 }, 1934 },
1950 { 1935 {
1951 .name = "io_serviced_recursive", 1936 .name = "io_serviced_recursive",
1952 .private = offsetof(struct cfq_group, stats.serviced), 1937 .private = offsetof(struct cfq_group, stats.serviced),
1953 .read_seq_string = cfqg_print_rwstat_recursive, 1938 .seq_show = cfqg_print_rwstat_recursive,
1954 }, 1939 },
1955 { 1940 {
1956 .name = "io_service_time_recursive", 1941 .name = "io_service_time_recursive",
1957 .private = offsetof(struct cfq_group, stats.service_time), 1942 .private = offsetof(struct cfq_group, stats.service_time),
1958 .read_seq_string = cfqg_print_rwstat_recursive, 1943 .seq_show = cfqg_print_rwstat_recursive,
1959 }, 1944 },
1960 { 1945 {
1961 .name = "io_wait_time_recursive", 1946 .name = "io_wait_time_recursive",
1962 .private = offsetof(struct cfq_group, stats.wait_time), 1947 .private = offsetof(struct cfq_group, stats.wait_time),
1963 .read_seq_string = cfqg_print_rwstat_recursive, 1948 .seq_show = cfqg_print_rwstat_recursive,
1964 }, 1949 },
1965 { 1950 {
1966 .name = "io_merged_recursive", 1951 .name = "io_merged_recursive",
1967 .private = offsetof(struct cfq_group, stats.merged), 1952 .private = offsetof(struct cfq_group, stats.merged),
1968 .read_seq_string = cfqg_print_rwstat_recursive, 1953 .seq_show = cfqg_print_rwstat_recursive,
1969 }, 1954 },
1970 { 1955 {
1971 .name = "io_queued_recursive", 1956 .name = "io_queued_recursive",
1972 .private = offsetof(struct cfq_group, stats.queued), 1957 .private = offsetof(struct cfq_group, stats.queued),
1973 .read_seq_string = cfqg_print_rwstat_recursive, 1958 .seq_show = cfqg_print_rwstat_recursive,
1974 }, 1959 },
1975#ifdef CONFIG_DEBUG_BLK_CGROUP 1960#ifdef CONFIG_DEBUG_BLK_CGROUP
1976 { 1961 {
1977 .name = "avg_queue_size", 1962 .name = "avg_queue_size",
1978 .read_seq_string = cfqg_print_avg_queue_size, 1963 .seq_show = cfqg_print_avg_queue_size,
1979 }, 1964 },
1980 { 1965 {
1981 .name = "group_wait_time", 1966 .name = "group_wait_time",
1982 .private = offsetof(struct cfq_group, stats.group_wait_time), 1967 .private = offsetof(struct cfq_group, stats.group_wait_time),
1983 .read_seq_string = cfqg_print_stat, 1968 .seq_show = cfqg_print_stat,
1984 }, 1969 },
1985 { 1970 {
1986 .name = "idle_time", 1971 .name = "idle_time",
1987 .private = offsetof(struct cfq_group, stats.idle_time), 1972 .private = offsetof(struct cfq_group, stats.idle_time),
1988 .read_seq_string = cfqg_print_stat, 1973 .seq_show = cfqg_print_stat,
1989 }, 1974 },
1990 { 1975 {
1991 .name = "empty_time", 1976 .name = "empty_time",
1992 .private = offsetof(struct cfq_group, stats.empty_time), 1977 .private = offsetof(struct cfq_group, stats.empty_time),
1993 .read_seq_string = cfqg_print_stat, 1978 .seq_show = cfqg_print_stat,
1994 }, 1979 },
1995 { 1980 {
1996 .name = "dequeue", 1981 .name = "dequeue",
1997 .private = offsetof(struct cfq_group, stats.dequeue), 1982 .private = offsetof(struct cfq_group, stats.dequeue),
1998 .read_seq_string = cfqg_print_stat, 1983 .seq_show = cfqg_print_stat,
1999 }, 1984 },
2000 { 1985 {
2001 .name = "unaccounted_time", 1986 .name = "unaccounted_time",
2002 .private = offsetof(struct cfq_group, stats.unaccounted_time), 1987 .private = offsetof(struct cfq_group, stats.unaccounted_time),
2003 .read_seq_string = cfqg_print_stat, 1988 .seq_show = cfqg_print_stat,
2004 }, 1989 },
2005#endif /* CONFIG_DEBUG_BLK_CGROUP */ 1990#endif /* CONFIG_DEBUG_BLK_CGROUP */
2006 { } /* terminate */ 1991 { } /* terminate */