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

Method openWriteWriteDone

src/iocore/cache/CacheWrite.cc:483–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483int
484CacheVC::openWriteWriteDone(int event, Event *e)
485{
486 cancel_trigger();
487 if (event == AIO_EVENT_DONE) {
488 set_io_not_in_progress();
489 } else if (is_io_in_progress()) {
490 return EVENT_CONT;
491 }
492 // In the event of VC_EVENT_ERROR, the cont must do an io_close
493 if (!io.ok()) {
494 if (closed) {
495 closed = -1;
496 return die();
497 }
498 SET_HANDLER(&CacheVC::openWriteMain);
499 return calluser(VC_EVENT_ERROR);
500 }
501 {
502 CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding);
503 if (!lock.is_locked()) {
504 VC_LOCK_RETRY_EVENT();
505 }
506 // store the earliest directory. Need to remove the earliest dir
507 // in case the writer aborts.
508 if (!fragment) {
509 ink_assert(key == earliest_key);
510 earliest_dir = dir;
511 } else {
512 // Store the offset only if there is a table.
513 // Currently there is no alt (and thence no table) for non-HTTP.
514 if (alternate.valid()) {
515 alternate.push_frag_offset(write_pos);
516 }
517 }
518 ++fragment;
519 write_pos += write_len;
520 dir_insert(&key, stripe, &dir);
521 DDbg(dbg_ctl_cache_insert, "WriteDone: %X, %X, %d", key.slice32(0), first_key.slice32(0), write_len);
522 blocks = iobufferblock_skip(blocks.get(), &offset, &length, write_len);
523 next_CacheKey(&key, &key);
524 }
525 if (closed) {
526 return die();
527 }
528 SET_HANDLER(&CacheVC::openWriteMain);
529 return openWriteMain(event, e);
530}
531
532static inline int
533target_fragment_size(int target_frag_size)

Callers

nothing calls this directly

Calls 6

dir_insertFunction · 0.85
next_CacheKeyFunction · 0.85
push_frag_offsetMethod · 0.80
okMethod · 0.45
validMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected