[patch 22/38] CKRM e18: Fix share calculation

Gerrit Huizenga
2005-06-23T06:42:22Z

[-- Attachment #1: ckrm-utils --]
[-- Type: text/plain, Size: 1032 bytes --]

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 <matthltc@us.ibm.com>
Signed-Off-By: Gerrit Huizenga <gh@us.ibm.com>

Index: linux-2.6.12-ckrm1/kernel/ckrm/ckrmutils.c
===================================================================
--- linux-2.6.12-ckrm1.orig/kernel/ckrm/ckrmutils.c 2005-06-20 15:04:30.000000000 -0700
+++ linux-2.6.12-ckrm1/kernel/ckrm/ckrmutils.c 2005-06-20 15:04:46.000000000 -0700
@@ -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) {

--