JosiahWI commented on code in PR #10739:
URL: https://github.com/apache/trafficserver/pull/10739#discussion_r1384864777


##########
src/iocore/cache/Stripe.cc:
##########
@@ -36,30 +36,6 @@ DbgCtl dbg_ctl_cache_init{"cache_init"};
 // This is the oldest version number that is still usable.
 short int const CACHE_DB_MAJOR_VERSION_COMPATIBLE = 21;
 
-void
-vol_init_data_internal(Stripe *vol)
-{
-  // step1: calculate the number of entries.
-  off_t total_entries = (vol->len - (vol->start - vol->skip)) / 
cache_config_min_average_object_size;
-  // step2: calculate the number of buckets
-  off_t total_buckets = total_entries / DIR_DEPTH;
-  // step3: calculate the number of segments, no segment has more than 16384 
buckets
-  vol->segments = (total_buckets + (((1 << 16) - 1) / DIR_DEPTH)) / ((1 << 16) 
/ DIR_DEPTH);
-  // step4: divide total_buckets into segments on average.
-  vol->buckets = (total_buckets + vol->segments - 1) / vol->segments;
-  // step5: set the start pointer.
-  vol->start = vol->skip + 2 * vol->dirlen();
-}
-
-void
-vol_init_data(Stripe *vol)
-{
-  // iteratively calculate start + buckets
-  vol_init_data_internal(vol);
-  vol_init_data_internal(vol);
-  vol_init_data_internal(vol);

Review Comment:
   It's a manually unwound loop. `vol->start` changes at the end of each 
"iteration" in step 5 and is used in the calculation again in step1. Calling 
the function once is not equivalent to calling it three times.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to