[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squid-cvs
Subject:    delay_pool_write squid/src cache_cf.c,1.127.2.3,1.127.2.4 cf.data.pre,1.259.2.6,1.259.2.7 delay_pool
From:       Adrian Chadd <adri () users ! sourceforge ! net>
Date:       2008-07-25 7:22:41
Message-ID: 20080725072248.1925.qmail () squid-cache ! org
[Download RAW message or body]

Update of cvs.devel.squid-cache.org:/cvsroot/squid/squid/src

Modified Files:
      Tag: delay_pool_write
	cache_cf.c cf.data.pre delay_pools.c 
Log Message:
Convert this new pool class to class 6 rather than 5; 5 is also used
in Squid-3.



Index: cf.data.pre
===================================================================
RCS file: /cvsroot/squid/squid/src/cf.data.pre,v
retrieving revision 1.259.2.6
retrieving revision 1.259.2.7
diff -C2 -d -r1.259.2.6 -r1.259.2.7
*** cf.data.pre	24 Jul 2008 16:17:48 -0000	1.259.2.6
--- cf.data.pre	25 Jul 2008 07:22:38 -0000	1.259.2.7
***************
*** 4069,4073 ****
  		class 4		Not yet implemented in Squid-2 - a per-user pool
  
! 		class 5		Squid-2 specific: Everything is limited by a single
  				aggregate bucket as well as an "individual" bucket
  				per-_CLIENT_-connection (whether used on client or
--- 4069,4075 ----
  		class 4		Not yet implemented in Squid-2 - a per-user pool
  
! 		class 5		Not yet implemented in Squid-2 - a per-extacl tag pool
! 
! 		class 6		Squid-2 specific: Everything is limited by a single
  				aggregate bucket as well as an "individual" bucket
  				per-_CLIENT_-connection (whether used on client or

Index: delay_pools.c
===================================================================
RCS file: /cvsroot/squid/squid/src/delay_pools.c,v
retrieving revision 1.21.4.10
retrieving revision 1.21.4.11
diff -C2 -d -r1.21.4.10 -r1.21.4.11
*** delay_pools.c	18 Jul 2008 18:15:09 -0000	1.21.4.10
--- delay_pools.c	25 Jul 2008 07:22:39 -0000	1.21.4.11
***************
*** 83,99 ****
  };
  
! struct _class5DelayPoolFd {
      int fd;		/* just for sanity checking! */
      int aggregate;
      uint64_t aggregate_bytes;
  };  
! typedef struct _class5DelayPoolFd class5DelayPoolFd;
  
! struct _class5DelayPool {
      int class;
      int aggregate;
      uint64_t aggregate_bytes;
      int fds_size;		/* just for sanity checking */
!     class5DelayPoolFd *fds;
  };
  
--- 83,99 ----
  };
  
! struct _class6DelayPoolFd {
      int fd;		/* just for sanity checking! */
      int aggregate;
      uint64_t aggregate_bytes;
  };  
! typedef struct _class6DelayPoolFd class6DelayPoolFd;
  
! struct _class6DelayPool {
      int class;
      int aggregate;
      uint64_t aggregate_bytes;
      int fds_size;		/* just for sanity checking */
!     class6DelayPoolFd *fds;
  };
  
***************
*** 101,105 ****
  typedef struct _class2DelayPool class2DelayPool;
  typedef struct _class3DelayPool class3DelayPool;
! typedef struct _class5DelayPool class5DelayPool;
  
  union _delayPool {
--- 101,105 ----
  typedef struct _class2DelayPool class2DelayPool;
  typedef struct _class3DelayPool class3DelayPool;
! typedef struct _class6DelayPool class6DelayPool;
  
  union _delayPool {
***************
*** 107,111 ****
      class2DelayPool *class2;
      class3DelayPool *class3;
!     class5DelayPool *class5;
  };
  
--- 107,111 ----
      class2DelayPool *class2;
      class3DelayPool *class3;
!     class6DelayPool *class6;
  };
  
***************
*** 198,202 ****
      if (!delay_id_ptr_hash)
  	return;
!     /* XXX we should really ensure that the class5 fds array is cleared! */ 
      safe_free(delay_data);
      memory_used -= pools * sizeof(*delay_data);
--- 198,202 ----
      if (!delay_id_ptr_hash)
  	return;
!     /* XXX we should really ensure that the class6 fds array is cleared! */ 
      safe_free(delay_data);
      memory_used -= pools * sizeof(*delay_data);
***************
*** 259,268 ****
  	memory_used += sizeof(class3DelayPool);
  	break;
!     case 5:
!     	delay_data[pool].class5 = xcalloc(1, sizeof(class5DelayPool));
! 	delay_data[pool].class5->class = 5;
! 	delay_data[pool].class5->fds = xcalloc(Squid_MaxFD, sizeof(class5DelayPoolFd));
! 	delay_data[pool].class5->fds_size = Squid_MaxFD;
! 	memory_used += sizeof(class5DelayPool) + sizeof(class5DelayPoolFd) * Squid_MaxFD;
  	break;
      default:
--- 259,268 ----
  	memory_used += sizeof(class3DelayPool);
  	break;
!     case 6:
!     	delay_data[pool].class6 = xcalloc(1, sizeof(class6DelayPool));
! 	delay_data[pool].class6->class = 5;
! 	delay_data[pool].class6->fds = xcalloc(Squid_MaxFD, sizeof(class6DelayPoolFd));
! 	delay_data[pool].class6->fds_size = Squid_MaxFD;
! 	memory_used += sizeof(class6DelayPool) + sizeof(class6DelayPoolFd) * Squid_MaxFD;
  	break;
      default:
***************
*** 296,302 ****
  	    sizeof(delay_data[pool].class3->individual_255_used));
  	break;
!     case 5:
!         delay_data[pool].class5->aggregate = (((double) rates->aggregate.max_bytes \
                * Config.Delay.initial) / 100);
! 	memset(delay_data[pool].class5->fds, '\0', delay_data[pool].class5->fds_size * \
sizeof(class5DelayPoolFd));  break;
      default:
--- 296,302 ----
  	    sizeof(delay_data[pool].class3->individual_255_used));
  	break;
!     case 6:
!         delay_data[pool].class6->aggregate = (((double) rates->aggregate.max_bytes \
                * Config.Delay.initial) / 100);
! 	memset(delay_data[pool].class6->fds, '\0', delay_data[pool].class6->fds_size * \
sizeof(class6DelayPoolFd));  break;
      default:
***************
*** 319,325 ****
  	memory_used -= sizeof(class3DelayPool);
  	break;
!     case 5:
!         memory_used -= sizeof(class5DelayPool) + sizeof(class5DelayPoolFd) * \
                delay_data[pool].class5->fds_size;
! 	safe_free(delay_data[pool].class5->fds);
      default:
  	debug(77, 1) ("delayFreeDelayPool: bad class %d\n",
--- 319,325 ----
  	memory_used -= sizeof(class3DelayPool);
  	break;
!     case 6:
!         memory_used -= sizeof(class6DelayPool) + sizeof(class6DelayPoolFd) * \
                delay_data[pool].class6->fds_size;
! 	safe_free(delay_data[pool].class6->fds);
      default:
  	debug(77, 1) ("delayFreeDelayPool: bad class %d\n",
***************
*** 530,535 ****
      }
  
!     /* class 5 delay pool - position is the fd number which we may not yet have! */
!     if (class == 5) {
  	if (fd < 0) {
  		debug(1, 1) ("delayClientClient: class 5 delay pool doesn't yet have access to \
                the FD?!\n");
--- 530,535 ----
      }
  
!     /* class 6 delay pool - position is the fd number which we may not yet have! */
!     if (class == 6) {
  	if (fd < 0) {
  		debug(1, 1) ("delayClientClient: class 5 delay pool doesn't yet have access to \
                the FD?!\n");
***************
*** 537,543 ****
  	}
  
! 	assert(fd < delay_data[pool].class5->fds_size);
  	position = fd;
! 	delay_data[pool].class5->fds[position].aggregate =
  	  (int) (((double) Config.Delay.rates[pool]->individual.max_bytes * \
Config.Delay.initial) / 100);  delay_class_5_fds[fd] = pool + 1;
--- 537,543 ----
  	}
  
! 	assert(fd < delay_data[pool].class6->fds_size);
  	position = fd;
! 	delay_data[pool].class6->fds[position].aggregate =
  	  (int) (((double) Config.Delay.rates[pool]->individual.max_bytes * \
Config.Delay.initial) / 100);  delay_class_5_fds[fd] = pool + 1;
***************
*** 563,567 ****
  
  static void
! delayUpdateClass5(class5DelayPool *class5, char pool, delaySpecSet * rates, int \
incr)  {
      int restore_bytes;
--- 563,567 ----
  
  static void
! delayUpdateClass5(class6DelayPool *class6, char pool, delaySpecSet * rates, int \
incr)  {
      int restore_bytes;
***************
*** 569,575 ****
  
      if (rates->aggregate.restore_bps != -1 &&
! 	(class5->aggregate += rates->aggregate.restore_bps * incr) >
  	rates->aggregate.max_bytes)
! 	class5->aggregate = rates->aggregate.max_bytes;
      if ((restore_bytes = rates->individual.restore_bps) == -1)
  	return;
--- 569,575 ----
  
      if (rates->aggregate.restore_bps != -1 &&
! 	(class6->aggregate += rates->aggregate.restore_bps * incr) >
  	rates->aggregate.max_bytes)
! 	class6->aggregate = rates->aggregate.max_bytes;
      if ((restore_bytes = rates->individual.restore_bps) == -1)
  	return;
***************
*** 577,587 ****
  
      /* Update per-FD allowances */
!     assert(Biggest_FD < class5->fds_size);	
      for (fd = 0; fd < Biggest_FD; fd++) {
  	if (delay_class_5_fds[fd] != (pool + 1))
  		continue;
!         class5->fds[fd].aggregate += restore_bytes;
!         if (class5->fds[fd].aggregate > rates->individual.max_bytes)
! 	    class5->fds[fd].aggregate = rates->individual.max_bytes;
      }
  }
--- 577,587 ----
  
      /* Update per-FD allowances */
!     assert(Biggest_FD < class6->fds_size);	
      for (fd = 0; fd < Biggest_FD; fd++) {
  	if (delay_class_5_fds[fd] != (pool + 1))
  		continue;
!         class6->fds[fd].aggregate += restore_bytes;
!         if (class6->fds[fd].aggregate > rates->individual.max_bytes)
! 	    class6->fds[fd].aggregate = rates->individual.max_bytes;
      }
  }
***************
*** 707,712 ****
  	    delayUpdateClass3(delay_data[i].class3, i, Config.Delay.rates[i], incr);
  	    break;
!         case 5:
! 	    delayUpdateClass5(delay_data[i].class5, i, Config.Delay.rates[i], incr);
  	    break;
  	default:
--- 707,712 ----
  	    delayUpdateClass3(delay_data[i].class3, i, Config.Delay.rates[i], incr);
  	    break;
!         case 6:
! 	    delayUpdateClass5(delay_data[i].class6, i, Config.Delay.rates[i], incr);
  	    break;
  	default:
***************
*** 753,762 ****
  	break;
  
!     case 5:
          if (Config.Delay.rates[pool]->aggregate.restore_bps != -1)
  	    nbytes = XMIN(nbytes, delay_data[pool].class3->aggregate);
! 	assert(position < delay_data[pool].class5->fds_size);
  	if (Config.Delay.rates[pool]->individual.restore_bps != -1)
! 	    nbytes = XMIN(nbytes, delay_data[pool].class5->fds[position].aggregate);
          break;
      default:
--- 753,762 ----
  	break;
  
!     case 6:
          if (Config.Delay.rates[pool]->aggregate.restore_bps != -1)
  	    nbytes = XMIN(nbytes, delay_data[pool].class3->aggregate);
! 	assert(position < delay_data[pool].class6->fds_size);
  	if (Config.Delay.rates[pool]->individual.restore_bps != -1)
! 	    nbytes = XMIN(nbytes, delay_data[pool].class6->fds[position].aggregate);
          break;
      default:
***************
*** 806,813 ****
  	return;
  
!     case 5:
!     	delay_data[pool].class5->aggregate -= qty;
! 	assert(position < delay_data[pool].class5->fds_size);
! 	delay_data[pool].class5->fds[position].aggregate -= qty;
  	return;
      }
--- 806,813 ----
  	return;
  
!     case 6:
!     	delay_data[pool].class6->aggregate -= qty;
! 	assert(position < delay_data[pool].class6->fds_size);
! 	delay_data[pool].class6->fds[position].aggregate -= qty;
  	return;
      }
***************
*** 1087,1091 ****
  {
      delaySpecSet *rate = Config.Delay.rates[pool];
!     class5DelayPool *class5 = delay_data[pool].class5;
      int i;
  
--- 1087,1091 ----
  {
      delaySpecSet *rate = Config.Delay.rates[pool];
!     class6DelayPool *class6 = delay_data[pool].class6;
      int i;
  
***************
*** 1094,1098 ****
      else
  	storeAppendPrintf(sentry, "pools.pool.%d.class=5\n", pool + 1);
!     delayPoolStatsAg(sentry, pool, type, rate, class5->aggregate, \
class5->aggregate_bytes);  
      /* Per-FD stats! */
--- 1094,1098 ----
      else
  	storeAppendPrintf(sentry, "pools.pool.%d.class=5\n", pool + 1);
!     delayPoolStatsAg(sentry, pool, type, rate, class6->aggregate, \
class6->aggregate_bytes);  
      /* Per-FD stats! */
***************
*** 1101,1107 ****
  	if (delay_class_5_fds[i] == (pool+1)) {
  		if (type == 1) {
! 			storeAppendPrintf(sentry, "    FD: %d, aggregate %d\n", i, \
class5->fds[i].aggregate);  } else {
! 			storeAppendPrintf(sentry, "pools.pool.%d.fd.%d.aggregate=%d\n", pool + 1, i, \
class5->fds[i].aggregate);  }
          }
--- 1101,1107 ----
  	if (delay_class_5_fds[i] == (pool+1)) {
  		if (type == 1) {
! 			storeAppendPrintf(sentry, "    FD: %d, aggregate %d\n", i, \
class6->fds[i].aggregate);  } else {
! 			storeAppendPrintf(sentry, "pools.pool.%d.fd.%d.aggregate=%d\n", pool + 1, i, \
class6->fds[i].aggregate);  }
          }
***************
*** 1130,1134 ****
  	    delayPoolStats3(sentry, 1, i);
  	    break;
!         case 5:
  	    delayPoolStats5(sentry, 1, i);
  	    break;
--- 1130,1134 ----
  	    delayPoolStats3(sentry, 1, i);
  	    break;
!         case 6:
  	    delayPoolStats5(sentry, 1, i);
  	    break;
***************
*** 1160,1164 ****
  	    delayPoolStats3(e, 2, i);
  	    break;
! 	case 5:
  	    delayPoolStats5(e, 2, i);
  	    break;
--- 1160,1164 ----
  	    delayPoolStats3(e, 2, i);
  	    break;
! 	case 6:
  	    delayPoolStats5(e, 2, i);
  	    break;

Index: cache_cf.c
===================================================================
RCS file: /cvsroot/squid/squid/src/cache_cf.c,v
retrieving revision 1.127.2.3
retrieving revision 1.127.2.4
diff -C2 -d -r1.127.2.3 -r1.127.2.4
*** cache_cf.c	18 Jul 2008 17:59:23 -0000	1.127.2.3
--- cache_cf.c	25 Jul 2008 07:22:38 -0000	1.127.2.4
***************
*** 1030,1034 ****
  		cfg.rates[i]->individual.max_bytes);
  			break;
! 		case 5:
  	    storeAppendPrintf(entry, "delay_parameters %d %d/%d", i + 1,
  		cfg.rates[i]->aggregate.restore_bps,
--- 1030,1034 ----
  		cfg.rates[i]->individual.max_bytes);
  			break;
! 		case 6:
  	    storeAppendPrintf(entry, "delay_parameters %d %d/%d", i + 1,
  		cfg.rates[i]->aggregate.restore_bps,
***************
*** 1074,1083 ****
      }
      parse_ushort(&class);
!     if (class < 1 || class > 5) {
! 	debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d class %d not in 1 .. 5\n", \
pool, class);  return;
      }
!     /* class 4 is per-user, which Squid-3 currently only does */
!     if (class == 4) {
  	debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d class %d currently \
unsupported!\n", pool, class);  return;
--- 1074,1083 ----
      }
      parse_ushort(&class);
!     if (class < 1 || class > 6) {
! 	debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d class %d not in 1 .. 6\n", \
pool, class);  return;
      }
!     /* class 4, 5 is per-user/per-extacl, which Squid-3 currently only does */
!     if (class == 4 || class == 5) {
  	debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d class %d currently \
unsupported!\n", pool, class);  return;
***************
*** 1103,1107 ****
  		cfg->rates[pool]->network.restore_bps = cfg->rates[pool]->network.max_bytes = -1;
  		break;
! 	case 5:
  		cfg->rates[pool]->individual.restore_bps = cfg->rates[pool]->individual.max_bytes \
= -1;  break;
--- 1103,1107 ----
  		cfg->rates[pool]->network.restore_bps = cfg->rates[pool]->network.max_bytes = -1;
  		break;
! 	case 6:
  		cfg->rates[pool]->individual.restore_bps = cfg->rates[pool]->individual.max_bytes \
= -1;  break;
***************
*** 1120,1124 ****
      delaySpec *ptr;
      char *token;
!     int er[] = { -1, 1, 2, 3, -1, 2 };
      int c;
  
--- 1120,1124 ----
      delaySpec *ptr;
      char *token;
!     int er[] = { -1, 1, 2, 3, -1, -1, 2 };
      int c;
  


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic