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

From: Gerrit Huizenga
Date: Thu Jun 23 2005 - 01:47:22 EST


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@xxxxxxxxxx>
Signed-Off-By: Gerrit Huizenga <gh@xxxxxxxxxx>

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) {

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/