提交 5e06ec32 编写于 作者: J Joseph Qi

alinux: fs/writeback: wrap cgroup writeback v1 logic

Wrap cgroup writeback v1 logic to prevent build errors without
CONFIG_CGROUPS or CONFIG_CGROUP_WRITEBACK.
Reported-by: Nkbuild test robot <lkp@intel.com>
Cc: Jiufei Xue <jiufei.xue@linux.alibaba.com>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NCaspar Zhang <caspar@linux.alibaba.com>
上级 6f7afdf3
......@@ -481,6 +481,7 @@ static inline int inode_congested(struct inode *inode, int cong_bits)
return wb_congested(&inode_to_bdi(inode)->wb, cong_bits);
}
#ifdef CONFIG_CGROUPS
static inline void insert_memcg_blkcg_link(struct cgroup_subsys *ss,
struct list_head *tmp_links,
struct css_set *cset)
......@@ -500,6 +501,7 @@ static inline void delete_memcg_blkcg_link(struct cgroup_subsys *ss,
struct cgroup_subsys_state *css)
{
}
#endif
#endif /* CONFIG_CGROUP_WRITEBACK */
......
......@@ -303,6 +303,7 @@ TRACE_EVENT(writeback_bdi_register,
)
);
#ifdef CONFIG_CGROUP_WRITEBACK
TRACE_EVENT(insert_memcg_blkcg_link,
TP_PROTO(struct cgroup_subsys_state *memcg_css,
struct cgroup_subsys_state *blkcg_css,
......@@ -323,6 +324,7 @@ TRACE_EVENT(insert_memcg_blkcg_link,
__entry->memcg_ino, __entry->blkcg_ino, __entry->old_blkcg_ino
)
);
#endif
DECLARE_EVENT_CLASS(wbc_class,
TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
......
......@@ -468,8 +468,12 @@ struct cgroup_subsys_state *mem_cgroup_css_from_page(struct page *page)
memcg = page->mem_cgroup;
#ifdef CONFIG_CGROUP_WRITEBACK
if (!memcg ||
(!cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgwb_v1))
(!cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgwb_v1))
#else
if (!memcg || !cgroup_subsys_on_dfl(memory_cgrp_subsys))
#endif
memcg = root_mem_cgroup;
return &memcg->css;
......@@ -6408,6 +6412,7 @@ static int __init cgroup_memory(char *s)
}
__setup("cgroup.memory=", cgroup_memory);
#ifdef CONFIG_CGROUP_WRITEBACK
bool cgwb_v1 = false;
static int __init enable_cgroup_writeback_v1(char *s)
......@@ -6417,6 +6422,7 @@ static int __init enable_cgroup_writeback_v1(char *s)
return 0;
}
__setup("cgwb_v1", enable_cgroup_writeback_v1);
#endif
/*
* subsys_initcall() for memory controller.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册