On Wed, Mar 3, 2010 at 3:19 PM, Nauman Rafique <nauman@google.com> wrote:
I agree with Vivek here, and his reasoning below. This becomes more
important as more attributes are added.
Agreed. I'd like to add that since we are already thinking about
expanding the policy with more attributes, perhaps
blkio_update_group_weight_fn in blkio_policy_ops should be renamed to
blkio_policy_updated_fn. Then it could be called if the user changed
any part of the policy. Further, instead of storing "weight" in
blkio_cgroup, we could store a blkio_policy_node there instead. Then
the handling of whole-cgroup and per-block-device policy items could
be more regular.
Some quick code comments:
policy_parse_and_set() could be simplified with scanf, like:
if (sscanf(buf, "%d:%d %d", &major, &minor, &temp) != 3)
return -EINVAL;
blkcg_get_weight() might better be blkcg_get_policy() and it could
return a per-disk policy node, or fall back to the cgroup policy if
none existed for this dev. This would be across policy attributes,
rather than just weight.
Thanks,
Chad
--