diff --git a/include/iocore/cache/CacheVC.h b/include/iocore/cache/CacheVC.h index ef3be6a9960..84a07609ae7 100644 --- a/include/iocore/cache/CacheVC.h +++ b/include/iocore/cache/CacheVC.h @@ -109,8 +109,8 @@ struct CacheVC : public CacheVConnection { int get_volume_number() const override { - if (vol && vol->cache_vol) { - return vol->cache_vol->vol_number; + if (stripe && stripe->cache_vol) { + return stripe->cache_vol->vol_number; } return -1; @@ -119,8 +119,8 @@ struct CacheVC : public CacheVConnection { const char * get_disk_path() const override { - if (vol && vol->disk) { - return vol->disk->path; + if (stripe && stripe->disk) { + return stripe->disk->path; } return nullptr; @@ -176,7 +176,7 @@ struct CacheVC : public CacheVConnection { int removeEvent(int event, Event *e); - int scanVol(int event, Event *e); + int scanStripe(int event, Event *e); int scanObject(int event, Event *e); int scanUpdateDone(int event, Event *e); int scanOpenWrite(int event, Event *e); @@ -265,7 +265,7 @@ struct CacheVC : public CacheVConnection { uint32_t write_len; // for communicating with agg_copy uint32_t agg_len; // for communicating with aggWrite uint32_t write_serial; // serial of the final write for SYNC - Stripe *vol; + Stripe *stripe; Dir *last_collision; Event *trigger; CacheKey *read_key; @@ -320,7 +320,7 @@ struct CacheVC : public CacheVConnection { }; // BTF optimization used to skip reading stuff in cache partition that doesn't contain any // dir entries. - char *scan_vol_map; + char *scan_stripe_map; // BTF fix to handle objects that overlapped over two different reads, // this is how much we need to back up the buffer to get the start of the overlapping object. off_t scan_fix_buffer_offset; diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc index f6aeb3cc138..d61ecec7481 100644 --- a/src/iocore/cache/Cache.cc +++ b/src/iocore/cache/Cache.cc @@ -1202,7 +1202,7 @@ Cache::lookup(Continuation *cont, const CacheKey *key, CacheFragType type, const c->first_key = c->key = *key; c->frag_type = type; c->f.lookup = 1; - c->vol = stripe; + c->stripe = stripe; c->last_collision = nullptr; if (c->handleEvent(EVENT_INTERVAL, nullptr) == EVENT_CONT) { @@ -1242,7 +1242,7 @@ Cache::remove(Continuation *cont, const CacheKey *key, CacheFragType type, const Metrics::Gauge::increment(cache_rsb.status[c->op_type].active); Metrics::Gauge::increment(stripe->cache_vol->vol_rsb.status[c->op_type].active); c->first_key = c->key = *key; - c->vol = stripe; + c->stripe = stripe; c->dir = result; c->f.remove = 1; diff --git a/src/iocore/cache/CacheDir.cc b/src/iocore/cache/CacheDir.cc index 07d485d1f14..192e632c88f 100644 --- a/src/iocore/cache/CacheDir.cc +++ b/src/iocore/cache/CacheDir.cc @@ -73,7 +73,7 @@ OpenDir::OpenDir() int OpenDir::open_write(CacheVC *cont, int allow_if_writers, int max_writers) { - ink_assert(cont->vol->mutex->thread_holding == this_ethread()); + ink_assert(cont->stripe->mutex->thread_holding == this_ethread()); unsigned int h = cont->first_key.slice32(0); int b = h % OPEN_DIR_BUCKETS; for (OpenDirEntry *d = bucket[b].head; d; d = d->link.next) { @@ -135,7 +135,7 @@ OpenDir::signal_readers(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) int OpenDir::close_write(CacheVC *cont) { - ink_assert(cont->vol->mutex->thread_holding == this_ethread()); + ink_assert(cont->stripe->mutex->thread_holding == this_ethread()); cont->od->writers.remove(cont); cont->od->num_writers--; if (!cont->od->writers.head) { @@ -167,10 +167,10 @@ OpenDir::open_read(const CryptoHash *key) const int OpenDirEntry::wait(CacheVC *cont, int msec) { - ink_assert(cont->vol->mutex->thread_holding == this_ethread()); + ink_assert(cont->stripe->mutex->thread_holding == this_ethread()); cont->f.open_read_timeout = 1; ink_assert(!cont->trigger); - cont->trigger = cont->vol->mutex->thread_holding->schedule_in_local(cont, HRTIME_MSECONDS(msec)); + cont->trigger = cont->stripe->mutex->thread_holding->schedule_in_local(cont, HRTIME_MSECONDS(msec)); readers.push(cont); return EVENT_CONT; } diff --git a/src/iocore/cache/CacheEvacuateDocVC.cc b/src/iocore/cache/CacheEvacuateDocVC.cc index edba3379b9d..6067c2a94f5 100644 --- a/src/iocore/cache/CacheEvacuateDocVC.cc +++ b/src/iocore/cache/CacheEvacuateDocVC.cc @@ -48,14 +48,14 @@ DbgCtl dbg_ctl_cache_evac{"cache_evac"}; int CacheEvacuateDocVC::evacuateDocDone(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) { - ink_assert(this->vol->mutex->thread_holding == this_ethread()); + ink_assert(this->stripe->mutex->thread_holding == this_ethread()); Doc *doc = reinterpret_cast(this->buf->data()); DDbg(dbg_ctl_cache_evac, "evacuateDocDone %X o %d p %d new_o %d new_p %d", (int)key.slice32(0), (int)dir_offset(&this->overwrite_dir), (int)dir_phase(&this->overwrite_dir), (int)dir_offset(&this->dir), (int)dir_phase(&this->dir)); int i = dir_evac_bucket(&this->overwrite_dir); // nasty beeping race condition, need to have the EvacuationBlock here - EvacuationBlock *b = this->vol->evac_bucket_valid(i) ? this->vol->evacuate[i].head : nullptr; + EvacuationBlock *b = this->stripe->evac_bucket_valid(i) ? this->stripe->evacuate[i].head : nullptr; for (; b; b = b->link.next) { if (dir_offset(&b->dir) == dir_offset(&this->overwrite_dir)) { // If the document is single fragment (although not tied to the vector), @@ -80,17 +80,17 @@ CacheEvacuateDocVC::evacuateDocDone(int /* event ATS_UNUSED */, Event * /* e ATS evac->earliest_key.slice32(0)); EvacuationBlock *eblock = nullptr; Dir dir_tmp; - dir_lookaside_probe(&evac->earliest_key, this->vol, &dir_tmp, &eblock); + dir_lookaside_probe(&evac->earliest_key, this->stripe, &dir_tmp, &eblock); if (eblock) { CacheEvacuateDocVC *earliest_evac = eblock->earliest_evacuator; earliest_evac->total_len += doc->data_len(); if (earliest_evac->total_len == earliest_evac->doc_len) { - dir_lookaside_fixup(&evac->earliest_key, this->vol); + dir_lookaside_fixup(&evac->earliest_key, this->stripe); free_CacheVC(earliest_evac); } } } - dir_overwrite(&doc->key, this->vol, &this->dir, &this->overwrite_dir); + dir_overwrite(&doc->key, this->stripe, &this->dir, &this->overwrite_dir); } // if the tag in the overwrite_dir matches the first_key in the // document, then it has to be the vector. We guarantee that @@ -105,15 +105,15 @@ CacheEvacuateDocVC::evacuateDocDone(int /* event ATS_UNUSED */, Event * /* e ATS OpenDirEntry *cod; DDbg(dbg_ctl_cache_evac, "evacuating vector: %X %d", (int)doc->first_key.slice32(0), (int)dir_offset(&this->overwrite_dir)); - if ((cod = this->vol->open_read(&doc->first_key))) { + if ((cod = this->stripe->open_read(&doc->first_key))) { // writer exists DDbg(dbg_ctl_cache_evac, "overwriting the open directory %X %d %d", (int)doc->first_key.slice32(0), (int)dir_offset(&cod->first_dir), (int)dir_offset(&this->dir)); cod->first_dir = this->dir; } - if (dir_overwrite(&doc->first_key, this->vol, &this->dir, &this->overwrite_dir)) { + if (dir_overwrite(&doc->first_key, this->stripe, &this->dir, &this->overwrite_dir)) { int64_t o = dir_offset(&this->overwrite_dir), n = dir_offset(&this->dir); - this->vol->ram_cache->fixup(&doc->first_key, static_cast(o), static_cast(n)); + this->stripe->ram_cache->fixup(&doc->first_key, static_cast(o), static_cast(n)); } } else { DDbg(dbg_ctl_cache_evac, "evacuating earliest: %X %d", (int)doc->key.slice32(0), (int)dir_offset(&this->overwrite_dir)); @@ -122,8 +122,8 @@ CacheEvacuateDocVC::evacuateDocDone(int /* event ATS_UNUSED */, Event * /* e ATS this->total_len += doc->data_len(); this->first_key = doc->first_key; this->earliest_dir = this->dir; - if (dir_probe(&this->first_key, this->vol, &this->dir, &last_collision) > 0) { - dir_lookaside_insert(b, this->vol, &this->earliest_dir); + if (dir_probe(&this->first_key, this->stripe, &this->dir, &last_collision) > 0) { + dir_lookaside_insert(b, this->stripe, &this->earliest_dir); // read the vector SET_HANDLER(&CacheEvacuateDocVC::evacuateReadHead); int ret = do_read_call(&this->first_key); @@ -144,7 +144,7 @@ int CacheEvacuateDocVC::evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) { // The evacuator vc shares the lock with the volition mutex - ink_assert(this->vol->mutex->thread_holding == this_ethread()); + ink_assert(this->stripe->mutex->thread_holding == this_ethread()); cancel_trigger(); Doc *doc = reinterpret_cast(this->buf->data()); CacheHTTPInfo *alternate_tmp = nullptr; @@ -152,7 +152,7 @@ CacheEvacuateDocVC::evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e AT goto Ldone; } // a directory entry which is no longer valid may have been overwritten - if (!dir_valid(this->vol, &this->dir)) { + if (!dir_valid(this->stripe, &this->dir)) { last_collision = nullptr; goto Lcollision; } @@ -188,12 +188,12 @@ CacheEvacuateDocVC::evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e AT if (doc_len == this->total_len) { // the whole document has been evacuated. Insert the directory // entry in the directory. - dir_lookaside_fixup(&earliest_key, this->vol); + dir_lookaside_fixup(&earliest_key, this->stripe); return free_CacheVC(this); } return EVENT_CONT; Lcollision: - if (dir_probe(&this->first_key, this->vol, &this->dir, &last_collision)) { + if (dir_probe(&this->first_key, this->stripe, &this->dir, &last_collision)) { int ret = do_read_call(&this->first_key); if (ret == EVENT_RETURN) { return handleEvent(AIO_EVENT_DONE, nullptr); @@ -201,6 +201,6 @@ CacheEvacuateDocVC::evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e AT return ret; } Ldone: - dir_lookaside_remove(&earliest_key, this->vol); + dir_lookaside_remove(&earliest_key, this->stripe); return free_CacheVC(this); } diff --git a/src/iocore/cache/CacheRead.cc b/src/iocore/cache/CacheRead.cc index e2f4a61164b..c96588fa435 100644 --- a/src/iocore/cache/CacheRead.cc +++ b/src/iocore/cache/CacheRead.cc @@ -62,7 +62,7 @@ Cache::open_read(Continuation *cont, const CacheKey *key, CacheFragType type, co Metrics::Gauge::increment(cache_rsb.status[c->op_type].active); Metrics::Gauge::increment(stripe->cache_vol->vol_rsb.status[c->op_type].active); c->first_key = c->key = c->earliest_key = *key; - c->vol = stripe; + c->stripe = stripe; c->frag_type = type; c->od = od; } @@ -126,7 +126,7 @@ Cache::open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, if (!lock.is_locked() || (od = stripe->open_read(key)) || dir_probe(key, stripe, &result, &last_collision)) { c = new_CacheVC(cont); c->first_key = c->key = c->earliest_key = *key; - c->vol = stripe; + c->stripe = stripe; c->vio.op = VIO::READ; c->op_type = static_cast(CacheOpType::Read); Metrics::Gauge::increment(cache_rsb.status[c->op_type].active); @@ -201,9 +201,9 @@ CacheVC::openReadFromWriterFailure(int event, Event *e) od = nullptr; vector.clear(false); Metrics::Counter::increment(cache_rsb.status[static_cast(CacheOpType::Read)].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[static_cast(CacheOpType::Read)].failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[static_cast(CacheOpType::Read)].failure); Metrics::Counter::increment(cache_rsb.read_busy_failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.read_busy_failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.read_busy_failure); _action.continuation->handleEvent(event, e); free_CacheVC(this); return EVENT_DONE; @@ -215,7 +215,7 @@ CacheVC::openReadChooseWriter(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSE intptr_t err = ECACHE_DOC_BUSY; CacheVC *w = nullptr; - ink_assert(vol->mutex->thread_holding == mutex->thread_holding && write_vc == nullptr); + ink_assert(stripe->mutex->thread_holding == mutex->thread_holding && write_vc == nullptr); if (!od) { return EVENT_RETURN; @@ -335,18 +335,18 @@ CacheVC::openReadFromWriter(int event, Event *e) od = nullptr; // only open for read so no need to close return free_CacheVC(this); } - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_SCHED_LOCK_RETRY(); } - od = vol->open_read(&first_key); // recheck in case the lock failed + od = stripe->open_read(&first_key); // recheck in case the lock failed if (!od) { MUTEX_RELEASE(lock); write_vc = nullptr; SET_HANDLER(&CacheVC::openReadStartHead); return openReadStartHead(event, e); } else { - ink_assert(od == vol->open_read(&first_key)); + ink_assert(od == stripe->open_read(&first_key)); } if (!write_vc) { int ret = openReadChooseWriter(event, e); @@ -452,7 +452,7 @@ CacheVC::openReadFromWriter(int event, Event *e) dir_clean(&earliest_dir); SET_HANDLER(&CacheVC::openReadFromWriterMain); Metrics::Counter::increment(cache_rsb.read_busy_success); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.read_busy_success); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.read_busy_success); return callcont(CACHE_EVENT_OPEN_READ); } @@ -492,7 +492,7 @@ CacheVC::openReadFromWriter(int event, Event *e) MUTEX_RELEASE(writer_lock); SET_HANDLER(&CacheVC::openReadFromWriterMain); Metrics::Counter::increment(cache_rsb.read_busy_success); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.read_busy_success); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.read_busy_success); return callcont(CACHE_EVENT_OPEN_READ); } @@ -553,19 +553,19 @@ CacheVC::openReadClose(int event, Event * /* e ATS_UNUSED */) } set_io_not_in_progress(); } - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_SCHED_LOCK_RETRY(); } - if (f.hit_evacuate && dir_valid(vol, &first_dir) && closed > 0) { + if (f.hit_evacuate && dir_valid(stripe, &first_dir) && closed > 0) { if (f.single_fragment) { - vol->force_evacuate_head(&first_dir, dir_pinned(&first_dir)); - } else if (dir_valid(vol, &earliest_dir)) { - vol->force_evacuate_head(&first_dir, dir_pinned(&first_dir)); - vol->force_evacuate_head(&earliest_dir, dir_pinned(&earliest_dir)); + stripe->force_evacuate_head(&first_dir, dir_pinned(&first_dir)); + } else if (dir_valid(stripe, &earliest_dir)) { + stripe->force_evacuate_head(&first_dir, dir_pinned(&first_dir)); + stripe->force_evacuate_head(&earliest_dir, dir_pinned(&earliest_dir)); } } - vol->close_read(this); + stripe->close_read(this); return free_CacheVC(this); } @@ -580,15 +580,15 @@ CacheVC::openReadReadDone(int event, Event *e) } set_io_not_in_progress(); { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_SCHED_LOCK_RETRY(); } if (event == AIO_EVENT_DONE && !io.ok()) { goto Lerror; } - if (last_collision && // no missed lock - dir_valid(vol, &dir)) // object still valid + if (last_collision && // no missed lock + dir_valid(stripe, &dir)) // object still valid { doc = reinterpret_cast(buf->data()); if (doc->magic != DOC_MAGIC) { @@ -607,7 +607,7 @@ CacheVC::openReadReadDone(int event, Event *e) if (last_collision && dir_offset(&dir) != dir_offset(last_collision)) { last_collision = nullptr; // object has been/is being overwritten } - if (dir_probe(&key, vol, &dir, &last_collision)) { + if (dir_probe(&key, stripe, &dir, &last_collision)) { int ret = do_read_call(&key); if (ret == EVENT_RETURN) { goto Lcallreturn; @@ -616,7 +616,7 @@ CacheVC::openReadReadDone(int event, Event *e) } else if (write_vc) { if (writer_done()) { last_collision = nullptr; - while (dir_probe(&earliest_key, vol, &dir, &last_collision)) { + while (dir_probe(&earliest_key, stripe, &dir, &last_collision)) { if (dir_offset(&dir) == dir_offset(&earliest_dir)) { DDbg(dbg_ctl_cache_read_agg, "%p: key: %X ReadRead complete: %d", this, first_key.slice32(1), (int)vio.ndone); doc_len = vio.ndone; @@ -637,7 +637,7 @@ CacheVC::openReadReadDone(int event, Event *e) } // fall through for truncated documents Lerror: { - // Keep the lock on vol->mutex, for dir_delete. + // Keep the lock on stripe->mutex, for dir_delete. char tmpstring[CRYPTO_HEX_SIZE]; if (request.valid()) { int url_length; @@ -646,7 +646,7 @@ CacheVC::openReadReadDone(int event, Event *e) } else { Warning("Document %s truncated .. clearing", earliest_key.toHexStr(tmpstring)); } - dir_delete(&earliest_key, vol, &earliest_dir); + dir_delete(&earliest_key, stripe, &earliest_dir); } } return calluser(VC_EVENT_ERROR); @@ -774,15 +774,15 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) doc->magic = DOC_CORRUPT; Metrics::Counter::increment(cache_rsb.read_seek_fail); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.read_seek_fail); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.read_seek_fail); - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { SET_HANDLER(&CacheVC::openReadDirDelete); VC_SCHED_LOCK_RETRY(); } - dir_delete(&earliest_key, vol, &earliest_dir); + dir_delete(&earliest_key, stripe, &earliest_dir); goto Lerror; } } @@ -828,12 +828,12 @@ Lread: { // EVENT_IMMEDIATE events. So, we have to cancel that trigger and set // a new EVENT_INTERVAL event. cancel_trigger(); - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { SET_HANDLER(&CacheVC::openReadMain); VC_SCHED_LOCK_RETRY(); } - if (dir_probe(&key, vol, &dir, &last_collision)) { + if (dir_probe(&key, stripe, &dir, &last_collision)) { SET_HANDLER(&CacheVC::openReadReadDone); int ret = do_read_call(&key); if (ret == EVENT_RETURN) { @@ -843,7 +843,7 @@ Lread: { } else if (write_vc) { if (writer_done()) { last_collision = nullptr; - while (dir_probe(&earliest_key, vol, &dir, &last_collision)) { + while (dir_probe(&earliest_key, stripe, &dir, &last_collision)) { if (dir_offset(&dir) == dir_offset(&earliest_dir)) { DDbg(dbg_ctl_cache_read_agg, "%p: key: %X ReadMain complete: %d", this, first_key.slice32(1), (int)vio.ndone); doc_len = vio.ndone; @@ -863,7 +863,7 @@ Lread: { Warning("Document %X truncated at %d of %d, missing fragment %X", first_key.slice32(1), (int)vio.ndone, (int)doc_len, key.slice32(1)); // remove the directory entry - dir_delete(&earliest_key, vol, &earliest_dir); + dir_delete(&earliest_key, stripe, &earliest_dir); } Lerror: return calluser(VC_EVENT_ERROR); @@ -888,7 +888,7 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS return free_CacheVC(this); } { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_SCHED_LOCK_RETRY(); } @@ -900,9 +900,9 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS } // an object needs to be outside the aggregation window in order to be // be evacuated as it is read - if (!dir_agg_valid(vol, &dir)) { + if (!dir_agg_valid(stripe, &dir)) { // a directory entry which is no longer valid may have been overwritten - if (!dir_valid(vol, &dir)) { + if (!dir_valid(stripe, &dir)) { last_collision = nullptr; } goto Lread; @@ -919,7 +919,7 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS Warning("Earliest: Doc magic does not match for %s", key.toHexStr(tmpstring)); } // remove the dir entry - dir_delete(&key, vol, &dir); + dir_delete(&key, stripe, &dir); // try going through the directory entries again // in case the dir entry we deleted doesnt correspond // to the key we are looking for. This is possible @@ -934,16 +934,16 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS earliest_key = key; doc_pos = doc->prefix_len(); next_CacheKey(&key, &doc->key); - vol->begin_read(this); - if (vol->within_hit_evacuate_window(&earliest_dir) && + stripe->begin_read(this); + if (stripe->within_hit_evacuate_window(&earliest_dir) && (!cache_config_hit_evacuate_size_limit || doc_len <= static_cast(cache_config_hit_evacuate_size_limit))) { DDbg(dbg_ctl_cache_hit_evac, "dir: %" PRId64 ", write: %" PRId64 ", phase: %d", dir_offset(&earliest_dir), - vol->offset_to_vol_offset(vol->header->write_pos), vol->header->phase); + stripe->offset_to_vol_offset(stripe->header->write_pos), stripe->header->phase); f.hit_evacuate = 1; } goto Lsuccess; Lread: - if (dir_probe(&key, vol, &earliest_dir, &last_collision) || dir_lookaside_probe(&key, vol, &earliest_dir, nullptr)) { + if (dir_probe(&key, stripe, &earliest_dir, &last_collision) || dir_lookaside_probe(&key, stripe, &earliest_dir, nullptr)) { dir = earliest_dir; if ((ret = do_read_call(&key)) == EVENT_RETURN) { goto Lcallreturn; @@ -954,7 +954,7 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS // rewrite the vector. if (!f.read_from_writer_called && frag_type == CACHE_FRAG_TYPE_HTTP) { // don't want any writers while we are evacuating the vector - if (!vol->open_write(this, false, 1)) { + if (!stripe->open_write(this, false, 1)) { Doc *doc1 = reinterpret_cast(first_buf->data()); uint32_t len = this->load_http_info(write_vector, doc1); ink_assert(len == doc1->hlen && write_vector->count() > 0); @@ -964,7 +964,7 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS // sometimes the delete fails when there is a race and another read // finds that the directory entry has been overwritten // (cannot assert on the return value) - dir_delete(&first_key, vol, &first_dir); + dir_delete(&first_key, stripe, &first_dir); } else { buf = nullptr; last_collision = nullptr; @@ -1008,11 +1008,11 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS // open write failure - another writer, so don't modify the vector Ldone: if (od) { - vol->close_write(this); + stripe->close_write(this); } } Metrics::Counter::increment(cache_rsb.status[static_cast(CacheOpType::Read)].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[static_cast(CacheOpType::Read)].failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[static_cast(CacheOpType::Read)].failure); _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_NO_DOC); return free_CacheVC(this); Lcallreturn: @@ -1020,7 +1020,7 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS Lsuccess: if (write_vc) { Metrics::Counter::increment(cache_rsb.read_busy_success); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.read_busy_success); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.read_busy_success); } SET_HANDLER(&CacheVC::openReadMain); return callcont(CACHE_EVENT_OPEN_READ); @@ -1039,7 +1039,7 @@ CacheVC::openReadVecWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */ return openWriteCloseDir(EVENT_IMMEDIATE, nullptr); } { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_SCHED_LOCK_RETRY(); } @@ -1053,12 +1053,12 @@ CacheVC::openReadVecWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */ alternate_index = CACHE_ALT_INDEX_DEFAULT; f.use_first_key = 0; vio.op = VIO::READ; - dir_overwrite(&first_key, vol, &dir, &od->first_dir); + dir_overwrite(&first_key, stripe, &dir, &od->first_dir); if (od->move_resident_alt) { - dir_insert(&od->single_doc_key, vol, &od->single_doc_dir); + dir_insert(&od->single_doc_key, stripe, &od->single_doc_dir); } int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, params); - vol->close_write(this); + stripe->close_write(this); if (alt_ndx >= 0) { vector.clear(); // we don't need to start all over again, since we already @@ -1067,12 +1067,12 @@ CacheVC::openReadVecWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */ goto Lrestart; } } else { - vol->close_write(this); + stripe->close_write(this); } } Metrics::Counter::increment(cache_rsb.status[static_cast(CacheOpType::Read)].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[static_cast(CacheOpType::Read)].failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[static_cast(CacheOpType::Read)].failure); _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_ALT_MISS); return free_CacheVC(this); Lrestart: @@ -1095,7 +1095,7 @@ CacheVC::openReadStartHead(int event, Event *e) return free_CacheVC(this); } { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_SCHED_LOCK_RETRY(); } @@ -1107,9 +1107,9 @@ CacheVC::openReadStartHead(int event, Event *e) } // an object needs to be outside the aggregation window in order to be // be evacuated as it is read - if (!dir_agg_valid(vol, &dir)) { + if (!dir_agg_valid(stripe, &dir)) { // a directory entry which is no longer valid may have been overwritten - if (!dir_valid(vol, &dir)) { + if (!dir_valid(stripe, &dir)) { last_collision = nullptr; } goto Lread; @@ -1126,7 +1126,7 @@ CacheVC::openReadStartHead(int event, Event *e) Warning("Head: Doc magic does not match for %s", key.toHexStr(tmpstring)); } // remove the dir entry - dir_delete(&key, vol, &dir); + dir_delete(&key, stripe, &dir); // try going through the directory entries again // in case the dir entry we deleted doesnt correspond // to the key we are looking for. This is possible @@ -1170,7 +1170,7 @@ CacheVC::openReadStartHead(int event, Event *e) CACHE_ALT_MAGIC_MARSHALED == alt->m_magic ? "serial" : CACHE_ALT_MAGIC_DEAD == alt->m_magic ? "dead" : "bogus")); - dir_delete(&key, vol, &dir); + dir_delete(&key, stripe, &dir); } err = ECACHE_BAD_META_DATA; goto Ldone; @@ -1188,7 +1188,7 @@ CacheVC::openReadStartHead(int event, Event *e) if (!alternate_tmp->valid()) { if (buf) { Note("OpenReadHead failed for cachekey %X : alternate inconsistency", key.slice32(0)); - dir_delete(&key, vol, &dir); + dir_delete(&key, stripe, &dir); } goto Ldone; } @@ -1214,7 +1214,7 @@ CacheVC::openReadStartHead(int event, Event *e) Warning("OpenReadHead failed for cachekey %X : alternate content length doesn't match doc_len %" PRId64 " != %" PRId64, key.slice32(0), cl, doc_len); Metrics::Counter::increment(cache_rsb.read_invalid); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.read_invalid); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.read_invalid); err = ECACHE_BAD_META_DATA; goto Ldone; } @@ -1239,15 +1239,15 @@ CacheVC::openReadStartHead(int event, Event *e) goto Learliest; } - if (vol->within_hit_evacuate_window(&dir) && + if (stripe->within_hit_evacuate_window(&dir) && (!cache_config_hit_evacuate_size_limit || doc_len <= static_cast(cache_config_hit_evacuate_size_limit))) { DDbg(dbg_ctl_cache_hit_evac, "dir: %" PRId64 ", write: %" PRId64 ", phase: %d", dir_offset(&dir), - vol->offset_to_vol_offset(vol->header->write_pos), vol->header->phase); + stripe->offset_to_vol_offset(stripe->header->write_pos), stripe->header->phase); f.hit_evacuate = 1; } first_buf = buf; - vol->begin_read(this); + stripe->begin_read(this); goto Lsuccess; @@ -1257,7 +1257,7 @@ CacheVC::openReadStartHead(int event, Event *e) // don't want to go through this BS of reading from a writer if // its a lookup. In this case lookup will fail while the document is // being written to the cache. - OpenDirEntry *cod = vol->open_read(&key); + OpenDirEntry *cod = stripe->open_read(&key); if (cod && !f.read_from_writer_called) { if (f.lookup) { err = ECACHE_DOC_BUSY; @@ -1268,7 +1268,7 @@ CacheVC::openReadStartHead(int event, Event *e) SET_HANDLER(&CacheVC::openReadFromWriter); return handleEvent(EVENT_IMMEDIATE, nullptr); } - if (dir_probe(&key, vol, &dir, &last_collision)) { + if (dir_probe(&key, stripe, &dir, &last_collision)) { first_dir = dir; int ret = do_read_call(&key); if (ret == EVENT_RETURN) { @@ -1280,11 +1280,11 @@ CacheVC::openReadStartHead(int event, Event *e) Ldone: if (!f.lookup) { Metrics::Counter::increment(cache_rsb.status[static_cast(CacheOpType::Read)].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[static_cast(CacheOpType::Read)].failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[static_cast(CacheOpType::Read)].failure); _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-err); } else { Metrics::Counter::increment(cache_rsb.status[static_cast(CacheOpType::Lookup)].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[static_cast(CacheOpType::Lookup)].failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[static_cast(CacheOpType::Lookup)].failure); _action.continuation->handleEvent(CACHE_EVENT_LOOKUP_FAILED, (void *)-err); } return free_CacheVC(this); @@ -1295,7 +1295,7 @@ CacheVC::openReadStartHead(int event, Event *e) return callcont(CACHE_EVENT_OPEN_READ); Lookup: Metrics::Counter::increment(cache_rsb.status[static_cast(CacheOpType::Lookup)].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[static_cast(CacheOpType::Lookup)].failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[static_cast(CacheOpType::Lookup)].failure); _action.continuation->handleEvent(CACHE_EVENT_LOOKUP, nullptr); return free_CacheVC(this); Learliest: @@ -1313,11 +1313,11 @@ CacheVC::openReadStartHead(int event, Event *e) int CacheVC::openReadDirDelete(int event, Event *e) { - MUTEX_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + MUTEX_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_SCHED_LOCK_RETRY(); } - dir_delete(&earliest_key, vol, &earliest_dir); + dir_delete(&earliest_key, stripe, &earliest_dir); return calluser(VC_EVENT_ERROR); } diff --git a/src/iocore/cache/CacheVC.cc b/src/iocore/cache/CacheVC.cc index 406626ed8d8..fe0061031eb 100644 --- a/src/iocore/cache/CacheVC.cc +++ b/src/iocore/cache/CacheVC.cc @@ -347,35 +347,35 @@ CacheVC::handleReadDone(int event, Event *e) } else if (is_io_in_progress()) { return EVENT_CONT; } - if (DISK_BAD(vol->disk)) { + if (DISK_BAD(stripe->disk)) { io.aio_result = -1; - Error("Canceling cache read: disk %s is bad.", vol->hash_text.get()); + Error("Canceling cache read: disk %s is bad.", stripe->hash_text.get()); goto Ldone; } { - MUTEX_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + MUTEX_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_SCHED_LOCK_RETRY(); } - if ((!dir_valid(vol, &dir)) || (!io.ok())) { + if ((!dir_valid(stripe, &dir)) || (!io.ok())) { if (!io.ok()) { Dbg(dbg_ctl_cache_disk_error, "Read error on disk %s\n \ read range : [%" PRIu64 " - %" PRIu64 " bytes] [%" PRIu64 " - %" PRIu64 " blocks] \n", - vol->hash_text.get(), (uint64_t)io.aiocb.aio_offset, (uint64_t)io.aiocb.aio_offset + io.aiocb.aio_nbytes, + stripe->hash_text.get(), (uint64_t)io.aiocb.aio_offset, (uint64_t)io.aiocb.aio_offset + io.aiocb.aio_nbytes, (uint64_t)io.aiocb.aio_offset / 512, (uint64_t)(io.aiocb.aio_offset + io.aiocb.aio_nbytes) / 512); } goto Ldone; } doc = reinterpret_cast(buf->data()); - ink_assert(vol->mutex->nthread_holding < 1000); + ink_assert(stripe->mutex->nthread_holding < 1000); ink_assert(doc->magic == DOC_MAGIC); if (ts::VersionNumber(doc->v_major, doc->v_minor) > CACHE_DB_VERSION) { // future version, count as corrupted doc->magic = DOC_CORRUPT; Dbg(dbg_ctl_cache_bc, "Object is future version %d:%d - disk %s - doc id = %" PRIx64 ":%" PRIx64 "", doc->v_major, - doc->v_minor, vol->hash_text.get(), read_key->slice64(0), read_key->slice64(1)); + doc->v_minor, stripe->hash_text.get(), read_key->slice64(0), read_key->slice64(1)); goto Ldone; } @@ -413,7 +413,7 @@ CacheVC::handleReadDone(int event, Event *e) ink_assert(checksum == doc->checksum); if (checksum != doc->checksum) { Note("cache: checksum error for [%" PRIu64 " %" PRIu64 "] len %d, hlen %d, disk %s, offset %" PRIu64 " size %zu", - doc->first_key.b[0], doc->first_key.b[1], doc->len, doc->hlen, vol->path, (uint64_t)io.aiocb.aio_offset, + doc->first_key.b[0], doc->first_key.b[1], doc->len, doc->hlen, stripe->path, (uint64_t)io.aiocb.aio_offset, (size_t)io.aiocb.aio_nbytes); doc->magic = DOC_CORRUPT; okay = 0; @@ -442,15 +442,15 @@ CacheVC::handleReadDone(int event, Event *e) (doc_len && static_cast(doc_len) < cache_config_ram_cache_cutoff) || !cache_config_ram_cache_cutoff); if (cutoff_check && !f.doc_from_ram_cache) { uint64_t o = dir_offset(&dir); - vol->ram_cache->put(read_key, buf.get(), doc->len, http_copy_hdr, o); + stripe->ram_cache->put(read_key, buf.get(), doc->len, http_copy_hdr, o); } if (!doc_len) { // keep a pointer to it. In case the state machine decides to // update this document, we don't have to read it back in memory // again - vol->first_fragment_key = *read_key; - vol->first_fragment_offset = dir_offset(&dir); - vol->first_fragment_data = buf; + stripe->first_fragment_key = *read_key; + stripe->first_fragment_offset = dir_offset(&dir); + stripe->first_fragment_data = buf; } } // end VIO::READ check // If it could be compressed, unmarshal after @@ -473,36 +473,36 @@ CacheVC::handleRead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) f.doc_from_ram_cache = false; // check ram cache - ink_assert(vol->mutex->thread_holding == this_ethread()); + ink_assert(stripe->mutex->thread_holding == this_ethread()); int64_t o = dir_offset(&dir); - int ram_hit_state = vol->ram_cache->get(read_key, &buf, static_cast(o)); + int ram_hit_state = stripe->ram_cache->get(read_key, &buf, static_cast(o)); f.compressed_in_ram = (ram_hit_state > RAM_HIT_COMPRESS_NONE) ? 1 : 0; if (ram_hit_state >= RAM_HIT_COMPRESS_NONE) { goto LramHit; } // check if it was read in the last open_read call - if (*read_key == vol->first_fragment_key && dir_offset(&dir) == vol->first_fragment_offset) { - buf = vol->first_fragment_data; + if (*read_key == stripe->first_fragment_key && dir_offset(&dir) == stripe->first_fragment_offset) { + buf = stripe->first_fragment_data; goto LmemHit; } // see if its in the aggregation buffer - if (dir_agg_buf_valid(vol, &dir)) { - int agg_offset = vol->vol_offset(&dir) - vol->header->write_pos; + if (dir_agg_buf_valid(stripe, &dir)) { + int agg_offset = stripe->vol_offset(&dir) - stripe->header->write_pos; buf = new_IOBufferData(iobuffer_size_to_index(io.aiocb.aio_nbytes, MAX_BUFFER_SIZE_INDEX), MEMALIGNED); - ink_assert((agg_offset + io.aiocb.aio_nbytes) <= (unsigned)vol->get_agg_buf_pos()); + ink_assert((agg_offset + io.aiocb.aio_nbytes) <= (unsigned)stripe->get_agg_buf_pos()); char *doc = buf->data(); - char *agg = vol->get_agg_buffer() + agg_offset; + char *agg = stripe->get_agg_buffer() + agg_offset; memcpy(doc, agg, io.aiocb.aio_nbytes); io.aio_result = io.aiocb.aio_nbytes; SET_HANDLER(&CacheVC::handleReadDone); return EVENT_RETURN; } - io.aiocb.aio_fildes = vol->fd; - io.aiocb.aio_offset = vol->vol_offset(&dir); - if (static_cast(io.aiocb.aio_offset + io.aiocb.aio_nbytes) > static_cast(vol->skip + vol->len)) { - io.aiocb.aio_nbytes = vol->skip + vol->len - io.aiocb.aio_offset; + io.aiocb.aio_fildes = stripe->fd; + io.aiocb.aio_offset = stripe->vol_offset(&dir); + if (static_cast(io.aiocb.aio_offset + io.aiocb.aio_nbytes) > static_cast(stripe->skip + stripe->len)) { + io.aiocb.aio_nbytes = stripe->skip + stripe->len - io.aiocb.aio_offset; } buf = new_IOBufferData(iobuffer_size_to_index(io.aiocb.aio_nbytes, MAX_BUFFER_SIZE_INDEX), MEMALIGNED); io.aiocb.aio_buf = buf->data(); @@ -514,7 +514,7 @@ CacheVC::handleRead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) // ToDo: Why are these for debug only ?? #if DEBUG Metrics::Counter::increment(cache_rsb.pread_count); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.pread_count); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.pread_count); #endif return EVENT_CONT; @@ -541,21 +541,21 @@ CacheVC::removeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) cancel_trigger(); set_io_not_in_progress(); { - MUTEX_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + MUTEX_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_SCHED_LOCK_RETRY(); } if (_action.cancelled) { if (od) { - vol->close_write(this); + stripe->close_write(this); od = nullptr; } goto Lfree; } if (!f.remove_aborted_writers) { - if (vol->open_write(this, true, 1)) { + if (stripe->open_write(this, true, 1)) { // writer exists - od = vol->open_read(&key); + od = stripe->open_read(&key); ink_release_assert(od); od->dont_update_directory = true; od = nullptr; @@ -569,7 +569,7 @@ CacheVC::removeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) if (!buf) { goto Lcollision; } - if (!dir_valid(vol, &dir)) { + if (!dir_valid(stripe, &dir)) { last_collision = nullptr; goto Lcollision; } @@ -583,9 +583,9 @@ CacheVC::removeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) /* should be first_key not key..right?? */ if (doc->first_key == key) { ink_assert(doc->magic == DOC_MAGIC); - if (dir_delete(&key, vol, &dir) > 0) { + if (dir_delete(&key, stripe, &dir) > 0) { if (od) { - vol->close_write(this); + stripe->close_write(this); } od = nullptr; goto Lremoved; @@ -595,7 +595,7 @@ CacheVC::removeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) } Lcollision: // check for collision - if (dir_probe(&key, vol, &dir, &last_collision) > 0) { + if (dir_probe(&key, stripe, &dir, &last_collision) > 0) { int ret = do_read_call(&key); if (ret == EVENT_RETURN) { goto Lread; @@ -604,12 +604,12 @@ CacheVC::removeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) } Ldone: Metrics::Counter::increment(cache_rsb.status[static_cast(CacheOpType::Remove)].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[static_cast(CacheOpType::Remove)].failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[static_cast(CacheOpType::Remove)].failure); if (od) { - vol->close_write(this); + stripe->close_write(this); } } - ink_assert(!vol || this_ethread() != vol->mutex->thread_holding); + ink_assert(!stripe || this_ethread() != stripe->mutex->thread_holding); _action.continuation->handleEvent(CACHE_EVENT_REMOVE_FAILED, (void *)-ECACHE_NO_DOC); goto Lfree; Lremoved: @@ -619,9 +619,9 @@ CacheVC::removeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) } int -CacheVC::scanVol(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) +CacheVC::scanStripe(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) { - Dbg(dbg_ctl_cache_scan_truss, "inside %p:scanVol", this); + Dbg(dbg_ctl_cache_scan_truss, "%p", this); if (_action.cancelled) { return free_CacheVC(this); } @@ -637,15 +637,15 @@ CacheVC::scanVol(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) } } - if (!vol) { + if (!stripe) { if (!rec->num_vols) { goto Ldone; } - vol = rec->stripes[0]; + stripe = rec->stripes[0]; } else { for (int i = 0; i < rec->num_vols - 1; i++) { - if (vol == rec->stripes[i]) { - vol = rec->stripes[i + 1]; + if (stripe == rec->stripes[i]) { + stripe = rec->stripes[i + 1]; goto Lcont; } } @@ -680,7 +680,7 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) return free_CacheVC(this); } - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { Dbg(dbg_ctl_cache_scan_truss, "delay %p:scanObject", this); mutex->thread_holding->schedule_in_local(this, HRTIME_MSECONDS(cache_config_mutex_retry_delay)); @@ -689,9 +689,9 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) if (!fragment) { // initialize for first read fragment = 1; - scan_vol_map = make_vol_map(vol); - io.aiocb.aio_offset = next_in_map(vol, scan_vol_map, vol->vol_offset_to_offset(0)); - if (io.aiocb.aio_offset >= static_cast(vol->skip + vol->len)) { + scan_stripe_map = make_vol_map(stripe); + io.aiocb.aio_offset = next_in_map(stripe, scan_stripe_map, stripe->vol_offset_to_offset(0)); + if (io.aiocb.aio_offset >= static_cast(stripe->skip + stripe->len)) { goto Lnext_vol; } io.aiocb.aio_nbytes = SCAN_BUF_SIZE; @@ -721,7 +721,7 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) static_cast(io.aiocb.aio_nbytes)) { might_need_overlap_read = false; doc = reinterpret_cast(reinterpret_cast(doc) + next_object_len); - next_object_len = vol->round_to_approx_size(doc->len); + next_object_len = stripe->round_to_approx_size(doc->len); int i; bool changed; @@ -737,11 +737,11 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) last_collision = nullptr; while (true) { - if (!dir_probe(&doc->first_key, vol, &dir, &last_collision)) { + if (!dir_probe(&doc->first_key, stripe, &dir, &last_collision)) { goto Lskip; } - if (!dir_agg_valid(vol, &dir) || !dir_head(&dir) || - (vol->vol_offset(&dir) != io.aiocb.aio_offset + (reinterpret_cast(doc) - buf->data()))) { + if (!dir_agg_valid(stripe, &dir) || !dir_head(&dir) || + (stripe->vol_offset(&dir) != io.aiocb.aio_offset + (reinterpret_cast(doc) - buf->data()))) { continue; } break; @@ -783,7 +783,7 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) // verify that the earliest block exists, reducing 'false hit' callbacks if (!(key == doc->key)) { last_collision = nullptr; - if (!dir_probe(&key, vol, &earliest_dir, &last_collision)) { + if (!dir_probe(&key, stripe, &earliest_dir, &last_collision)) { continue; } } @@ -860,24 +860,24 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) } else { // Normal case, where we ended on a object boundary. io.aiocb.aio_offset += (reinterpret_cast(doc) - buf->data()) + next_object_len; Dbg(dbg_ctl_cache_scan_truss, "next %p:scanObject %" PRId64, this, (int64_t)io.aiocb.aio_offset); - io.aiocb.aio_offset = next_in_map(vol, scan_vol_map, io.aiocb.aio_offset); + io.aiocb.aio_offset = next_in_map(stripe, scan_stripe_map, io.aiocb.aio_offset); Dbg(dbg_ctl_cache_scan_truss, "next_in_map %p:scanObject %" PRId64, this, (int64_t)io.aiocb.aio_offset); io.aiocb.aio_nbytes = SCAN_BUF_SIZE; io.aiocb.aio_buf = buf->data(); scan_fix_buffer_offset = 0; } - if (io.aiocb.aio_offset >= vol->skip + vol->len) { + if (io.aiocb.aio_offset >= stripe->skip + stripe->len) { Lnext_vol: - SET_HANDLER(&CacheVC::scanVol); + SET_HANDLER(&CacheVC::scanStripe); eventProcessor.schedule_in(this, HRTIME_MSECONDS(scan_msec_delay)); return EVENT_CONT; } Lread: - io.aiocb.aio_fildes = vol->fd; - if (static_cast(io.aiocb.aio_offset + io.aiocb.aio_nbytes) > static_cast(vol->skip + vol->len)) { - io.aiocb.aio_nbytes = vol->skip + vol->len - io.aiocb.aio_offset; + io.aiocb.aio_fildes = stripe->fd; + if (static_cast(io.aiocb.aio_offset + io.aiocb.aio_nbytes) > static_cast(stripe->skip + stripe->len)) { + io.aiocb.aio_nbytes = stripe->skip + stripe->len - io.aiocb.aio_offset; } offset = 0; ink_assert(ink_aio_read(&io) >= 0); @@ -922,14 +922,14 @@ CacheVC::scanOpenWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) } int ret = 0; { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { - Dbg(dbg_ctl_cache_scan, "vol->mutex %p:scanOpenWrite", this); + Dbg(dbg_ctl_cache_scan, "stripe->mutex %p:scanOpenWrite", this); VC_SCHED_LOCK_RETRY(); } Dbg(dbg_ctl_cache_scan, "trying for writer lock"); - if (vol->open_write(this, false, 1)) { + if (stripe->open_write(this, false, 1)) { writer_lock_retry++; SET_HANDLER(&CacheVC::scanOpenWrite); mutex->thread_holding->schedule_in_local(this, scan_msec_delay); @@ -950,7 +950,7 @@ CacheVC::scanOpenWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) Dir *l = nullptr; Dir d; Doc *doc = reinterpret_cast(buf->data() + offset); - offset = reinterpret_cast(doc) - buf->data() + vol->round_to_approx_size(doc->len); + offset = reinterpret_cast(doc) - buf->data() + stripe->round_to_approx_size(doc->len); // if the doc contains some data, then we need to create // a new directory entry for this fragment. Remember the // offset and the key in earliest_key @@ -963,8 +963,8 @@ CacheVC::scanOpenWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) } while (true) { - if (!dir_probe(&first_key, vol, &d, &l)) { - vol->close_write(this); + if (!dir_probe(&first_key, stripe, &d, &l)) { + stripe->close_write(this); _action.continuation->handleEvent(CACHE_EVENT_SCAN_OPERATION_FAILED, nullptr); SET_HANDLER(&CacheVC::scanObject); return handleEvent(EVENT_IMMEDIATE, nullptr); @@ -997,16 +997,16 @@ CacheVC::scanUpdateDone(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) Dbg(dbg_ctl_cache_scan_truss, "inside %p:scanUpdateDone", this); cancel_trigger(); // get volume lock - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (lock.is_locked()) { // insert a directory entry for the previous fragment - dir_overwrite(&first_key, vol, &dir, &od->first_dir, false); + dir_overwrite(&first_key, stripe, &dir, &od->first_dir, false); if (od->move_resident_alt) { - dir_insert(&od->single_doc_key, vol, &od->single_doc_dir); + dir_insert(&od->single_doc_key, stripe, &od->single_doc_dir); } - ink_assert(vol->open_read(&first_key)); + ink_assert(stripe->open_read(&first_key)); ink_assert(this->od); - vol->close_write(this); + stripe->close_write(this); SET_HANDLER(&CacheVC::scanObject); return handleEvent(EVENT_IMMEDIATE, nullptr); } else { diff --git a/src/iocore/cache/CacheVol.cc b/src/iocore/cache/CacheVol.cc index ed1f59a2938..70acd3da830 100644 --- a/src/iocore/cache/CacheVol.cc +++ b/src/iocore/cache/CacheVol.cc @@ -41,7 +41,7 @@ Cache::scan(Continuation *cont, const char *hostname, int host_len, int KB_per_s } CacheVC *c = new_CacheVC(cont); - c->vol = nullptr; + c->stripe = nullptr; /* do we need to make a copy */ c->hostname = const_cast(hostname); c->host_len = host_len; @@ -49,7 +49,7 @@ Cache::scan(Continuation *cont, const char *hostname, int host_len, int KB_per_s c->buf = new_IOBufferData(BUFFER_SIZE_FOR_XMALLOC(SCAN_BUF_SIZE), MEMALIGNED); c->scan_msec_delay = (SCAN_BUF_SIZE / KB_per_second); c->offset = 0; - SET_CONTINUATION_HANDLER(c, &CacheVC::scanVol); + SET_CONTINUATION_HANDLER(c, &CacheVC::scanStripe); eventProcessor.schedule_in(c, HRTIME_MSECONDS(c->scan_msec_delay)); cont->handleEvent(CACHE_EVENT_SCAN, c); return &c->_action; diff --git a/src/iocore/cache/CacheWrite.cc b/src/iocore/cache/CacheWrite.cc index 97acbab6447..536070bdfdd 100644 --- a/src/iocore/cache/CacheWrite.cc +++ b/src/iocore/cache/CacheWrite.cc @@ -83,7 +83,7 @@ CacheVC::updateVector(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) } int ret = 0; { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked() || od->writing_vec) { VC_SCHED_LOCK_RETRY(); } @@ -101,7 +101,7 @@ CacheVC::updateVector(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) write_vector->remove(alternate_index, true); alternate_index = CACHE_ALT_REMOVED; if (!write_vector->count()) { - dir_delete(&first_key, vol, &od->first_dir); + dir_delete(&first_key, stripe, &od->first_dir); } } // the alternate is not there any more. somebody might have @@ -247,10 +247,10 @@ CacheVC::handleWrite(int event, Event * /* e ATS_UNUSED */) set_agg_write_in_progress(); POP_HANDLER; - agg_len = vol->round_to_approx_size(write_len + header_len + frag_len + sizeof(Doc)); - vol->add_agg_todo(agg_len); + agg_len = stripe->round_to_approx_size(write_len + header_len + frag_len + sizeof(Doc)); + stripe->add_agg_todo(agg_len); bool agg_error = (agg_len > AGG_SIZE || header_len + sizeof(Doc) > MAX_FRAG_SIZE || - (!f.readers && (vol->get_agg_todo_size() > cache_config_agg_write_backlog + AGG_SIZE) && write_len)); + (!f.readers && (stripe->get_agg_todo_size() > cache_config_agg_write_backlog + AGG_SIZE) && write_len)); #ifdef CACHE_AGG_FAIL_RATE agg_error = agg_error || ((uint32_t)mutex->thread_holding->generator.random() < (uint32_t)(UINT_MAX * CACHE_AGG_FAIL_RATE)); #endif @@ -259,10 +259,10 @@ CacheVC::handleWrite(int event, Event * /* e ATS_UNUSED */) if (agg_error || max_doc_error) { Metrics::Counter::increment(cache_rsb.write_backlog_failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.write_backlog_failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.write_backlog_failure); Metrics::Counter::increment(cache_rsb.status[op_type].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[op_type].failure); - vol->add_agg_todo(-agg_len); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[op_type].failure); + stripe->add_agg_todo(-agg_len); io.aio_result = AIO_SOFT_FAILURE; if (event == EVENT_CALL) { return EVENT_RETURN; @@ -271,12 +271,12 @@ CacheVC::handleWrite(int event, Event * /* e ATS_UNUSED */) } ink_assert(agg_len <= AGG_SIZE); if (f.evac_vector) { - vol->get_pending_writers().push(this); + stripe->get_pending_writers().push(this); } else { - vol->get_pending_writers().enqueue(this); + stripe->get_pending_writers().enqueue(this); } - if (!vol->is_io_in_progress()) { - return vol->aggWrite(event, this); + if (!stripe->is_io_in_progress()) { + return stripe->aggWrite(event, this); } return EVENT_CONT; } @@ -445,7 +445,7 @@ new_DocEvacuator(int nbytes, Stripe *stripe) Metrics::Gauge::increment(cache_rsb.status[c->op_type].active); Metrics::Gauge::increment(stripe->cache_vol->vol_rsb.status[c->op_type].active); c->buf = new_IOBufferData(iobuffer_size_to_index(nbytes, MAX_BUFFER_SIZE_INDEX), MEMALIGNED); - c->vol = stripe; + c->stripe = stripe; c->f.evacuator = 1; c->earliest_key.clear(); SET_CONTINUATION_HANDLER(c, &CacheEvacuateDocVC::evacuateDocDone); @@ -649,7 +649,7 @@ Stripe::evac_range(off_t low, off_t high, int evac_phase) static int agg_copy(char *p, CacheVC *vc) { - Stripe *stripe = vc->vol; + Stripe *stripe = vc->stripe; off_t o = stripe->header->write_pos + stripe->get_agg_buf_pos(); if (!vc->f.evacuator) { @@ -740,7 +740,7 @@ agg_copy(char *p, CacheVC *vc) // move data if (vc->write_len) { { - ProxyMutex *mutex ATS_UNUSED = vc->vol->mutex.get(); + ProxyMutex *mutex ATS_UNUSED = vc->stripe->mutex.get(); ink_assert(mutex->thread_holding == this_ethread()); // ToDo: Why are these for debug only ? @@ -784,21 +784,21 @@ agg_copy(char *p, CacheVC *vc) } else { // for evacuated documents, copy the data, and update directory Doc *doc = reinterpret_cast(vc->buf->data()); - int l = vc->vol->round_to_approx_size(doc->len); + int l = vc->stripe->round_to_approx_size(doc->len); #ifdef DEBUG Metrics::Counter::increment(cache_rsb.gc_frags_evacuated); Metrics::Counter::increment(stripe->cache_vol->vol_rsb.gc_frags_evacuated); #endif - doc->sync_serial = vc->vol->header->sync_serial; - doc->write_serial = vc->vol->header->write_serial; + doc->sync_serial = vc->stripe->header->sync_serial; + doc->write_serial = vc->stripe->header->write_serial; memcpy(p, doc, doc->len); vc->dir = vc->overwrite_dir; - dir_set_offset(&vc->dir, vc->vol->offset_to_vol_offset(o)); - dir_set_phase(&vc->dir, vc->vol->header->phase); + dir_set_offset(&vc->dir, vc->stripe->offset_to_vol_offset(o)); + dir_set_phase(&vc->dir, vc->stripe->header->phase); return l; } } @@ -1024,15 +1024,15 @@ CacheVC::openWriteCloseDir(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED * { cancel_trigger(); { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { SET_HANDLER(&CacheVC::openWriteCloseDir); ink_assert(!is_io_in_progress()); VC_SCHED_LOCK_RETRY(); } - vol->close_write(this); + stripe->close_write(this); if (closed < 0 && fragment) { - dir_delete(&earliest_key, vol, &earliest_dir); + dir_delete(&earliest_key, stripe, &earliest_dir); } } if (dbg_ctl_cache_update.on()) { @@ -1059,11 +1059,11 @@ CacheVC::openWriteCloseDir(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED * DDbg(dbg_ctl_cache_stats, "Fragment = %d", fragment); Metrics::Counter::increment(cache_rsb.fragment_document_count[std::clamp(fragment, 0, 2)]); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.fragment_document_count[std::clamp(fragment, 0, 2)]); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.fragment_document_count[std::clamp(fragment, 0, 2)]); } if (f.close_complete) { recursive++; - ink_assert(!vol || this_ethread() != vol->mutex->thread_holding); + ink_assert(!stripe || this_ethread() != stripe->mutex->thread_holding); vio.cont->handleEvent(VC_EVENT_WRITE_COMPLETE, (void *)&vio); recursive--; } @@ -1079,7 +1079,7 @@ CacheVC::openWriteCloseHeadDone(int event, Event *e) return EVENT_CONT; } { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_LOCK_RETRY_EVENT(); } @@ -1090,14 +1090,14 @@ CacheVC::openWriteCloseHeadDone(int event, Event *e) ink_assert(f.use_first_key); if (!od->dont_update_directory) { if (dir_is_empty(&od->first_dir)) { - dir_insert(&first_key, vol, &dir); + dir_insert(&first_key, stripe, &dir); } else { // multiple fragment vector write - dir_overwrite(&first_key, vol, &dir, &od->first_dir, false); + dir_overwrite(&first_key, stripe, &dir, &od->first_dir, false); // insert moved resident alternate if (od->move_resident_alt) { - if (dir_valid(vol, &od->single_doc_dir)) { - dir_insert(&od->single_doc_key, vol, &od->single_doc_dir); + if (dir_valid(stripe, &od->single_doc_dir)) { + dir_insert(&od->single_doc_key, stripe, &od->single_doc_dir); } od->move_resident_alt = false; } @@ -1158,7 +1158,7 @@ CacheVC::openWriteCloseDataDone(int event, Event *e) return openWriteCloseDir(event, e); } { - CACHE_TRY_LOCK(lock, vol->mutex, this_ethread()); + CACHE_TRY_LOCK(lock, stripe->mutex, this_ethread()); if (!lock.is_locked()) { VC_LOCK_RETRY_EVENT(); } @@ -1174,7 +1174,7 @@ CacheVC::openWriteCloseDataDone(int event, Event *e) } fragment++; write_pos += write_len; - dir_insert(&key, vol, &dir); + dir_insert(&key, stripe, &dir); blocks = iobufferblock_skip(blocks.get(), &offset, &length, write_len); next_CacheKey(&key, &key); if (length) { @@ -1252,7 +1252,7 @@ CacheVC::openWriteWriteDone(int event, Event *e) return calluser(VC_EVENT_ERROR); } { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_LOCK_RETRY_EVENT(); } @@ -1270,7 +1270,7 @@ CacheVC::openWriteWriteDone(int event, Event *e) } ++fragment; write_pos += write_len; - dir_insert(&key, vol, &dir); + dir_insert(&key, stripe, &dir); DDbg(dbg_ctl_cache_insert, "WriteDone: %X, %X, %d", key.slice32(0), first_key.slice32(0), write_len); blocks = iobufferblock_skip(blocks.get(), &offset, &length, write_len); next_CacheKey(&key, &key); @@ -1393,11 +1393,11 @@ CacheVC::openWriteOverwrite(int event, Event *e) goto Ldone; } Lcollision: { - CACHE_TRY_LOCK(lock, vol->mutex, this_ethread()); + CACHE_TRY_LOCK(lock, stripe->mutex, this_ethread()); if (!lock.is_locked()) { VC_LOCK_RETRY_EVENT(); } - int res = dir_probe(&first_key, vol, &dir, &last_collision); + int res = dir_probe(&first_key, stripe, &dir, &last_collision); if (res > 0) { if ((res = do_read_call(&first_key)) == EVENT_RETURN) { goto Lcallreturn; @@ -1426,7 +1426,7 @@ CacheVC::openWriteStartDone(int event, Event *e) set_io_not_in_progress(); } { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { VC_LOCK_RETRY_EVENT(); } @@ -1447,9 +1447,9 @@ CacheVC::openWriteStartDone(int event, Event *e) We need to start afresh from the beginning by setting last_collision to nullptr. */ - if (!dir_valid(vol, &dir)) { + if (!dir_valid(stripe, &dir)) { DDbg(dbg_ctl_cache_write, "OpenReadStartDone: Dir not valid: Write Head: %" PRId64 ", Dir: %" PRId64, - (int64_t)vol->offset_to_vol_offset(vol->header->write_pos), dir_offset(&dir)); + (int64_t)stripe->offset_to_vol_offset(stripe->header->write_pos), dir_offset(&dir)); last_collision = nullptr; goto Lcollision; } @@ -1478,7 +1478,7 @@ CacheVC::openWriteStartDone(int event, Event *e) Lcollision: int if_writers = ((uintptr_t)info == CACHE_ALLOW_MULTIPLE_WRITES); if (!od) { - if ((err = vol->open_write(this, if_writers, cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0) { + if ((err = stripe->open_write(this, if_writers, cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0) { goto Lfailure; } if (od->has_multiple_writers()) { @@ -1488,7 +1488,7 @@ CacheVC::openWriteStartDone(int event, Event *e) } } // check for collision - if (dir_probe(&first_key, vol, &dir, &last_collision)) { + if (dir_probe(&first_key, stripe, &dir, &last_collision)) { od->reading_vec = true; int ret = do_read_call(&first_key); if (ret == EVENT_RETURN) { @@ -1511,7 +1511,7 @@ CacheVC::openWriteStartDone(int event, Event *e) Lfailure: Metrics::Counter::increment(cache_rsb.status[op_type].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[op_type].failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[op_type].failure); _action.continuation->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *)-err); Lcancel: if (od) { @@ -1533,9 +1533,9 @@ CacheVC::openWriteStartBegin(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED if (_action.cancelled) { return free_CacheVC(this); } - if (((err = vol->open_write_lock(this, false, 1)) > 0)) { + if (((err = stripe->open_write_lock(this, false, 1)) > 0)) { Metrics::Counter::increment(cache_rsb.status[op_type].failure); - Metrics::Counter::increment(vol->cache_vol->vol_rsb.status[op_type].failure); + Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[op_type].failure); free_CacheVC(this); _action.continuation->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *)-err); return EVENT_DONE; @@ -1570,8 +1570,8 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheFragType frag_ty SCOPED_MUTEX_LOCK(lock, c->mutex, this_ethread()); c->vio.op = VIO::WRITE; c->op_type = static_cast(CacheOpType::Write); - c->vol = key_to_vol(key, hostname, host_len); - Stripe *stripe = c->vol; + c->stripe = key_to_vol(key, hostname, host_len); + Stripe *stripe = c->stripe; Metrics::Gauge::increment(cache_rsb.status[c->op_type].active); Metrics::Gauge::increment(stripe->cache_vol->vol_rsb.status[c->op_type].active); c->first_key = c->key = *key; @@ -1594,7 +1594,7 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheFragType frag_ty // coverity[Y2K38_SAFETY:FALSE] c->pin_in_cache = static_cast(apin_in_cache); - if ((res = c->vol->open_write_lock(c, false, 1)) > 0) { + if ((res = c->stripe->open_write_lock(c, false, 1)) > 0) { // document currently being written, abort Metrics::Counter::increment(cache_rsb.status[c->op_type].failure); Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[c->op_type].failure); @@ -1649,8 +1649,8 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *info, } while (DIR_MASK_TAG(c->key.slice32(2)) == DIR_MASK_TAG(c->first_key.slice32(2))); c->earliest_key = c->key; c->frag_type = CACHE_FRAG_TYPE_HTTP; - c->vol = key_to_vol(key, hostname, host_len); - Stripe *stripe = c->vol; + c->stripe = key_to_vol(key, hostname, host_len); + Stripe *stripe = c->stripe; c->info = info; if (c->info && (uintptr_t)info != CACHE_ALLOW_MULTIPLE_WRITES) { /* @@ -1697,9 +1697,9 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *info, c->pin_in_cache = static_cast(apin_in_cache); { - CACHE_TRY_LOCK(lock, c->vol->mutex, cont->mutex->thread_holding); + CACHE_TRY_LOCK(lock, c->stripe->mutex, cont->mutex->thread_holding); if (lock.is_locked()) { - if ((err = c->vol->open_write(c, if_writers, cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0) { + if ((err = c->stripe->open_write(c, if_writers, cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0) { goto Lfailure; } // If there are multiple writers, then this one cannot be an update. @@ -1708,7 +1708,7 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *info, if (c->od->has_multiple_writers()) { goto Lmiss; } - if (!dir_probe(key, c->vol, &c->dir, &c->last_collision)) { + if (!dir_probe(key, c->stripe, &c->dir, &c->last_collision)) { if (c->f.update) { // fail update because vector has been GC'd // This situation can also arise in openWriteStartDone diff --git a/src/iocore/cache/P_CacheInternal.h b/src/iocore/cache/P_CacheInternal.h index eb475a776df..012b6f23d69 100644 --- a/src/iocore/cache/P_CacheInternal.h +++ b/src/iocore/cache/P_CacheInternal.h @@ -174,7 +174,7 @@ free_CacheVC(CacheVC *cont) static DbgCtl dbg_ctl{"cache_free"}; Dbg(dbg_ctl, "free %p", cont); ProxyMutex *mutex = cont->mutex.get(); - Stripe *stripe = cont->vol; + Stripe *stripe = cont->stripe; if (stripe) { Metrics::Gauge::decrement(cache_rsb.status[cont->op_type].active); @@ -212,7 +212,7 @@ free_CacheVC(CacheVC *cont) cont->writer_buf.clear(); cont->alternate_index = CACHE_ALT_INDEX_DEFAULT; - ats_free(cont->scan_vol_map); + ats_free(cont->scan_stripe_map); memset((char *)&cont->vio, 0, cont->size_to_init); #ifdef DEBUG @@ -226,7 +226,7 @@ inline int CacheVC::calluser(int event) { recursive++; - ink_assert(!vol || this_ethread() != vol->mutex->thread_holding); + ink_assert(!stripe || this_ethread() != stripe->mutex->thread_holding); vio.cont->handleEvent(event, (void *)&vio); recursive--; if (closed) { @@ -240,7 +240,7 @@ inline int CacheVC::callcont(int event) { recursive++; - ink_assert(!vol || this_ethread() != vol->mutex->thread_holding); + ink_assert(!stripe || this_ethread() != stripe->mutex->thread_holding); _action.continuation->handleEvent(event, this); recursive--; if (closed) { @@ -310,7 +310,7 @@ CacheVC::handleWriteLock(int /* event ATS_UNUSED */, Event *e) cancel_trigger(); int ret = 0; { - CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); if (!lock.is_locked()) { set_agg_write_in_progress(); trigger = mutex->thread_holding->schedule_in_local(this, HRTIME_MSECONDS(cache_config_mutex_retry_delay)); @@ -343,7 +343,7 @@ CacheVC::writer_done() { OpenDirEntry *cod = od; if (!cod) { - cod = vol->open_read(&first_key); + cod = stripe->open_read(&first_key); } CacheVC *w = (cod) ? cod->writers.head : nullptr; // If the write vc started after the reader, then its not the diff --git a/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_L.cc b/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_L.cc index c0195805b42..bb9316f45e7 100644 --- a/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_L.cc +++ b/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_L.cc @@ -223,10 +223,10 @@ class CacheAltTest_L_to_S_remove_L : public CacheTestHandler { CacheKey key = {}; Dir *last_collision = nullptr; - SCOPED_MUTEX_LOCK(lock, vc->vol->mutex, this->mutex->thread_holding); + SCOPED_MUTEX_LOCK(lock, vc->stripe->mutex, this->mutex->thread_holding); vc->vector.data[0].alternate.object_key_get(&key); - REQUIRE(dir_probe(&key, vc->vol, &dir, &last_collision) != 0); - REQUIRE(dir_delete(&key, vc->vol, &dir)); + REQUIRE(dir_probe(&key, vc->stripe, &dir, &last_collision) != 0); + REQUIRE(dir_delete(&key, vc->stripe, &dir)); } }; diff --git a/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_S.cc b/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_S.cc index 938eda8b8d4..65b2e71a540 100644 --- a/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_S.cc +++ b/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_S.cc @@ -224,10 +224,10 @@ class CacheAltTest_L_to_S_remove_S : public CacheTestHandler { CacheKey key = {}; Dir *last_collision = nullptr; - SCOPED_MUTEX_LOCK(lock, vc->vol->mutex, this->mutex->thread_holding); + SCOPED_MUTEX_LOCK(lock, vc->stripe->mutex, this->mutex->thread_holding); vc->vector.data[1].alternate.object_key_get(&key); - REQUIRE(dir_probe(&key, vc->vol, &dir, &last_collision) != 0); - REQUIRE(dir_delete(&key, vc->vol, &dir)); + REQUIRE(dir_probe(&key, vc->stripe, &dir, &last_collision) != 0); + REQUIRE(dir_delete(&key, vc->stripe, &dir)); } }; diff --git a/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_L.cc b/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_L.cc index 8c944aba691..d7e1a8bbede 100644 --- a/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_L.cc +++ b/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_L.cc @@ -227,10 +227,10 @@ class CacheAltTest_S_to_L_remove_L : public CacheTestHandler { CacheKey key = {}; Dir *last_collision = nullptr; - SCOPED_MUTEX_LOCK(lock, vc->vol->mutex, this->mutex->thread_holding); + SCOPED_MUTEX_LOCK(lock, vc->stripe->mutex, this->mutex->thread_holding); vc->vector.data[1].alternate.object_key_get(&key); - REQUIRE(dir_probe(&key, vc->vol, &dir, &last_collision) != 0); - REQUIRE(dir_delete(&key, vc->vol, &dir)); + REQUIRE(dir_probe(&key, vc->stripe, &dir, &last_collision) != 0); + REQUIRE(dir_delete(&key, vc->stripe, &dir)); } }; diff --git a/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_S.cc b/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_S.cc index da066e50b22..47cd66bebaa 100644 --- a/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_S.cc +++ b/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_S.cc @@ -225,10 +225,10 @@ class test_Alternate_S_to_L_remove_S : public CacheTestHandler { CacheKey key = {}; Dir *last_collision = nullptr; - SCOPED_MUTEX_LOCK(lock, vc->vol->mutex, this->mutex->thread_holding); + SCOPED_MUTEX_LOCK(lock, vc->stripe->mutex, this->mutex->thread_holding); vc->vector.data[0].alternate.object_key_get(&key); - REQUIRE(dir_probe(&key, vc->vol, &dir, &last_collision) != 0); - REQUIRE(dir_delete(&key, vc->vol, &dir)); + REQUIRE(dir_probe(&key, vc->stripe, &dir, &last_collision) != 0); + REQUIRE(dir_delete(&key, vc->stripe, &dir)); } };