MCPcopy Create free account
hub / github.com/apache/trafficserver / cplist_init

Function cplist_init

src/iocore/cache/CacheProcessor.cc:1061–1098  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1059}
1060
1061void
1062cplist_init()
1063{
1064 cp_list_len = 0;
1065 for (int i = 0; i < gndisks; i++) {
1066 CacheDisk *d = gdisks[i];
1067 ink_assert(d != nullptr);
1068 DiskStripe **dp = d->disk_stripes;
1069 for (unsigned int j = 0; j < d->header->num_volumes; j++) {
1070 ink_assert(dp[j]->dpb_queue.head);
1071 CacheVol *p = cp_list.head;
1072 while (p) {
1073 if (p->vol_number == dp[j]->vol_number) {
1074 ink_assert(p->scheme == static_cast<int>(dp[j]->dpb_queue.head->b->type));
1075 p->size += dp[j]->size;
1076 p->num_vols += dp[j]->num_volblocks;
1077 p->disk_stripes[i] = dp[j];
1078 break;
1079 }
1080 p = p->link.next;
1081 }
1082 if (!p) {
1083 // did not find a volume in the cache vol list...create
1084 // a new one
1085 CacheVol *new_p = new CacheVol();
1086 new_p->vol_number = dp[j]->vol_number;
1087 new_p->num_vols = dp[j]->num_volblocks;
1088 new_p->size = dp[j]->size;
1089 new_p->scheme = dp[j]->dpb_queue.head->b->type;
1090 new_p->disk_stripes = static_cast<DiskStripe **>(ats_malloc(gndisks * sizeof(DiskStripe *)));
1091 memset(new_p->disk_stripes, 0, gndisks * sizeof(DiskStripe *));
1092 new_p->disk_stripes[i] = dp[j];
1093 cp_list.enqueue(new_p);
1094 cp_list_len++;
1095 }
1096 }
1097 }
1098}
1099
1100// Register Stats, this handles both the global cache metrics, as well as the per volume metrics.
1101void

Callers 2

diskInitializedMethod · 0.85
execute_and_verifyFunction · 0.85

Calls 3

ats_mallocFunction · 0.85
memsetFunction · 0.85
enqueueMethod · 0.45

Tested by 1

execute_and_verifyFunction · 0.68