SolidWallOfCode commented on a change in pull request #6995:
URL: https://github.com/apache/trafficserver/pull/6995#discussion_r454467261



##########
File path: iocore/cache/Cache.cc
##########
@@ -2586,6 +2588,37 @@ cplist_update()
       cp = cp->link.next;
     }
   }
+
+  // Look for (exclusive) spans forced to a specific volume but not yet 
referenced by any volumes in cp_list,
+  // if found then create a new volume. This also makes sure new exclusive 
disk volumes are created first
+  // before any other new volumes to assure proper span free space calculation 
and proper volume block distribution.
+  for (config_vol = config_volumes.cp_queue.head; config_vol; config_vol = 
config_vol->link.next) {
+    if (nullptr == config_vol->cachep) {
+      // Find out if this is a forced volume assigned exclusively to a span 
which was cleared (hence not referenced in cp_list).
+      // Note: non-exclusive cleared spans are not handled here, only the 
"exclusive"
+      for (int d_no = 0; d_no < gndisks; d_no++) {
+        if (gdisks[d_no]->forced_volume_num == config_vol->number) {
+          CacheVol *new_cp = new CacheVol();
+          if (nullptr != new_cp) {
+            new_cp->disk_vols = (DiskVol **)ats_malloc(gndisks * 
sizeof(DiskVol *));

Review comment:
       No C-style casts. Because it's a `void *`, `static_cast` should work. 
You could try
   ```
   new_cp->disk_vols = 
static_cast<decltype(new_cp->disk_vols)>(ats_malloc(...));
   ```
   to be extra fancy :-P




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to