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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
Signed-Off-By: Gerrit Huizenga <[email protected]>

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux