cgroup: Replace cgroup->ancestor_ids[] with ->ancestors[]
[sfrench/cifs-2.6.git] / include / linux / cgroup.h
index ed53bfe7c46c4738df18744cc45ff6a204721e11..4d143729b2468d0b29084b417efdfaab9f809718 100644 (file)
@@ -574,7 +574,7 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp,
 {
        if (cgrp->root != ancestor->root || cgrp->level < ancestor->level)
                return false;
-       return cgrp->ancestor_ids[ancestor->level] == cgroup_id(ancestor);
+       return cgrp->ancestors[ancestor->level] == ancestor;
 }
 
 /**
@@ -591,11 +591,9 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp,
 static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp,
                                             int ancestor_level)
 {
-       if (cgrp->level < ancestor_level)
+       if (ancestor_level < 0 || ancestor_level > cgrp->level)
                return NULL;
-       while (cgrp && cgrp->level > ancestor_level)
-               cgrp = cgroup_parent(cgrp);
-       return cgrp;
+       return cgrp->ancestors[ancestor_level];
 }
 
 /**