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

Method start_internal

src/iocore/cache/CacheProcessor.cc:174–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174int
175CacheProcessor::start_internal(int flags)
176{
177 start_internal_flags = flags;
178 clear = !!(flags & PROCESSOR_RECONFIGURE) || auto_clear_flag;
179 fix = !!(flags & PROCESSOR_FIX);
180 check = (flags & PROCESSOR_CHECK) != 0;
181 start_done = 0;
182
183 /* Read the config file and create the data structures corresponding to the file. */
184 gndisks = theCacheStore.n_spans;
185 gdisks = static_cast<CacheDisk **>(ats_malloc(gndisks * sizeof(CacheDisk *)));
186
187 // Temporaries to carry values between loops
188 char **paths = static_cast<char **>(alloca(sizeof(char *) * gndisks));
189 memset(paths, 0, sizeof(char *) * gndisks);
190 int *fds = static_cast<int *>(alloca(sizeof(int) * gndisks));
191 memset(fds, 0, sizeof(int) * gndisks);
192 int *sector_sizes = static_cast<int *>(alloca(sizeof(int) * gndisks));
193 memset(sector_sizes, 0, sizeof(int) * gndisks);
194 Span **spans = static_cast<Span **>(alloca(sizeof(Span *) * gndisks));
195 memset(spans, 0, sizeof(Span *) * gndisks);
196
197 gndisks = 0;
198 ink_aio_set_err_callback(new AIO_failure_handler());
199
200 config_volumes.read_config_file();
201
202 /*
203 create CacheDisk objects for each span in the configuration file and store in gdisks
204 */
205 for (unsigned i = 0; i < theCacheStore.n_spans; i++) {
206 Span *span = theCacheStore.spans[i];
207 int opts = DEFAULT_CACHE_OPTIONS;
208
209 if (!paths[gndisks]) {
210 paths[gndisks] = static_cast<char *>(alloca(PATH_NAME_MAX));
211 }
212 ink_strlcpy(paths[gndisks], span->pathname, PATH_NAME_MAX);
213 if (!span->file_pathname) {
214 ink_strlcat(paths[gndisks], "/cache.db", PATH_NAME_MAX);
215 opts |= O_CREAT;
216 }
217
218 // Check if the disk is known to be bad.
219 if (cache_config_persist_bad_disks && !known_bad_disks.empty()) {
220 if (known_bad_disks.find(paths[gndisks]) != known_bad_disks.end()) {
221 Warning("%s is a known bad disk. Skipping.", paths[gndisks]);
222 ts::Metrics::Gauge::increment(cache_rsb.span_offline);
223 continue;
224 }
225 }
226
227#ifdef O_DIRECT
228 opts |= O_DIRECT;
229#endif
230#ifdef O_DSYNC
231 opts |= O_DSYNC;

Callers 2

cmd_check_internalFunction · 0.80
cmd_clearFunction · 0.80

Calls 12

waitForCacheMethod · 0.95
ats_mallocFunction · 0.85
memsetFunction · 0.85
ink_aio_set_err_callbackFunction · 0.85
ink_strlcpyFunction · 0.85
ink_strlcatFunction · 0.85
incrementFunction · 0.85
read_config_fileMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected