Commit 052c3f3a authored by Tejun Heo's avatar Tejun Heo

cgroup: relocate cgroup_[try]get/put()

Relocate cgroup_get(), cgroup_tryget() and cgroup_put() upwards.  This
is pure code reorganization to prepare for future changes.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent ad2ed2b3
...@@ -428,6 +428,22 @@ static inline bool cgroup_is_dead(const struct cgroup *cgrp) ...@@ -428,6 +428,22 @@ static inline bool cgroup_is_dead(const struct cgroup *cgrp)
return !(cgrp->self.flags & CSS_ONLINE); return !(cgrp->self.flags & CSS_ONLINE);
} }
static void cgroup_get(struct cgroup *cgrp)
{
WARN_ON_ONCE(cgroup_is_dead(cgrp));
css_get(&cgrp->self);
}
static bool cgroup_tryget(struct cgroup *cgrp)
{
return css_tryget(&cgrp->self);
}
static void cgroup_put(struct cgroup *cgrp)
{
css_put(&cgrp->self);
}
struct cgroup_subsys_state *of_css(struct kernfs_open_file *of) struct cgroup_subsys_state *of_css(struct kernfs_open_file *of)
{ {
struct cgroup *cgrp = of->kn->parent->priv; struct cgroup *cgrp = of->kn->parent->priv;
...@@ -1177,22 +1193,6 @@ static umode_t cgroup_file_mode(const struct cftype *cft) ...@@ -1177,22 +1193,6 @@ static umode_t cgroup_file_mode(const struct cftype *cft)
return mode; return mode;
} }
static void cgroup_get(struct cgroup *cgrp)
{
WARN_ON_ONCE(cgroup_is_dead(cgrp));
css_get(&cgrp->self);
}
static bool cgroup_tryget(struct cgroup *cgrp)
{
return css_tryget(&cgrp->self);
}
static void cgroup_put(struct cgroup *cgrp)
{
css_put(&cgrp->self);
}
/** /**
* cgroup_calc_child_subsys_mask - calculate child_subsys_mask * cgroup_calc_child_subsys_mask - calculate child_subsys_mask
* @cgrp: the target cgroup * @cgrp: the target cgroup
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment