SolidWallOfCode commented on a change in pull request #6995:
URL: https://github.com/apache/trafficserver/pull/6995#discussion_r454469366
##########
File path: iocore/cache/Cache.cc
##########
@@ -2599,20 +2632,32 @@ fillExclusiveDisks(CacheVol *cp)
if (gdisks[i]->forced_volume_num != volume_number) {
continue;
}
- /* The user had created several volumes before - clear the disk
- and create one volume for http */
- for (int j = 0; j < static_cast<int>(gdisks[i]->header->num_volumes); j++)
{
+
+ /* OK, this should be an "exclusive" disk (span). */
+ diskCount++;
+
+ /* There should be a single "forced" volume and no other volumes should
exist on this "exclusive" disk (span) */
+ bool found_nonforced_volumes = false;
+ for (int j = 0; j < (int)gdisks[i]->header->num_volumes; j++) {
if (volume_number != gdisks[i]->disk_vols[j]->vol_number) {
- Note("Clearing Disk: %s", gdisks[i]->path);
- gdisks[i]->delete_all_volumes();
+ found_nonforced_volumes = true;
break;
}
}
- diskCount++;
+
+ if (found_nonforced_volumes) {
+ /* The user had created several volumes before - clear the disk and
create one volume for http */
+ Note("Clearing Disk: %s", gdisks[i]->path);
+ gdisks[i]->delete_all_volumes();
+ } else if (1 == gdisks[i]->header->num_volumes) {
+ /* "Forced" volumes take the whole disk (span) hence nothing more to do
for this span. */
+ continue;
+ }
+
+ /* Now, volumes have been either deleted or did not existing to begin with
so we need to create them. */
Review comment:
"or did not exist to begin with"
----------------------------------------------------------------
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]