From: Gerrit Huizenga Increase the share by the new value if previous value was don't care or unchanged. Otherwise use the difference in values as the increase in share. Signed-Off-By: Matt Helsley Signed-Off-By: Gerrit Huizenga Signed-off-by: Andrew Morton --- kernel/ckrm/ckrmutils.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) diff -puN kernel/ckrm/ckrmutils.c~ckrm-fix-share-calculation kernel/ckrm/ckrmutils.c --- 25/kernel/ckrm/ckrmutils.c~ckrm-fix-share-calculation Wed Jul 13 14:44:27 2005 +++ 25-akpm/kernel/ckrm/ckrmutils.c Wed Jul 13 14:44:27 2005 @@ -100,7 +100,12 @@ set_shares(struct ckrm_shares *new, stru { int rc = -EINVAL; int cur_usage_guar = cur->total_guarantee - cur->unused_guarantee; - int increase_by = new->my_guarantee - cur->my_guarantee; + int increase_by; + + if (cur->my_guarantee < 0) /* DONTCARE or UNCHANGED */ + increase_by = new->my_guarantee; + else + increase_by = new->my_guarantee - cur->my_guarantee; /* Check total_guarantee for correctness */ if (new->total_guarantee <= CKRM_SHARE_DONTCARE) { _