You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2011/03/29 22:12:13 UTC
svn commit: r1086711 [3/4] - in /trafficserver/traffic/trunk:
contrib/perl/AdminClient/lib/Apache/TS/ iocore/cache/ mgmt/ mgmt/api/
mgmt/api/include/ mgmt/api/remote/ mgmt/html2/configure/ mgmt/web2/
proxy/api/ts/ proxy/config/
Modified: trafficserver/traffic/trunk/iocore/cache/CacheRead.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CacheRead.cc?rev=1086711&r1=1086710&r2=1086711&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CacheRead.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CacheRead.cc Tue Mar 29 20:12:11 2011
@@ -38,21 +38,21 @@ Cache::open_read(Continuation * cont, Ca
}
ink_assert(caches[type] == this);
- Part *part = key_to_part(key, hostname, host_len);
+ Vol *vol = key_to_vol(key, hostname, host_len);
Dir result, *last_collision = NULL;
ProxyMutex *mutex = cont->mutex;
OpenDirEntry *od = NULL;
CacheVC *c = NULL;
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
- if (!lock || (od = part->open_read(key)) || dir_probe(key, part, &result, &last_collision)) {
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
+ if (!lock || (od = vol->open_read(key)) || dir_probe(key, vol, &result, &last_collision)) {
c = new_CacheVC(cont);
SET_CONTINUATION_HANDLER(c, &CacheVC::openReadStartHead);
c->vio.op = VIO::READ;
c->base_stat = cache_read_active_stat;
CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
c->first_key = c->key = c->earliest_key = *key;
- c->part = part;
+ c->vol = vol;
c->frag_type = type;
c->od = od;
}
@@ -99,18 +99,18 @@ Cache::open_read(Continuation * cont, Ca
}
ink_assert(caches[type] == this);
- Part *part = key_to_part(key, hostname, host_len);
+ Vol *vol = key_to_vol(key, hostname, host_len);
Dir result, *last_collision = NULL;
ProxyMutex *mutex = cont->mutex;
OpenDirEntry *od = NULL;
CacheVC *c = NULL;
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
- if (!lock || (od = part->open_read(key)) || dir_probe(key, part, &result, &last_collision)) {
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
+ if (!lock || (od = vol->open_read(key)) || dir_probe(key, vol, &result, &last_collision)) {
c = new_CacheVC(cont);
c->first_key = c->key = c->earliest_key = *key;
- c->part = part;
+ c->vol = vol;
c->vio.op = VIO::READ;
c->base_stat = cache_read_active_stat;
CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
@@ -178,7 +178,7 @@ CacheVC::openReadChooseWriter(int event,
intptr_t err = ECACHE_DOC_BUSY;
CacheVC *w = NULL;
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_SCHED_LOCK_RETRY();
@@ -294,7 +294,7 @@ CacheVC::openReadFromWriter(int event, E
last_collision = NULL;
// Let's restart the clock from here - the first time this a reader
// gets in this state. Its possible that the open_read was called
- // before the open_write, but the reader could not get the partition
+ // before the open_write, but the reader could not get the volume
// lock. If we don't reset the clock here, we won't choose any writer
// and hence fail the read request.
start_time = ink_get_hrtime();
@@ -310,17 +310,17 @@ CacheVC::openReadFromWriter(int event, E
od = NULL; // only open for read so no need to close
return free_CacheVC(this);
}
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_SCHED_LOCK_RETRY();
- od = part->open_read(&first_key); // recheck in case the lock failed
+ od = vol->open_read(&first_key); // recheck in case the lock failed
if (!od) {
MUTEX_RELEASE(lock);
write_vc = NULL;
SET_HANDLER(&CacheVC::openReadStartHead);
return openReadStartHead(event, e);
} else
- ink_debug_assert(od == part->open_read(&first_key));
+ ink_debug_assert(od == vol->open_read(&first_key));
if (!write_vc) {
MUTEX_RELEASE(lock);
int ret = openReadChooseWriter(event, e);
@@ -514,20 +514,20 @@ CacheVC::openReadClose(int event, Event
return EVENT_CONT;
set_io_not_in_progress();
}
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_SCHED_LOCK_RETRY();
#ifdef HIT_EVACUATE
- if (f.hit_evacuate && dir_valid(part, &first_dir) && closed > 0) {
+ if (f.hit_evacuate && dir_valid(vol, &first_dir) && closed > 0) {
if (f.single_fragment)
- part->force_evacuate_head(&first_dir, dir_pinned(&first_dir));
- else if (dir_valid(part, &earliest_dir)) {
- part->force_evacuate_head(&first_dir, dir_pinned(&first_dir));
- part->force_evacuate_head(&earliest_dir, dir_pinned(&earliest_dir));
+ 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));
}
}
#endif
- part->close_read(this);
+ vol->close_read(this);
return free_CacheVC(this);
}
@@ -541,15 +541,15 @@ CacheVC::openReadReadDone(int event, Eve
return EVENT_CONT;
set_io_not_in_progress();
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_SCHED_LOCK_RETRY();
if (event == AIO_EVENT_DONE && !io.ok()) {
- dir_delete(&earliest_key, part, &earliest_dir);
+ dir_delete(&earliest_key, vol, &earliest_dir);
goto Lerror;
}
if (last_collision && // no missed lock
- dir_valid(part, &dir)) // object still valid
+ dir_valid(vol, &dir)) // object still valid
{
doc = (Doc *) buf->data();
if (doc->magic != DOC_MAGIC) {
@@ -565,7 +565,7 @@ CacheVC::openReadReadDone(int event, Eve
}
if (last_collision && dir_offset(&dir) != dir_offset(last_collision))
last_collision = 0; // object has been/is being overwritten
- if (dir_probe(&key, part, &dir, &last_collision)) {
+ if (dir_probe(&key, vol, &dir, &last_collision)) {
int ret = do_read_call(&key);
if (ret == EVENT_RETURN)
goto Lcallreturn;
@@ -573,7 +573,7 @@ CacheVC::openReadReadDone(int event, Eve
} else if (write_vc) {
if (writer_done()) {
last_collision = NULL;
- while (dir_probe(&earliest_key, part, &dir, &last_collision)) {
+ while (dir_probe(&earliest_key, vol, &dir, &last_collision)) {
if (dir_offset(&dir) == dir_offset(&earliest_dir)) {
DDebug("cache_read_agg", "%x: key: %X ReadRead complete: %d",
this, first_key.word(1), (int)vio.ndone);
@@ -691,12 +691,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, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock) {
SET_HANDLER(&CacheVC::openReadMain);
VC_SCHED_LOCK_RETRY();
}
- if (dir_probe(&key, part, &dir, &last_collision)) {
+ if (dir_probe(&key, vol, &dir, &last_collision)) {
SET_HANDLER(&CacheVC::openReadReadDone);
int ret = do_read_call(&key);
if (ret == EVENT_RETURN)
@@ -705,7 +705,7 @@ Lread: {
} else if (write_vc) {
if (writer_done()) {
last_collision = NULL;
- while (dir_probe(&earliest_key, part, &dir, &last_collision)) {
+ while (dir_probe(&earliest_key, vol, &dir, &last_collision)) {
if (dir_offset(&dir) == dir_offset(&earliest_dir)) {
DDebug("cache_read_agg", "%x: key: %X ReadMain complete: %d",
this, first_key.word(1), (int)vio.ndone);
@@ -725,7 +725,7 @@ Lread: {
ink_release_assert(false);
Warning("Document %X truncated at %d of %d, missing fragment %X", first_key.word(1), (int)vio.ndone, (int)doc_len, key.word(1));
// remove the directory entry
- dir_delete(&earliest_key, part, &earliest_dir);
+ dir_delete(&earliest_key, vol, &earliest_dir);
}
Lerror:
return calluser(VC_EVENT_ERROR);
@@ -752,7 +752,7 @@ CacheVC::openReadStartEarliest(int event
if (_action.cancelled)
return free_CacheVC(this);
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_SCHED_LOCK_RETRY();
if (!buf)
@@ -761,9 +761,9 @@ CacheVC::openReadStartEarliest(int event
goto Ldone;
// an object needs to be outside the aggregation window in order to be
// be evacuated as it is read
- if (!dir_agg_valid(part, &dir)) {
+ if (!dir_agg_valid(vol, &dir)) {
// a directory entry which is nolonger valid may have been overwritten
- if (!dir_valid(part, &dir))
+ if (!dir_valid(vol, &dir))
last_collision = NULL;
goto Lread;
}
@@ -778,7 +778,7 @@ CacheVC::openReadStartEarliest(int event
else
Warning("Earliest : Doc magic does not match for %s", key.string(tmpstring));
// remove the dir entry
- dir_delete(&key, part, &dir);
+ dir_delete(&key, vol, &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
@@ -792,19 +792,19 @@ CacheVC::openReadStartEarliest(int event
earliest_key = key;
doc_pos = doc->prefix_len();
next_CacheKey(&key, &doc->key);
- part->begin_read(this);
+ vol->begin_read(this);
#ifdef HIT_EVACUATE
- if (part->within_hit_evacuate_window(&earliest_dir) &&
+ if (vol->within_hit_evacuate_window(&earliest_dir) &&
(!cache_config_hit_evacuate_size_limit || doc_len <= cache_config_hit_evacuate_size_limit)) {
DDebug("cache_hit_evac", "dir: %d, write: %d, phase: %d",
- dir_offset(&earliest_dir), offset_to_part_offset(part, part->header->write_pos), part->header->phase);
+ dir_offset(&earliest_dir), offset_to_vol_offset(vol, vol->header->write_pos), vol->header->phase);
f.hit_evacuate = 1;
}
#endif
goto Lsuccess;
Lread:
- if (dir_probe(&key, part, &earliest_dir, &last_collision) ||
- dir_lookaside_probe(&key, part, &earliest_dir, NULL))
+ if (dir_probe(&key, vol, &earliest_dir, &last_collision) ||
+ dir_lookaside_probe(&key, vol, &earliest_dir, NULL))
{
dir = earliest_dir;
if ((ret = do_read_call(&key)) == EVENT_RETURN)
@@ -816,7 +816,7 @@ Lread:
#ifdef HTTP_CACHE
if (!f.read_from_writer_called && frag_type == CACHE_FRAG_TYPE_HTTP) {
// don't want any writers while we are evacuating the vector
- if (!part->open_write(this, false, 1)) {
+ if (!vol->open_write(this, false, 1)) {
Doc *doc1 = (Doc *) first_buf->data();
uint32_t len = write_vector->get_handles(doc1->hdr(), doc1->hlen);
ink_assert(len == doc1->hlen && write_vector->count() > 0);
@@ -826,7 +826,7 @@ Lread:
// 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, part, &first_dir);
+ dir_delete(&first_key, vol, &first_dir);
} else {
buf = NULL;
last_collision = NULL;
@@ -869,7 +869,7 @@ Lread:
// open write failure - another writer, so don't modify the vector
Ldone:
if (od)
- part->close_write(this);
+ vol->close_write(this);
}
CACHE_INCREMENT_DYN_STAT(cache_read_failure_stat);
_action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NO_DOC);
@@ -884,7 +884,7 @@ Lsuccess:
}
// create the directory entry after the vector has been evacuated
-// the partition lock has been taken when this function is called
+// the volume lock has been taken when this function is called
#ifdef HTTP_CACHE
int
CacheVC::openReadVecWrite(int event, Event * e)
@@ -899,7 +899,7 @@ CacheVC::openReadVecWrite(int event, Eve
if (_action.cancelled)
return openWriteCloseDir(EVENT_IMMEDIATE, 0);
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_SCHED_LOCK_RETRY();
if (io.ok()) {
@@ -912,15 +912,15 @@ CacheVC::openReadVecWrite(int event, Eve
alternate_index = CACHE_ALT_INDEX_DEFAULT;
f.use_first_key = 0;
vio.op = VIO::READ;
- dir_overwrite(&first_key, part, &dir, &od->first_dir);
+ dir_overwrite(&first_key, vol, &dir, &od->first_dir);
if (od->move_resident_alt)
- dir_insert(&od->single_doc_key, part, &od->single_doc_dir);
+ dir_insert(&od->single_doc_key, vol, &od->single_doc_dir);
#ifdef FIXME_NONMODULAR
int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, params);
#else
int alt_ndx = 0;
#endif
- part->close_write(this);
+ vol->close_write(this);
if (alt_ndx >= 0) {
vector.clear();
// we don't need to start all over again, since we already
@@ -929,7 +929,7 @@ CacheVC::openReadVecWrite(int event, Eve
goto Lrestart;
}
} else
- part->close_write(this);
+ vol->close_write(this);
}
CACHE_INCREMENT_DYN_STAT(cache_read_failure_stat);
@@ -955,7 +955,7 @@ CacheVC::openReadStartHead(int event, Ev
if (_action.cancelled)
return free_CacheVC(this);
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_SCHED_LOCK_RETRY();
if (!buf)
@@ -964,9 +964,9 @@ CacheVC::openReadStartHead(int event, Ev
goto Ldone;
// an object needs to be outside the aggregation window in order to be
// be evacuated as it is read
- if (!dir_agg_valid(part, &dir)) {
+ if (!dir_agg_valid(vol, &dir)) {
// a directory entry which is nolonger valid may have been overwritten
- if (!dir_valid(part, &dir))
+ if (!dir_valid(vol, &dir))
last_collision = NULL;
goto Lread;
}
@@ -981,7 +981,7 @@ CacheVC::openReadStartHead(int event, Ev
else
Warning("Head : Doc magic does not match for %s", key.string(tmpstring));
// remove the dir entry
- dir_delete(&key, part, &dir);
+ dir_delete(&key, vol, &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
@@ -1003,7 +1003,7 @@ CacheVC::openReadStartHead(int event, Ev
if (vector.get_handles(doc->hdr(), doc->hlen) != doc->hlen) {
if (buf) {
Note("OpenReadHead failed for cachekey %X : vector inconsistency with %d", key.word(0), doc->hlen);
- dir_delete(&key, part, &dir);
+ dir_delete(&key, vol, &dir);
}
err = ECACHE_BAD_META_DATA;
goto Ldone;
@@ -1024,7 +1024,7 @@ CacheVC::openReadStartHead(int event, Ev
if (!alternate_tmp->valid()) {
if (buf) {
Note("OpenReadHead failed for cachekey %X : alternate inconsistency", key.word(0));
- dir_delete(&key, part, &dir);
+ dir_delete(&key, vol, &dir);
}
goto Ldone;
}
@@ -1055,16 +1055,16 @@ CacheVC::openReadStartHead(int event, Ev
goto Learliest;
#ifdef HIT_EVACUATE
- if (part->within_hit_evacuate_window(&dir) &&
+ if (vol->within_hit_evacuate_window(&dir) &&
(!cache_config_hit_evacuate_size_limit || doc_len <= cache_config_hit_evacuate_size_limit)) {
DDebug("cache_hit_evac", "dir: %d, write: %d, phase: %d",
- dir_offset(&dir), offset_to_part_offset(part, part->header->write_pos), part->header->phase);
+ dir_offset(&dir), offset_to_vol_offset(vol, vol->header->write_pos), vol->header->phase);
f.hit_evacuate = 1;
}
#endif
first_buf = buf;
- part->begin_read(this);
+ vol->begin_read(this);
goto Lsuccess;
@@ -1074,7 +1074,7 @@ CacheVC::openReadStartHead(int event, Ev
// 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 = part->open_read(&key);
+ OpenDirEntry *cod = vol->open_read(&key);
if (cod && !f.read_from_writer_called) {
if (f.lookup) {
err = ECACHE_DOC_BUSY;
@@ -1085,7 +1085,7 @@ CacheVC::openReadStartHead(int event, Ev
SET_HANDLER(&CacheVC::openReadFromWriter);
return handleEvent(EVENT_IMMEDIATE, 0);
}
- if (dir_probe(&key, part, &dir, &last_collision)) {
+ if (dir_probe(&key, vol, &dir, &last_collision)) {
first_dir = dir;
int ret = do_read_call(&key);
if (ret == EVENT_RETURN)
Modified: trafficserver/traffic/trunk/iocore/cache/CacheWrite.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CacheWrite.cc?rev=1086711&r1=1086710&r2=1086711&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CacheWrite.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CacheWrite.cc Tue Mar 29 20:12:11 2011
@@ -66,7 +66,7 @@ CacheVC::updateVector(int event, Event *
VC_SCHED_LOCK_RETRY();
int ret = 0;
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock || od->writing_vec)
VC_SCHED_LOCK_RETRY();
@@ -82,7 +82,7 @@ CacheVC::updateVector(int event, Event *
write_vector->remove(alternate_index, true);
alternate_index = CACHE_ALT_REMOVED;
if (!write_vector->count())
- dir_delete(&first_key, part, &od->first_dir);
+ dir_delete(&first_key, vol, &od->first_dir);
}
// the alternate is not there any more. somebody might have
// deleted it. Just close this writer
@@ -147,7 +147,7 @@ CacheVC::updateVector(int event, Event *
agg queue. And if !f.evac_vector && !f.update the alternate->object_size
is set to vc->total_len
- f.readers. If set, assumes that this is an evacuation, so the write
- is not aborted even if part->agg_todo_size > agg_write_backlog
+ is not aborted even if vol->agg_todo_size > agg_write_backlog
- f.evacuator. If this is an evacuation.
- f.rewrite_resident_alt. The resident alternate is rewritten.
- f.update. Used only if the write_vector needs to be written to disk.
@@ -185,11 +185,11 @@ CacheVC::handleWrite(int event, Event *e
frag_len = 0;
set_agg_write_in_progress();
POP_HANDLER;
- agg_len = part->round_to_approx_size(write_len + header_len + frag_len + sizeofDoc);
- part->agg_todo_size += agg_len;
+ agg_len = vol->round_to_approx_size(write_len + header_len + frag_len + sizeofDoc);
+ vol->agg_todo_size += agg_len;
bool agg_error =
(agg_len > AGG_SIZE || header_len + sizeofDoc > MAX_FRAG_SIZE ||
- (!f.readers && (part->agg_todo_size > cache_config_agg_write_backlog + AGG_SIZE) && write_len));
+ (!f.readers && (vol->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));
@@ -201,7 +201,7 @@ CacheVC::handleWrite(int event, Event *e
if (agg_error || max_doc_error) {
CACHE_INCREMENT_DYN_STAT(cache_write_backlog_failure_stat);
CACHE_INCREMENT_DYN_STAT(base_stat + CACHE_STAT_FAILURE);
- part->agg_todo_size -= agg_len;
+ vol->agg_todo_size -= agg_len;
io.aio_result = AIO_SOFT_FAILURE;
if (event == EVENT_CALL)
return EVENT_RETURN;
@@ -209,11 +209,11 @@ CacheVC::handleWrite(int event, Event *e
}
ink_assert(agg_len <= AGG_SIZE);
if (f.evac_vector)
- part->agg.push(this);
+ vol->agg.push(this);
else
- part->agg.enqueue(this);
- if (!part->is_io_in_progress())
- return part->aggWrite(event, this);
+ vol->agg.enqueue(this);
+ if (!vol->is_io_in_progress())
+ return vol->aggWrite(event, this);
return EVENT_CONT;
}
@@ -244,7 +244,7 @@ iobufferblock_memcpy(char *p, int len, I
}
EvacuationBlock *
-Part::force_evacuate_head(Dir *evac_dir, int pinned)
+Vol::force_evacuate_head(Dir *evac_dir, int pinned)
{
// build an evacuation block for the object
EvacuationBlock *b = evacuation_block_exists(evac_dir, this);
@@ -268,23 +268,23 @@ Part::force_evacuate_head(Dir *evac_dir,
}
void
-Part::scan_for_pinned_documents()
+Vol::scan_for_pinned_documents()
{
if (cache_config_permit_pinning) {
// we can't evacuate anything between header->write_pos and
// header->write_pos + AGG_SIZE.
- int ps = offset_to_part_offset(this, header->write_pos + AGG_SIZE);
- int pe = offset_to_part_offset(this, header->write_pos + 2 * EVACUATION_SIZE + (len / PIN_SCAN_EVERY));
- int part_end_offset = offset_to_part_offset(this, len + skip);
- int before_end_of_part = pe < part_end_offset;
+ int ps = offset_to_vol_offset(this, header->write_pos + AGG_SIZE);
+ int pe = offset_to_vol_offset(this, header->write_pos + 2 * EVACUATION_SIZE + (len / PIN_SCAN_EVERY));
+ int vol_end_offset = offset_to_vol_offset(this, len + skip);
+ int before_end_of_vol = pe < vol_end_offset;
DDebug("cache_evac", "scan %d %d", ps, pe);
- for (int i = 0; i < part_direntries(this); i++) {
+ for (int i = 0; i < vol_direntries(this); i++) {
// is it a valid pinned object?
if (!dir_is_empty(&dir[i]) && dir_pinned(&dir[i]) && dir_head(&dir[i])) {
// select objects only within this PIN_SCAN region
int o = dir_offset(&dir[i]);
if (dir_phase(&dir[i]) == header->phase) {
- if (before_end_of_part || o >= (pe - part_end_offset))
+ if (before_end_of_vol || o >= (pe - vol_end_offset))
continue;
} else {
if (o<ps || o>= pe)
@@ -304,7 +304,7 @@ Part::scan_for_pinned_documents()
eventProcessor.schedule_xxx().
*/
int
-Part::aggWriteDone(int event, Event *e)
+Vol::aggWriteDone(int event, Event *e)
{
NOWARN_UNUSED(e);
NOWARN_UNUSED(event);
@@ -368,14 +368,14 @@ Part::aggWriteDone(int event, Event *e)
}
CacheVC *
-new_DocEvacuator(int nbytes, Part *part)
+new_DocEvacuator(int nbytes, Vol *vol)
{
- CacheVC *c = new_CacheVC(part);
- ProxyMutex *mutex = part->mutex;
+ CacheVC *c = new_CacheVC(vol);
+ ProxyMutex *mutex = vol->mutex;
c->base_stat = cache_evacuate_active_stat;
CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
c->buf = new_IOBufferData(iobuffer_size_to_index(nbytes, MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
- c->part = part;
+ c->vol = vol;
c->f.evacuator = 1;
c->earliest_key = zero_key;
SET_CONTINUATION_HANDLER(c, &CacheVC::evacuateDocDone);
@@ -388,8 +388,8 @@ CacheVC::evacuateReadHead(int event, Eve
NOWARN_UNUSED(e);
NOWARN_UNUSED(event);
- // The evacuator vc shares the lock with the partition mutex
- ink_debug_assert(part->mutex->thread_holding == this_ethread());
+ // The evacuator vc shares the lock with the volition mutex
+ ink_debug_assert(vol->mutex->thread_holding == this_ethread());
cancel_trigger();
Doc *doc = (Doc *) buf->data();
#ifdef HTTP_CACHE
@@ -398,7 +398,7 @@ CacheVC::evacuateReadHead(int event, Eve
if (!io.ok())
goto Ldone;
// a directory entry which is nolonger valid may have been overwritten
- if (!dir_valid(part, &dir)) {
+ if (!dir_valid(vol, &dir)) {
last_collision = NULL;
goto Lcollision;
}
@@ -434,19 +434,19 @@ CacheVC::evacuateReadHead(int event, Eve
if (doc_len == total_len) {
// the whole document has been evacuated. Insert the directory
// entry in the directory.
- dir_lookaside_fixup(&earliest_key, part);
+ dir_lookaside_fixup(&earliest_key, vol);
return free_CacheVC(this);
}
return EVENT_CONT;
Lcollision:
- if (dir_probe(&first_key, part, &dir, &last_collision)) {
+ if (dir_probe(&first_key, vol, &dir, &last_collision)) {
int ret = do_read_call(&first_key);
if (ret == EVENT_RETURN)
return handleEvent(AIO_EVENT_DONE, 0);
return ret;
}
Ldone:
- dir_lookaside_remove(&earliest_key, part);
+ dir_lookaside_remove(&earliest_key, vol);
return free_CacheVC(this);
}
@@ -456,14 +456,14 @@ CacheVC::evacuateDocDone(int event, Even
NOWARN_UNUSED(e);
NOWARN_UNUSED(event);
- ink_debug_assert(part->mutex->thread_holding == this_ethread());
+ ink_debug_assert(vol->mutex->thread_holding == this_ethread());
Doc *doc = (Doc *) buf->data();
DDebug("cache_evac", "evacuateDocDone %X o %d p %d new_o %d new_p %d",
(int) key.word(0), (int) dir_offset(&overwrite_dir),
(int) dir_phase(&overwrite_dir), (int) dir_offset(&dir), (int) dir_phase(&dir));
int i = dir_evac_bucket(&overwrite_dir);
// nasty beeping race condition, need to have the EvacuationBlock here
- EvacuationBlock *b = part->evacuate[i].head;
+ EvacuationBlock *b = vol->evacuate[i].head;
for (; b; b = b->link.next) {
if (dir_offset(&b->dir) == dir_offset(&overwrite_dir)) {
@@ -486,17 +486,17 @@ CacheVC::evacuateDocDone(int event, Even
evac->key.word(0), evac->earliest_key.word(0));
EvacuationBlock *eblock = 0;
Dir dir_tmp;
- dir_lookaside_probe(&evac->earliest_key, part, &dir_tmp, &eblock);
+ dir_lookaside_probe(&evac->earliest_key, vol, &dir_tmp, &eblock);
if (eblock) {
CacheVC *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, part);
+ dir_lookaside_fixup(&evac->earliest_key, vol);
free_CacheVC(earliest_evac);
}
}
}
- dir_overwrite(&doc->key, part, &dir, &overwrite_dir);
+ dir_overwrite(&doc->key, vol, &dir, &overwrite_dir);
}
// if the tag in the overwrite_dir matches the first_key in the
// document, then it has to be the vector. We gaurantee that
@@ -512,7 +512,7 @@ CacheVC::evacuateDocDone(int event, Even
OpenDirEntry *cod;
DDebug("cache_evac", "evacuating vector: %X %d",
(int) doc->first_key.word(0), (int) dir_offset(&overwrite_dir));
- if ((cod = part->open_read(&doc->first_key))) {
+ if ((cod = vol->open_read(&doc->first_key))) {
// writer exists
DDebug("cache_evac", "overwriting the open directory %X %d %d",
(int) doc->first_key.word(0), (int) dir_offset(&cod->first_dir), (int) dir_offset(&dir));
@@ -520,8 +520,8 @@ CacheVC::evacuateDocDone(int event, Even
cod->first_dir = dir;
}
- if (dir_overwrite(&doc->first_key, part, &dir, &overwrite_dir)) {
- part->ram_cache->fixup(&doc->first_key, 0, dir_offset(&overwrite_dir), 0, dir_offset(&dir));
+ if (dir_overwrite(&doc->first_key, vol, &dir, &overwrite_dir)) {
+ vol->ram_cache->fixup(&doc->first_key, 0, dir_offset(&overwrite_dir), 0, dir_offset(&dir));
}
} else {
DDebug("cache_evac", "evacuating earliest: %X %d", (int) doc->key.word(0), (int) dir_offset(&overwrite_dir));
@@ -530,8 +530,8 @@ CacheVC::evacuateDocDone(int event, Even
total_len += doc->data_len();
first_key = doc->first_key;
earliest_dir = dir;
- if (dir_probe(&first_key, part, &dir, &last_collision) > 0) {
- dir_lookaside_insert(b, part, &earliest_dir);
+ if (dir_probe(&first_key, vol, &dir, &last_collision) > 0) {
+ dir_lookaside_insert(b, vol, &earliest_dir);
// read the vector
SET_HANDLER(&CacheVC::evacuateReadHead);
int ret = do_read_call(&first_key);
@@ -548,22 +548,22 @@ CacheVC::evacuateDocDone(int event, Even
}
static int
-evacuate_fragments(CacheKey *key, CacheKey *earliest_key, int force, Part *part)
+evacuate_fragments(CacheKey *key, CacheKey *earliest_key, int force, Vol *vol)
{
Dir dir, *last_collision = 0;
int i = 0;
- while (dir_probe(key, part, &dir, &last_collision)) {
+ while (dir_probe(key, vol, &dir, &last_collision)) {
// next fragment cannot be a head...if it is, it must have been a
// directory collision.
if (dir_head(&dir))
continue;
- EvacuationBlock *b = evacuation_block_exists(&dir, part);
+ EvacuationBlock *b = evacuation_block_exists(&dir, vol);
if (!b) {
- b = new_EvacuationBlock(part->mutex->thread_holding);
+ b = new_EvacuationBlock(vol->mutex->thread_holding);
b->dir = dir;
b->evac_frags.key = *key;
b->evac_frags.earliest_key = *earliest_key;
- part->evacuate[dir_evac_bucket(&dir)].push(b);
+ vol->evacuate[dir_evac_bucket(&dir)].push(b);
i++;
} else {
ink_assert(dir_offset(&dir) == dir_offset(&b->dir));
@@ -584,7 +584,7 @@ evacuate_fragments(CacheKey *key, CacheK
}
int
-Part::evacuateWrite(CacheVC *evacuator, int event, Event *e)
+Vol::evacuateWrite(CacheVC *evacuator, int event, Event *e)
{
NOWARN_UNUSED(e);
NOWARN_UNUSED(event);
@@ -604,7 +604,7 @@ Part::evacuateWrite(CacheVC *evacuator,
}
int
-Part::evacuateDocReadDone(int event, Event *e)
+Vol::evacuateDocReadDone(int event, Event *e)
{
NOWARN_UNUSED(e);
@@ -692,10 +692,10 @@ Ldone:
}
int
-Part::evac_range(off_t low, off_t high, int evac_phase)
+Vol::evac_range(off_t low, off_t high, int evac_phase)
{
- int s = offset_to_part_offset(this, low);
- int e = offset_to_part_offset(this, high);
+ int s = offset_to_vol_offset(this, low);
+ int e = offset_to_vol_offset(this, high);
int si = dir_offset_evac_bucket(s);
int ei = dir_offset_evac_bucket(e);
@@ -716,7 +716,7 @@ Part::evac_range(off_t low, off_t high,
first->f.done = 1;
io.aiocb.aio_fildes = fd;
io.aiocb.aio_nbytes = dir_approx_size(&first->dir);
- io.aiocb.aio_offset = part_offset(this, &first->dir);
+ io.aiocb.aio_offset = vol_offset(this, &first->dir);
if ((off_t)(io.aiocb.aio_offset + io.aiocb.aio_nbytes) > (off_t)(skip + len))
io.aiocb.aio_nbytes = skip + len - io.aiocb.aio_offset;
doc_evacuator = new_DocEvacuator(io.aiocb.aio_nbytes, this);
@@ -726,7 +726,7 @@ Part::evac_range(off_t low, off_t high,
io.action = this;
io.thread = AIO_CALLBACK_THREAD_ANY;
DDebug("cache_evac", "evac_range evacuating %X %d", (int)dir_tag(&first->dir), (int)dir_offset(&first->dir));
- SET_HANDLER(&Part::evacuateDocReadDone);
+ SET_HANDLER(&Vol::evacuateDocReadDone);
ink_assert(ink_aio_read(&io) >= 0);
return -1;
}
@@ -738,8 +738,8 @@ Part::evac_range(off_t low, off_t high,
static int
agg_copy(char *p, CacheVC *vc)
{
- Part *part = vc->part;
- off_t o = part->header->write_pos + part->agg_buf_pos;
+ Vol *vol = vc->vol;
+ off_t o = vol->header->write_pos + vol->agg_buf_pos;
if (!vc->f.evacuator) {
Doc *doc = (Doc *) p;
@@ -747,12 +747,12 @@ agg_copy(char *p, CacheVC *vc)
uint32_t len = vc->write_len + vc->header_len + vc->frag_len + sizeofDoc;
ink_assert(vc->frag_type != CACHE_FRAG_TYPE_HTTP || len != sizeofDoc);
- ink_debug_assert(part->round_to_approx_size(len) == vc->agg_len);
+ ink_debug_assert(vol->round_to_approx_size(len) == vc->agg_len);
// update copy of directory entry for this document
dir_set_approx_size(&vc->dir, vc->agg_len);
- dir_set_offset(&vc->dir, offset_to_part_offset(part, o));
- ink_assert(part_offset(part, &vc->dir) < (part->skip + part->len));
- dir_set_phase(&vc->dir, part->header->phase);
+ dir_set_offset(&vc->dir, offset_to_vol_offset(vol, o));
+ ink_assert(vol_offset(vol, &vc->dir) < (vol->skip + vol->len));
+ dir_set_phase(&vc->dir, vol->header->phase);
// fill in document header
doc->magic = DOC_MAGIC;
@@ -762,8 +762,8 @@ agg_copy(char *p, CacheVC *vc)
doc->flen = vc->frag_len;
doc->total_len = vc->total_len;
doc->first_key = vc->first_key;
- doc->sync_serial = part->header->sync_serial;
- vc->write_serial = doc->write_serial = part->header->write_serial;
+ doc->sync_serial = vol->header->sync_serial;
+ vc->write_serial = doc->write_serial = vol->header->write_serial;
doc->checksum = DOC_NO_CHECKSUM;
if (vc->pin_in_cache) {
dir_set_pinned(&vc->dir, 1);
@@ -826,7 +826,7 @@ agg_copy(char *p, CacheVC *vc)
// move data
if (vc->write_len) {
{
- ProxyMutex RELEASE_UNUSED *mutex = vc->part->mutex;
+ ProxyMutex RELEASE_UNUSED *mutex = vc->vol->mutex;
ink_debug_assert(mutex->thread_holding == this_ethread());
CACHE_DEBUG_SUM_DYN_STAT(cache_write_bytes_stat, vc->write_len);
}
@@ -864,35 +864,35 @@ agg_copy(char *p, CacheVC *vc)
} else {
// for evacuated documents, copy the data, and update directory
Doc *doc = (Doc *) vc->buf->data();
- int l = vc->part->round_to_approx_size(doc->len);
+ int l = vc->vol->round_to_approx_size(doc->len);
{
- ProxyMutex RELEASE_UNUSED *mutex = vc->part->mutex;
+ ProxyMutex RELEASE_UNUSED *mutex = vc->vol->mutex;
ink_debug_assert(mutex->thread_holding == this_ethread());
CACHE_DEBUG_INCREMENT_DYN_STAT(cache_gc_frags_evacuated_stat);
CACHE_DEBUG_SUM_DYN_STAT(cache_gc_bytes_evacuated_stat, l);
}
- doc->sync_serial = vc->part->header->sync_serial;
- doc->write_serial = vc->part->header->write_serial;
+ doc->sync_serial = vc->vol->header->sync_serial;
+ doc->write_serial = vc->vol->header->write_serial;
memcpy(p, doc, doc->len);
vc->dir = vc->overwrite_dir;
- dir_set_offset(&vc->dir, offset_to_part_offset(vc->part, o));
- dir_set_phase(&vc->dir, vc->part->header->phase);
+ dir_set_offset(&vc->dir, offset_to_vol_offset(vc->vol, o));
+ dir_set_phase(&vc->dir, vc->vol->header->phase);
return l;
}
}
inline void
-Part::evacuate_cleanup_blocks(int i)
+Vol::evacuate_cleanup_blocks(int i)
{
EvacuationBlock *b = evacuate[i].head;
while (b) {
if (b->f.done &&
((header->phase != dir_phase(&b->dir) &&
- header->write_pos > part_offset(this, &b->dir)) ||
- (header->phase == dir_phase(&b->dir) && header->write_pos <= part_offset(this, &b->dir)))) {
+ header->write_pos > vol_offset(this, &b->dir)) ||
+ (header->phase == dir_phase(&b->dir) && header->write_pos <= vol_offset(this, &b->dir)))) {
EvacuationBlock *x = b;
DDebug("cache_evac", "evacuate cleanup free %X offset %d",
(int) b->evac_frags.key.word(0), (int) dir_offset(&b->dir));
@@ -906,7 +906,7 @@ Part::evacuate_cleanup_blocks(int i)
}
void
-Part::evacuate_cleanup()
+Vol::evacuate_cleanup()
{
int64_t eo = ((header->write_pos - start) / CACHE_BLOCK_SIZE) + 1;
int64_t e = dir_offset_evac_bucket(eo);
@@ -932,7 +932,7 @@ Part::evacuate_cleanup()
}
void
-Part::periodic_scan()
+Vol::periodic_scan()
{
evacuate_cleanup();
scan_for_pinned_documents();
@@ -942,7 +942,7 @@ Part::periodic_scan()
}
void
-Part::agg_wrap()
+Vol::agg_wrap()
{
header->write_pos = start;
header->phase = !header->phase;
@@ -950,7 +950,7 @@ Part::agg_wrap()
header->cycle++;
header->agg_pos = header->write_pos;
dir_lookaside_cleanup(this);
- dir_clean_part(this);
+ dir_clean_vol(this);
periodic_scan();
}
@@ -962,7 +962,7 @@ Part::agg_wrap()
the eventProcessor to schedule events
*/
int
-Part::aggWrite(int event, void *e)
+Vol::aggWrite(int event, void *e)
{
NOWARN_UNUSED(e);
NOWARN_UNUSED(event);
@@ -1007,7 +1007,7 @@ Lagain:
return EVENT_CONT;
if (header->write_pos == start) {
// write aggregation too long, bad bad, punt on everything.
- Note("write aggregation exceeds part size");
+ Note("write aggregation exceeds vol size");
ink_assert(!tocall.head);
ink_assert(false);
while ((c = agg.dequeue())) {
@@ -1059,11 +1059,11 @@ Lagain:
io.action = this;
/*
Callback on AIO thread so that we can issue a new write ASAP
- as all writes are serialized in the partition. This is not necessary
+ as all writes are serialized in the volume. This is not necessary
for reads proceed independently.
*/
io.thread = AIO_CALLBACK_THREAD_AIO;
- SET_HANDLER(&Part::aggWriteDone);
+ SET_HANDLER(&Vol::aggWriteDone);
ink_aio_write(&io);
Lwait:
@@ -1085,15 +1085,15 @@ CacheVC::openWriteCloseDir(int event, Ev
cancel_trigger();
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock) {
SET_HANDLER(&CacheVC::openWriteCloseDir);
ink_debug_assert(!is_io_in_progress());
VC_SCHED_LOCK_RETRY();
}
- part->close_write(this);
+ vol->close_write(this);
if (closed < 0 && fragment)
- dir_delete(&earliest_key, part, &earliest_dir);
+ dir_delete(&earliest_key, vol, &earliest_dir);
}
if (is_debug_tag_set("cache_update")) {
if (f.update && closed > 0) {
@@ -1125,7 +1125,7 @@ CacheVC::openWriteCloseDir(int event, Ev
}
if (f.close_complete) {
recursive++;
- ink_debug_assert(!part || this_ethread() != part->mutex->thread_holding);
+ ink_debug_assert(!vol || this_ethread() != vol->mutex->thread_holding);
vio._cont->handleEvent(VC_EVENT_WRITE_COMPLETE, (void *) &vio);
recursive--;
}
@@ -1141,7 +1141,7 @@ CacheVC::openWriteCloseHeadDone(int even
else if (is_io_in_progress())
return EVENT_CONT;
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_LOCK_RETRY_EVENT();
od->writing_vec = 0;
@@ -1150,14 +1150,14 @@ CacheVC::openWriteCloseHeadDone(int even
ink_assert(f.use_first_key);
if (!od->dont_update_directory) {
if (dir_is_empty(&od->first_dir)) {
- dir_insert(&first_key, part, &dir);
+ dir_insert(&first_key, vol, &dir);
} else {
// multiple fragment vector write
- dir_overwrite(&first_key, part, &dir, &od->first_dir, false);
+ dir_overwrite(&first_key, vol, &dir, &od->first_dir, false);
// insert moved resident alternate
if (od->move_resident_alt) {
- if (dir_valid(part, &od->single_doc_dir))
- dir_insert(&od->single_doc_key, part, &od->single_doc_dir);
+ if (dir_valid(vol, &od->single_doc_dir))
+ dir_insert(&od->single_doc_key, vol, &od->single_doc_dir);
od->move_resident_alt = 0;
}
}
@@ -1219,7 +1219,7 @@ CacheVC::openWriteCloseDataDone(int even
if (!io.ok())
return openWriteCloseDir(event, e);
{
- CACHE_TRY_LOCK(lock, part->mutex, this_ethread());
+ CACHE_TRY_LOCK(lock, vol->mutex, this_ethread());
if (!lock)
VC_LOCK_RETRY_EVENT();
if (!fragment) {
@@ -1241,7 +1241,7 @@ CacheVC::openWriteCloseDataDone(int even
}
fragment++;
write_pos += write_len;
- dir_insert(&key, part, &dir);
+ dir_insert(&key, vol, &dir);
blocks = iobufferblock_skip(blocks, &offset, &length, write_len);
next_CacheKey(&key, &key);
if (length) {
@@ -1253,7 +1253,7 @@ CacheVC::openWriteCloseDataDone(int even
return ret;
}
f.data_done = 1;
- return openWriteCloseHead(event, e); // must be called under part lock from here
+ return openWriteCloseHead(event, e); // must be called under vol lock from here
}
Lcallreturn:
return handleEvent(AIO_EVENT_DONE, 0);
@@ -1319,7 +1319,7 @@ CacheVC::openWriteWriteDone(int event, E
return calluser(VC_EVENT_ERROR);
}
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_LOCK_RETRY_EVENT();
// store the earliest directory. Need to remove the earliest dir
@@ -1343,7 +1343,7 @@ CacheVC::openWriteWriteDone(int event, E
}
fragment++;
write_pos += write_len;
- dir_insert(&key, part, &dir);
+ dir_insert(&key, vol, &dir);
DDebug("cache_insert", "WriteDone: %X, %X, %d", key.word(0), first_key.word(0), write_len);
blocks = iobufferblock_skip(blocks, &offset, &length, write_len);
next_CacheKey(&key, &key);
@@ -1455,10 +1455,10 @@ CacheVC::openWriteOverwrite(int event, E
}
Lcollision:
{
- CACHE_TRY_LOCK(lock, part->mutex, this_ethread());
+ CACHE_TRY_LOCK(lock, vol->mutex, this_ethread());
if (!lock)
VC_LOCK_RETRY_EVENT();
- int res = dir_probe(&first_key, part, &dir, &last_collision);
+ int res = dir_probe(&first_key, vol, &dir, &last_collision);
if (res > 0) {
if ((res = do_read_call(&first_key)) == EVENT_RETURN)
goto Lcallreturn;
@@ -1502,10 +1502,10 @@ CacheVC::openWriteStartDone(int event, E
We need to start afresh from the beginning by setting last_collision
to NULL.
*/
- if (!dir_valid(part, &dir)) {
+ if (!dir_valid(vol, &dir)) {
DDebug("cache_write",
"OpenReadStartDone: Dir not valid: Write Head: %d, Dir: %d",
- offset_to_part_offset(part, part->header->write_pos), dir_offset(&dir));
+ offset_to_vol_offset(vol, vol->header->write_pos), dir_offset(&dir));
last_collision = NULL;
goto Lcollision;
}
@@ -1542,11 +1542,11 @@ CacheVC::openWriteStartDone(int event, E
Lcollision:
{
int if_writers = ((uintptr_t) info == CACHE_ALLOW_MULTIPLE_WRITES);
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock)
VC_LOCK_RETRY_EVENT();
if (!od) {
- if ((err = part->open_write(
+ if ((err = vol->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()) {
@@ -1556,7 +1556,7 @@ Lcollision:
}
}
// check for collision
- if (dir_probe(&first_key, part, &dir, &last_collision)) {
+ if (dir_probe(&first_key, vol, &dir, &last_collision)) {
od->reading_vec = 1;
int ret = do_read_call(&first_key);
if (ret == EVENT_RETURN)
@@ -1600,7 +1600,7 @@ CacheVC::openWriteStartBegin(int event,
cancel_trigger();
if (_action.cancelled)
return free_CacheVC(this);
- if (((err = part->open_write_lock(this, false, 1)) > 0)) {
+ if (((err = vol->open_write_lock(this, false, 1)) > 0)) {
CACHE_INCREMENT_DYN_STAT(base_stat + CACHE_STAT_FAILURE);
free_CacheVC(this);
_action.continuation->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -err);
@@ -1637,8 +1637,8 @@ Cache::open_write(Continuation *cont, Ca
MUTEX_LOCK(lock, c->mutex, this_ethread());
c->vio.op = VIO::WRITE;
c->base_stat = cache_write_active_stat;
- c->part = key_to_part(key, hostname, host_len);
- Part *part = c->part;
+ c->vol = key_to_vol(key, hostname, host_len);
+ Vol *vol = c->vol;
CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
c->first_key = c->key = *key;
c->frag_type = frag_type;
@@ -1661,7 +1661,7 @@ Cache::open_write(Continuation *cont, Ca
c->f.sync = (options & CACHE_WRITE_OPT_SYNC) == CACHE_WRITE_OPT_SYNC;
c->pin_in_cache = (uint32_t) apin_in_cache;
- if ((res = c->part->open_write_lock(c, false, 1)) > 0) {
+ if ((res = c->vol->open_write_lock(c, false, 1)) > 0) {
// document currently being written, abort
CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_FAILURE);
cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -res);
@@ -1719,8 +1719,8 @@ Cache::open_write(Continuation *cont, Ca
while (DIR_MASK_TAG(c->key.word(2)) == DIR_MASK_TAG(c->first_key.word(2)));
c->earliest_key = c->key;
c->frag_type = CACHE_FRAG_TYPE_HTTP;
- c->part = key_to_part(key, hostname, host_len);
- Part *part = c->part;
+ c->vol = key_to_vol(key, hostname, host_len);
+ Vol *vol = c->vol;
c->info = info;
if (c->info && (uintptr_t) info != CACHE_ALLOW_MULTIPLE_WRITES) {
/*
@@ -1764,9 +1764,9 @@ Cache::open_write(Continuation *cont, Ca
c->pin_in_cache = (uint32_t) apin_in_cache;
{
- CACHE_TRY_LOCK(lock, c->part->mutex, cont->mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, c->vol->mutex, cont->mutex->thread_holding);
if (lock) {
- if ((err = c->part->open_write(c, if_writers,
+ if ((err = c->vol->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.
@@ -1774,7 +1774,7 @@ Cache::open_write(Continuation *cont, Ca
// return success to the state machine now.;
if (c->od->has_multiple_writers())
goto Lmiss;
- if (!dir_probe(key, c->part, &c->dir, &c->last_collision)) {
+ if (!dir_probe(key, c->vol, &c->dir, &c->last_collision)) {
if (c->f.update) {
// fail update because vector has been GC'd
// This situation can also arise in openWriteStartDone
Modified: trafficserver/traffic/trunk/iocore/cache/P_CacheDir.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/P_CacheDir.h?rev=1086711&r1=1086710&r2=1086711&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/P_CacheDir.h (original)
+++ trafficserver/traffic/trunk/iocore/cache/P_CacheDir.h Tue Mar 29 20:12:11 2011
@@ -27,7 +27,7 @@
#include "P_CacheHttp.h"
-struct Part;
+struct Vol;
struct CacheVC;
/*
@@ -84,18 +84,18 @@ struct CacheVC;
} while(0)
// entry is valid
#define dir_valid(_d, _e) \
- (_d->header->phase == dir_phase(_e) ? part_in_phase_valid(_d, _e) : \
- part_out_of_phase_valid(_d, _e))
+ (_d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) : \
+ vol_out_of_phase_valid(_d, _e))
// entry is valid and outside of write aggregation region
#define dir_agg_valid(_d, _e) \
- (_d->header->phase == dir_phase(_e) ? part_in_phase_valid(_d, _e) : \
- part_out_of_phase_agg_valid(_d, _e))
+ (_d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) : \
+ vol_out_of_phase_agg_valid(_d, _e))
// entry may be valid or overwritten in the last aggregated write
#define dir_write_valid(_d, _e) \
- (_d->header->phase == dir_phase(_e) ? part_in_phase_valid(_d, _e) : \
- part_out_of_phase_write_valid(_d, _e))
+ (_d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) : \
+ vol_out_of_phase_write_valid(_d, _e))
#define dir_agg_buf_valid(_d, _e) \
- (_d->header->phase == dir_phase(_e) && part_in_phase_agg_buf_valid(_d, _e))
+ (_d->header->phase == dir_phase(_e) && vol_in_phase_agg_buf_valid(_d, _e))
#define dir_is_empty(_e) (!dir_offset(_e))
#define dir_clear(_e) do { \
(_e)->w[0] = 0; \
@@ -105,7 +105,7 @@ struct CacheVC;
(_e)->w[4] = 0; \
} while (0)
#define dir_clean(_e) dir_set_offset(_e,0)
-#define dir_segment(_s, _d) part_dir_segment(_d, _s)
+#define dir_segment(_s, _d) vol_dir_segment(_d, _s)
// OpenDir
@@ -216,7 +216,7 @@ struct FreeDir
// INKqa11166 - Cache can not store 2 HTTP alternates simultaneously.
// To allow this, move the vector from the CacheVC to the OpenDirEntry.
// Each CacheVC now maintains a pointer to this vector. Adding/Deleting
-// alternates from this vector is done under the Part::lock. The alternate
+// alternates from this vector is done under the Vol::lock. The alternate
// is deleted/inserted into the vector just before writing the vector disk
// (CacheVC::updateVector).
LINK_FORWARD_DECLARATION(CacheVC, opendir_link) // forward declaration
@@ -263,7 +263,7 @@ struct OpenDir: public Continuation
struct CacheSync: public Continuation
{
- int part;
+ int vol;
char *buf;
int buflen;
int writepos;
@@ -272,7 +272,7 @@ struct CacheSync: public Continuation
int mainEvent(int event, Event *e);
void aio_write(int fd, char *b, int n, off_t o);
- CacheSync():Continuation(new_ProxyMutex()), part(0), buf(0), buflen(0), writepos(0), trigger(0)
+ CacheSync():Continuation(new_ProxyMutex()), vol(0), buf(0), buflen(0), writepos(0), trigger(0)
{
SET_HANDLER(&CacheSync::mainEvent);
}
@@ -280,26 +280,26 @@ struct CacheSync: public Continuation
// Global Functions
-void part_init_dir(Part *d);
-int dir_token_probe(CacheKey *, Part *, Dir *);
-int dir_probe(CacheKey *, Part *, Dir *, Dir **);
-int dir_insert(CacheKey *key, Part *d, Dir *to_part);
-int dir_overwrite(CacheKey *key, Part *d, Dir *to_part, Dir *overwrite, bool must_overwrite = true);
-int dir_delete(CacheKey *key, Part *d, Dir *del);
-int dir_lookaside_probe(CacheKey *key, Part *d, Dir *result, EvacuationBlock ** eblock);
-int dir_lookaside_insert(EvacuationBlock *b, Part *d, Dir *to);
-int dir_lookaside_fixup(CacheKey *key, Part *d);
-void dir_lookaside_cleanup(Part *d);
-void dir_lookaside_remove(CacheKey *key, Part *d);
-void dir_free_entry(Dir *e, int s, Part *d);
+void vol_init_dir(Vol *d);
+int dir_token_probe(CacheKey *, Vol *, Dir *);
+int dir_probe(CacheKey *, Vol *, Dir *, Dir **);
+int dir_insert(CacheKey *key, Vol *d, Dir *to_part);
+int dir_overwrite(CacheKey *key, Vol *d, Dir *to_part, Dir *overwrite, bool must_overwrite = true);
+int dir_delete(CacheKey *key, Vol *d, Dir *del);
+int dir_lookaside_probe(CacheKey *key, Vol *d, Dir *result, EvacuationBlock ** eblock);
+int dir_lookaside_insert(EvacuationBlock *b, Vol *d, Dir *to);
+int dir_lookaside_fixup(CacheKey *key, Vol *d);
+void dir_lookaside_cleanup(Vol *d);
+void dir_lookaside_remove(CacheKey *key, Vol *d);
+void dir_free_entry(Dir *e, int s, Vol *d);
void dir_sync_init();
-int check_dir(Part *d);
-void dir_clean_part(Part *d);
-void dir_clear_range(off_t start, off_t end, Part *d);
-int dir_segment_accounted(int s, Part *d, int offby = 0,
+int check_dir(Vol *d);
+void dir_clean_vol(Vol *d);
+void dir_clear_range(off_t start, off_t end, Vol *d);
+int dir_segment_accounted(int s, Vol *d, int offby = 0,
int *free = 0, int *used = 0,
int *empty = 0, int *valid = 0, int *agg_valid = 0, int *avg_size = 0);
-uint64_t dir_entries_used(Part *d);
+uint64_t dir_entries_used(Vol *d);
void sync_cache_dir_on_shutdown();
// Global Data
Modified: trafficserver/traffic/trunk/iocore/cache/P_CacheDisk.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/P_CacheDisk.h?rev=1086711&r1=1086710&r2=1086711&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/P_CacheDisk.h (original)
+++ trafficserver/traffic/trunk/iocore/cache/P_CacheDisk.h Tue Mar 29 20:12:11 2011
@@ -33,19 +33,19 @@ extern int cache_config_max_disk_errors;
#define SET_DISK_BAD(_x) (_x->num_errors = cache_config_max_disk_errors)
#define SET_DISK_OKAY(_x) (_x->num_errors = 0)
-#define PART_BLOCK_SIZE (1024 * 1024 * 128)
-#define MIN_PART_SIZE PART_BLOCK_SIZE
-#define ROUND_DOWN_TO_PART_BLOCK(_x) (((_x) &~ (PART_BLOCK_SIZE - 1)))
-#define PART_BLOCK_SHIFT 27
+#define VOL_BLOCK_SIZE (1024 * 1024 * 128)
+#define MIN_VOL_SIZE VOL_BLOCK_SIZE
+#define ROUND_DOWN_TO_VOL_BLOCK(_x) (((_x) &~ (VOL_BLOCK_SIZE - 1)))
+#define VOL_BLOCK_SHIFT 27
#define ROUND_DOWN_TO_STORE_BLOCK(_x) (((_x) >> STORE_BLOCK_SHIFT) << STORE_BLOCK_SHIFT)
-#define STORE_BLOCKS_PER_PART (PART_BLOCK_SIZE / STORE_BLOCK_SIZE)
+#define STORE_BLOCKS_PER_VOL (VOL_BLOCK_SIZE / STORE_BLOCK_SIZE)
#define DISK_HEADER_MAGIC 0xABCD1236
-/* each disk part block has a corresponding Part object */
+/* each disk vol block has a corresponding Vol object */
struct CacheDisk;
-struct DiskPartBlock
+struct DiskVolBlock
{
off_t offset;
unsigned short number;
@@ -55,38 +55,38 @@ struct DiskPartBlock
unsigned int unused:2;
};
-struct DiskPartBlockQueue
+struct DiskVolBlockQueue
{
- DiskPartBlock *b;
- int new_block; /* whether an existing part or a new one */
- LINK(DiskPartBlockQueue, link);
- DiskPartBlockQueue():b(NULL), new_block(0)
- {
- }
+ DiskVolBlock *b;
+ int new_block; /* whether an existing vol or a new one */
+ LINK(DiskVolBlockQueue, link);
+
+ DiskVolBlockQueue()
+ : b(NULL), new_block(0)
+ { }
};
-struct DiskPart
+struct DiskVol
{
- int num_partblocks; /* number of disk partition blocks in this discrete
- partition */
- int part_number; /* the partition number of this partition */
- off_t size; /* size in store blocks */
+ int num_volblocks; /* number of disk volume blocks in this volume */
+ int vol_number; /* the volume number of this volume */
+ off_t size; /* size in store blocks */
CacheDisk *disk;
- Queue<DiskPartBlockQueue> dpb_queue;
+ Queue<DiskVolBlockQueue> dpb_queue;
};
struct DiskHeader
{
unsigned int magic;
- unsigned int num_partitions; /* number of discrete partitions (DiskPart) */
- unsigned int num_free; /* number of disk partition blocks free */
- unsigned int num_used; /* number of disk partition blocks in use */
- unsigned int num_diskpart_blks; /* number of disk partition blocks */
+ unsigned int num_volumes; /* number of discrete volumes (DiskVol) */
+ unsigned int num_free; /* number of disk volume blocks free */
+ unsigned int num_used; /* number of disk volume blocks in use */
+ unsigned int num_diskvol_blks; /* number of disk volume blocks */
off_t num_blocks;
- DiskPartBlock part_info[1];
+ DiskVolBlock vol_info[1];
};
-struct CacheDisk:public Continuation
+struct CacheDisk: public Continuation
{
DiskHeader *header;
char *path;
@@ -100,20 +100,21 @@ struct CacheDisk:public Continuation
int fd;
off_t free_space;
off_t wasted_space;
- DiskPart **disk_parts;
- DiskPart *free_blocks;
+ DiskVol **disk_vols;
+ DiskVol *free_blocks;
int num_errors;
int cleared;
- int open(bool clear);
- CacheDisk():Continuation(new_ProxyMutex()), header(NULL),
- path(NULL), header_len(0), len(0), start(0), skip(0),
- num_usable_blocks(0), fd(-1), free_space(0), wasted_space(0),
- disk_parts(NULL), free_blocks(NULL), num_errors(0), cleared(0)
- {
- }
+ CacheDisk()
+ : Continuation(new_ProxyMutex()), header(NULL),
+ path(NULL), header_len(0), len(0), start(0), skip(0),
+ num_usable_blocks(0), fd(-1), free_space(0), wasted_space(0),
+ disk_vols(NULL), free_blocks(NULL), num_errors(0), cleared(0)
+ { }
~CacheDisk();
+
+ int open(bool clear);
int open(char *s, off_t blocks, off_t skip, int hw_sector_size, int fildes, bool clear);
int clearDisk();
int clearDone(int event, void *data);
@@ -121,11 +122,11 @@ struct CacheDisk:public Continuation
int openDone(int event, void *data);
int sync();
int syncDone(int event, void *data);
- DiskPartBlock *create_partition(int number, off_t size, int scheme);
- int delete_partition(int number);
- int delete_all_partitions();
+ DiskVolBlock *create_volume(int number, off_t size, int scheme);
+ int delete_volume(int number);
+ int delete_all_volumes();
void update_header();
- DiskPart *get_diskpart(int part_number);
+ DiskVol *get_diskvol(int vol_number);
};
Modified: trafficserver/traffic/trunk/iocore/cache/P_CacheHosting.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/P_CacheHosting.h?rev=1086711&r1=1086710&r2=1086711&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/P_CacheHosting.h (original)
+++ trafficserver/traffic/trunk/iocore/cache/P_CacheHosting.h Tue Mar 29 20:12:11 2011
@@ -27,55 +27,53 @@
#define CACHE_MEM_FREE_TIMEOUT HRTIME_SECONDS(1)
-struct Part;
-struct CachePart;
+struct Vol;
+struct CacheVol;
struct CacheHostResult;
-//struct CacheHostRequestData;
struct Cache;
struct CacheHostRecord
{
-
int Init(int typ);
- int Init(matcher_line * line_info, int typ);
- void UpdateMatch(CacheHostResult * r, char *rd);
+ int Init(matcher_line *line_info, int typ);
+ void UpdateMatch(CacheHostResult *r, char *rd);
void Print();
- ~CacheHostRecord()
+ ~CacheHostRecord()
{
- if (parts)
- xfree(parts);
- if (part_hash_table)
- xfree(part_hash_table);
+ if (vols)
+ xfree(vols);
+ if (vol_hash_table)
+ xfree(vol_hash_table);
if (cp)
xfree(cp);
}
int type;
- Part **parts;
- volatile int good_num_part;
- volatile int num_part;
+ Vol **vols;
+ volatile int good_num_vols;
+ volatile int num_vols;
int num_initialized;
- unsigned short *part_hash_table;
- CachePart **cp;
- int num_cachepart;
-CacheHostRecord():
- type(0), parts(NULL), good_num_part(0), num_part(0),
- num_initialized(0), part_hash_table(0), cp(NULL), num_cachepart(0) {
- }
+ unsigned short *vol_hash_table;
+ CacheVol **cp;
+ int num_cachevols;
+
+ CacheHostRecord():
+ type(0), vols(NULL), good_num_vols(0), num_vols(0),
+ num_initialized(0), vol_hash_table(0), cp(NULL), num_cachevols(0)
+ { }
};
-void build_part_hash_table(CacheHostRecord * cp);
+void build_vol_hash_table(CacheHostRecord *cp);
struct CacheHostResult
{
-
CacheHostRecord *record;
- CacheHostResult():record(NULL)
- {
- }
+ CacheHostResult()
+ : record(NULL)
+ { }
};
@@ -83,23 +81,17 @@ class CacheHostMatcher
{
public:
CacheHostMatcher(const char *name, const char *filename, int typ);
- ~CacheHostMatcher();
- void Match(char *rdata, int rlen, CacheHostResult * result);
+ ~CacheHostMatcher();
+
+ void Match(char *rdata, int rlen, CacheHostResult *result);
void AllocateSpace(int num_entries);
- void NewEntry(matcher_line * line_info);
+ void NewEntry(matcher_line *line_info);
void Print();
- int getNumElements()
- {
- return num_el;
- };
- CacheHostRecord *getDataArray()
- {
- return data_array;
- };
- HostLookup *getHLookup()
- {
- return host_lookup;
- };
+
+ int getNumElements() const { return num_el; }
+ CacheHostRecord *getDataArray() const { return data_array; }
+ HostLookup *getHLookup() const { return host_lookup; }
+
private:
static void PrintFunc(void *opaque_data);
HostLookup *host_lookup; // Data structure to do the lookups
@@ -116,39 +108,33 @@ class CacheHostTable
public:
// Parameter name must not be deallocated before this
// object is
- CacheHostTable(Cache * c, int typ);
+ CacheHostTable(Cache *c, int typ);
~CacheHostTable();
int BuildTable();
int BuildTableFromString(char *str);
- void Match(char *rdata, int rlen, CacheHostResult * result);
+ void Match(char *rdata, int rlen, CacheHostResult *result);
void Print();
- int getEntryCount()
- {
- return m_numEntries;
- }
- CacheHostMatcher *getHostMatcher()
- {
- return hostMatch;
- }
+
+ int getEntryCount() const { return m_numEntries; }
+ CacheHostMatcher *getHostMatcher() const { return hostMatch; }
static int config_callback(const char *, RecDataT, RecData, void *);
+
void register_config_callback(CacheHostTable ** p)
{
IOCORE_RegisterConfigUpdateFunc("proxy.config.cache.hosting_filename", CacheHostTable::config_callback, (void *) p);
}
-
int type;
Cache *cache;
int m_numEntries;
CacheHostRecord gen_host_rec;
private:
- CacheHostMatcher * hostMatch;
+ CacheHostMatcher *hostMatch;
const matcher_tags *config_tags;
char config_file_path[PATH_NAME_MAX];
const char *matcher_name; // Used for Debug/Warning/Error messages
-
};
struct CacheHostTableConfig;
@@ -156,12 +142,13 @@ typedef int (CacheHostTableConfig::*Cach
struct CacheHostTableConfig: public Continuation
{
CacheHostTable **ppt;
- CacheHostTableConfig(CacheHostTable ** appt)
- : Continuation(NULL), ppt(appt)
+ CacheHostTableConfig(CacheHostTable ** appt)
+ : Continuation(NULL), ppt(appt)
{
SET_HANDLER((CacheHostTabHandler) & CacheHostTableConfig::mainEvent);
}
- int mainEvent(int event, Event * e)
+
+ int mainEvent(int event, Event *e)
{
(void) e;
(void) event;
@@ -173,39 +160,38 @@ struct CacheHostTableConfig: public Cont
};
-/* list of partitions in the partition.config file */
-struct ConfigPart
+/* list of volumes in the volume.config file */
+struct ConfigVol
{
int number;
int scheme;
int size;
bool in_percent;
int percent;
- CachePart *cachep;
- LINK(ConfigPart, link);
+ CacheVol *cachep;
+ LINK(ConfigVol, link);
};
-struct ConfigPartitions
+struct ConfigVolumes
{
- int num_partitions;
- int num_http_partitions;
- int num_stream_partitions;
- Queue<ConfigPart> cp_queue;
+ int num_volumes;
+ int num_http_volumes;
+ int num_stream_volumes;
+ Queue<ConfigVol> cp_queue;
void read_config_file();
void BuildListFromString(char *config_file_path, char *file_buf);
+
void clear_all(void)
{
- // remove all the partitions from the queue
- for (int i = 0; i < num_partitions; i++)
- {
+ // remove all the volumes from the queue
+ for (int i = 0; i < num_volumes; i++) {
cp_queue.pop();
}
// reset count variables
- num_partitions = 0;
- num_http_partitions = 0;
- num_stream_partitions = 0;
+ num_volumes = 0;
+ num_http_volumes = 0;
+ num_stream_volumes = 0;
}
-
};
#endif
Modified: trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h?rev=1086711&r1=1086710&r2=1086711&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h (original)
+++ trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h Tue Mar 29 20:12:11 2011
@@ -169,40 +169,40 @@ extern RecRawStatBlock *cache_rsb;
#define CACHE_SET_DYN_STAT(x,y) \
RecSetGlobalRawStatSum(cache_rsb, (x), (y)) \
- RecSetGlobalRawStatSum(part->cache_part->part_rsb, (x), (y))
+ RecSetGlobalRawStatSum(vol->cache_vol->vol_rsb, (x), (y))
#define CACHE_INCREMENT_DYN_STAT(x) \
RecIncrRawStat(cache_rsb, mutex->thread_holding, (int) (x), 1); \
- RecIncrRawStat(part->cache_part->part_rsb, mutex->thread_holding, (int) (x), 1);
+ RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int) (x), 1);
#define CACHE_DECREMENT_DYN_STAT(x) \
RecIncrRawStat(cache_rsb, mutex->thread_holding, (int) (x), -1); \
- RecIncrRawStat(part->cache_part->part_rsb, mutex->thread_holding, (int) (x), -1);
+ RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int) (x), -1);
-#define CACHE_PART_SUM_DYN_STAT(x,y) \
- RecIncrRawStat(part->cache_part->part_rsb, mutex->thread_holding, (int) (x), (int) y);
+#define CACHE_VOL_SUM_DYN_STAT(x,y) \
+ RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int) (x), (int) y);
#define CACHE_SUM_DYN_STAT(x, y) \
RecIncrRawStat(cache_rsb, mutex->thread_holding, (int) (x), (int) (y)); \
- RecIncrRawStat(part->cache_part->part_rsb, mutex->thread_holding, (int) (x), (int) (y));
+ RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int) (x), (int) (y));
#define CACHE_SUM_DYN_STAT_THREAD(x, y) \
RecIncrRawStat(cache_rsb, this_ethread(), (int) (x), (int) (y)); \
- RecIncrRawStat(part->cache_part->part_rsb, this_ethread(), (int) (x), (int) (y));
+ RecIncrRawStat(vol->cache_vol->vol_rsb, this_ethread(), (int) (x), (int) (y));
#define GLOBAL_CACHE_SUM_GLOBAL_DYN_STAT(x, y) \
RecIncrGlobalRawStatSum(cache_rsb,(x),(y))
#define CACHE_SUM_GLOBAL_DYN_STAT(x, y) \
RecIncrGlobalRawStatSum(cache_rsb,(x),(y)) \
- RecIncrGlobalRawStatSum(part->cache_part->part_rsb,(x),(y))
+ RecIncrGlobalRawStatSum(vol->cache_vol->vol_rsb,(x),(y))
#define CACHE_CLEAR_DYN_STAT(x) \
do { \
RecSetRawStatSum(cache_rsb, (x), 0); \
RecSetRawStatCount(cache_rsb, (x), 0); \
- RecSetRawStatSum(part->cache_part->part_rsb, (x), 0); \
- RecSetRawStatCount(part->cache_part->part_rsb, (x), 0); \
+ RecSetRawStatSum(vol->cache_vol->vol_rsb, (x), 0); \
+ RecSetRawStatCount(vol->cache_vol->vol_rsb, (x), 0); \
} while (0);
// Configuration
@@ -328,7 +328,7 @@ struct CacheVC: public CacheVConnection
int linkWrite(int event, Event *e);
int derefRead(int event, Event *e);
- int scanPart(int event, Event *e);
+ int scanVol(int event, Event *e);
int scanObject(int event, Event *e);
int scanUpdateDone(int event, Event *e);
int scanOpenWrite(int event, Event *e);
@@ -425,7 +425,7 @@ struct CacheVC: public CacheVConnection
uint32_t write_serial; // serial of the final write for SYNC
Frag *frag; // arraylist of fragment offset
Frag integral_frags[INTEGRAL_FRAGS];
- Part *part;
+ Vol *vol;
Dir *last_collision;
Event *trigger;
CacheKey *read_key;
@@ -498,7 +498,9 @@ struct CacheRemoveCont: public Continuat
{
int event_handler(int event, void *data);
- CacheRemoveCont():Continuation(NULL) { }
+ CacheRemoveCont()
+ : Continuation(NULL)
+ { }
};
@@ -512,8 +514,7 @@ extern CacheSync *cacheDirSync;
int cache_write(CacheVC *, CacheHTTPInfoVector *);
int get_alternate_index(CacheHTTPInfoVector *cache_vector, CacheKey key);
#endif
-int evacuate_segments(CacheKey *key, int force, Part *part);
-CacheVC *new_DocEvacuator(int nbytes, Part *d);
+CacheVC *new_DocEvacuator(int nbytes, Vol *d);
// inline Functions
@@ -544,7 +545,7 @@ free_CacheVC(CacheVC *cont)
{
Debug("cache_free", "free %p", cont);
ProxyMutex *mutex = cont->mutex;
- Part *part = cont->part;
+ Vol *vol = cont->vol;
CACHE_DECREMENT_DYN_STAT(cont->base_stat + CACHE_STAT_ACTIVE);
if (cont->closed > 0) {
CACHE_INCREMENT_DYN_STAT(cont->base_stat + CACHE_STAT_SUCCESS);
@@ -600,7 +601,7 @@ TS_INLINE int
CacheVC::calluser(int event)
{
recursive++;
- ink_debug_assert(!part || this_ethread() != part->mutex->thread_holding);
+ ink_debug_assert(!vol || this_ethread() != vol->mutex->thread_holding);
vio._cont->handleEvent(event, (void *) &vio);
recursive--;
if (closed) {
@@ -614,7 +615,7 @@ TS_INLINE int
CacheVC::callcont(int event)
{
recursive++;
- ink_debug_assert(!part || this_ethread() != part->mutex->thread_holding);
+ ink_debug_assert(!vol || this_ethread() != vol->mutex->thread_holding);
_action.continuation->handleEvent(event, this);
recursive--;
if (closed)
@@ -684,7 +685,7 @@ CacheVC::handleWriteLock(int event, Even
cancel_trigger();
int ret = 0;
{
- CACHE_TRY_LOCK(lock, part->mutex, mutex->thread_holding);
+ CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
if (!lock) {
set_agg_write_in_progress();
trigger = mutex->thread_holding->schedule_in_local(this, HRTIME_MSECONDS(cache_config_mutex_retry_delay));
@@ -716,7 +717,7 @@ CacheVC::writer_done()
{
OpenDirEntry *cod = od;
if (!cod)
- cod = part->open_read(&first_key);
+ cod = vol->open_read(&first_key);
CacheVC *w = (cod) ? cod->writers.head : NULL;
// If the write vc started after the reader, then its not the
// original writer, since we never choose a writer that started
@@ -729,7 +730,7 @@ CacheVC::writer_done()
}
TS_INLINE int
-Part::close_write(CacheVC *cont)
+Vol::close_write(CacheVC *cont)
{
#ifdef CACHE_STAT_PAGES
@@ -742,9 +743,9 @@ Part::close_write(CacheVC *cont)
// Returns 0 on success or a positive error code on failure
TS_INLINE int
-Part::open_write(CacheVC *cont, int allow_if_writers, int max_writers)
+Vol::open_write(CacheVC *cont, int allow_if_writers, int max_writers)
{
- Part *part = this;
+ Vol *vol = this;
bool agg_error = false;
if (!cont->f.remove) {
agg_error = (!cont->f.update && agg_todo_size > cache_config_agg_write_backlog);
@@ -769,7 +770,7 @@ Part::open_write(CacheVC *cont, int allo
}
TS_INLINE int
-Part::close_write_lock(CacheVC *cont)
+Vol::close_write_lock(CacheVC *cont)
{
EThread *t = cont->mutex->thread_holding;
CACHE_TRY_LOCK(lock, mutex, t);
@@ -779,7 +780,7 @@ Part::close_write_lock(CacheVC *cont)
}
TS_INLINE int
-Part::open_write_lock(CacheVC *cont, int allow_if_writers, int max_writers)
+Vol::open_write_lock(CacheVC *cont, int allow_if_writers, int max_writers)
{
EThread *t = cont->mutex->thread_holding;
CACHE_TRY_LOCK(lock, mutex, t);
@@ -789,7 +790,7 @@ Part::open_write_lock(CacheVC *cont, int
}
TS_INLINE OpenDirEntry *
-Part::open_read_lock(INK_MD5 *key, EThread *t)
+Vol::open_read_lock(INK_MD5 *key, EThread *t)
{
CACHE_TRY_LOCK(lock, mutex, t);
if (!lock)
@@ -798,7 +799,7 @@ Part::open_read_lock(INK_MD5 *key, EThre
}
TS_INLINE int
-Part::begin_read_lock(CacheVC *cont)
+Vol::begin_read_lock(CacheVC *cont)
{
// no need for evacuation as the entire document is already in memory
#ifndef CACHE_STAT_PAGES
@@ -814,7 +815,7 @@ Part::begin_read_lock(CacheVC *cont)
}
TS_INLINE int
-Part::close_read_lock(CacheVC *cont)
+Vol::close_read_lock(CacheVC *cont)
{
EThread *t = cont->mutex->thread_holding;
CACHE_TRY_LOCK(lock, mutex, t);
@@ -824,7 +825,7 @@ Part::close_read_lock(CacheVC *cont)
}
TS_INLINE int
-dir_delete_lock(CacheKey *key, Part *d, ProxyMutex *m, Dir *del)
+dir_delete_lock(CacheKey *key, Vol *d, ProxyMutex *m, Dir *del)
{
EThread *thread = m->thread_holding;
CACHE_TRY_LOCK(lock, d->mutex, thread);
@@ -834,7 +835,7 @@ dir_delete_lock(CacheKey *key, Part *d,
}
TS_INLINE int
-dir_insert_lock(CacheKey *key, Part *d, Dir *to_part, ProxyMutex *m)
+dir_insert_lock(CacheKey *key, Vol *d, Dir *to_part, ProxyMutex *m)
{
EThread *thread = m->thread_holding;
CACHE_TRY_LOCK(lock, d->mutex, thread);
@@ -844,7 +845,7 @@ dir_insert_lock(CacheKey *key, Part *d,
}
TS_INLINE int
-dir_overwrite_lock(CacheKey *key, Part *d, Dir *to_part, ProxyMutex *m, Dir *overwrite, bool must_overwrite = true)
+dir_overwrite_lock(CacheKey *key, Vol *d, Dir *to_part, ProxyMutex *m, Dir *overwrite, bool must_overwrite = true)
{
EThread *thread = m->thread_holding;
CACHE_TRY_LOCK(lock, d->mutex, thread);
@@ -930,18 +931,18 @@ int64_t cache_bytes_total(void);
#endif
struct CacheHostRecord;
-struct Part;
+struct Vol;
class CacheHostTable;
struct Cache
{
volatile int cache_read_done;
- volatile int total_good_npart;
- int total_npart;
+ volatile int total_good_nvol;
+ int total_nvol;
volatile int ready;
int64_t cache_size; //in store block size
CacheHostTable *hosttable;
- volatile int total_initialized_part;
+ volatile int total_initialized_vol;
int scheme;
int open(bool reconfigure, bool fix);
@@ -978,16 +979,16 @@ struct Cache
Action *link(Continuation *cont, CacheKey *from, CacheKey *to, CacheFragType type, char *hostname, int host_len);
Action *deref(Continuation *cont, CacheKey *key, CacheFragType type, char *hostname, int host_len);
- void part_initialized(bool result);
+ void vol_initialized(bool result);
int open_done();
- Part *key_to_part(CacheKey *key, char *hostname, int host_len);
+ Vol *key_to_vol(CacheKey *key, char *hostname, int host_len);
- Cache():cache_read_done(0), total_good_npart(0), total_npart(0), ready(CACHE_INITIALIZING), cache_size(0), // in store block size
- hosttable(NULL), total_initialized_part(0), scheme(CACHE_NONE_TYPE)
- {
- }
+ Cache()
+ : cache_read_done(0), total_good_nvol(0), total_nvol(0), ready(CACHE_INITIALIZING), cache_size(0), // in store block size
+ hosttable(NULL), total_initialized_vol(0), scheme(CACHE_NONE_TYPE)
+ { }
};
extern Cache *theCache;
Modified: trafficserver/traffic/trunk/iocore/cache/P_CachePart.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/P_CachePart.h?rev=1086711&r1=1086710&r2=1086711&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/P_CachePart.h (original)
+++ trafficserver/traffic/trunk/iocore/cache/P_CachePart.h Tue Mar 29 20:12:11 2011
@@ -22,8 +22,8 @@
*/
-#ifndef _P_CACHE_PART_H__
-#define _P_CACHE_PART_H__
+#ifndef _P_CACHE_VOL_H__
+#define _P_CACHE_VOL_H__
#define CACHE_BLOCK_SHIFT 9
#define CACHE_BLOCK_SIZE (1<<CACHE_BLOCK_SHIFT) // 512, smallest sector size
@@ -32,22 +32,21 @@
#define ROUND_TO_SECTOR(_p, _x) INK_ALIGN((_x), _p->sector_size)
#define ROUND_TO(_x, _y) INK_ALIGN((_x), (_y))
-// Part
-
-#define PART_MAGIC 0xF1D0F00D
+// Vol (volumes)
+#define VOL_MAGIC 0xF1D0F00D
#define START_BLOCKS 16 // 8k, STORE_BLOCK_SIZE
#define START_POS ((off_t)START_BLOCKS * CACHE_BLOCK_SIZE)
#define AGG_SIZE (4 * 1024 * 1024) // 4MB
#define AGG_HIGH_WATER (AGG_SIZE / 2) // 2MB
#define EVACUATION_SIZE (2 * AGG_SIZE) // 8MB
-#define MAX_PART_SIZE ((off_t)512 * 1024 * 1024 * 1024 * 1024)
+#define MAX_VOL_SIZE ((off_t)512 * 1024 * 1024 * 1024 * 1024)
#define STORE_BLOCKS_PER_CACHE_BLOCK (STORE_BLOCK_SIZE / CACHE_BLOCK_SIZE)
-#define MAX_PART_BLOCKS (MAX_PART_SIZE / CACHE_BLOCK_SIZE)
+#define MAX_VOL_BLOCKS (MAX_VOL_SIZE / CACHE_BLOCK_SIZE)
#define MAX_FRAG_SIZE (AGG_SIZE - sizeofDoc) // true max
#define LEAVE_FREE DEFAULT_MAX_BUFFER_SIZE
#define PIN_SCAN_EVERY 16 // scan every 1/16 of disk
-#define PART_HASH_TABLE_SIZE 32707
-#define PART_HASH_EMPTY 0xFFFF
+#define VOL_HASH_TABLE_SIZE 32707
+#define VOL_HASH_EMPTY 0xFFFF
#define LOOKASIDE_SIZE 256
#define EVACUATION_BUCKET_SIZE (2 * EVACUATION_SIZE) // 16MB
#define RECOVERY_SIZE EVACUATION_SIZE // 8MB
@@ -61,7 +60,7 @@
(_o / (EVACUATION_BUCKET_SIZE / CACHE_BLOCK_SIZE))
#define dir_evac_bucket(_e) dir_offset_evac_bucket(dir_offset(_e))
#define offset_evac_bucket(_d, _o) \
- dir_offset_evac_bucket((offset_to_part_offset(_d, _o)
+ dir_offset_evac_bucket((offset_to_vol_offset(_d, _o)
// Documents
@@ -72,13 +71,13 @@
#define sizeofDoc (((uint32_t)(uintptr_t)&((Doc*)0)->checksum)+(uint32_t)sizeof(uint32_t))
struct Cache;
-struct Part;
+struct Vol;
struct CacheDisk;
-struct PartInitInfo;
-struct DiskPart;
-struct CachePart;
+struct VolInitInfo;
+struct DiskVol;
+struct CacheVol;
-struct PartHeaderFooter
+struct VolHeaderFooter
{
unsigned int magic;
VersionNumber version;
@@ -118,6 +117,7 @@ struct EvacuationBlock
unsigned int unused:29;
} f;
};
+
int readers;
Dir dir;
Dir new_dir;
@@ -127,7 +127,7 @@ struct EvacuationBlock
LINK(EvacuationBlock, link);
};
-struct Part:public Continuation
+struct Vol: public Continuation
{
char *path;
char *hash_id;
@@ -136,8 +136,8 @@ struct Part:public Continuation
char *raw_dir;
Dir *dir;
- PartHeaderFooter *header;
- PartHeaderFooter *footer;
+ VolHeaderFooter *header;
+ VolHeaderFooter *footer;
int segments;
off_t buckets;
off_t recover_pos;
@@ -166,11 +166,11 @@ struct Part:public Continuation
DLL<EvacuationBlock> lookaside[LOOKASIDE_SIZE];
CacheVC *doc_evacuator;
- PartInitInfo *init_info;
+ VolInitInfo *init_info;
CacheDisk *disk;
Cache *cache;
- CachePart *cache_part;
+ CacheVol *cache_vol;
uint32_t last_sync_serial;
uint32_t last_write_serial;
uint32_t sector_size;
@@ -193,10 +193,10 @@ struct Part:public Continuation
int begin_read_lock(CacheVC *cont);
// unused read-write interlock code
// currently http handles a write-lock failure by retrying the read
- OpenDirEntry *open_read(INK_MD5 * key);
- OpenDirEntry *open_read_lock(INK_MD5 * key, EThread * t);
- int close_read(CacheVC * cont);
- int close_read_lock(CacheVC * cont);
+ OpenDirEntry *open_read(INK_MD5 *key);
+ OpenDirEntry *open_read_lock(INK_MD5 *key, EThread *t);
+ int close_read(CacheVC *cont);
+ int close_read_lock(CacheVC *cont);
int clear_dir();
@@ -248,11 +248,12 @@ struct Part:public Continuation
int within_hit_evacuate_window(Dir *dir);
uint32_t round_to_approx_size(uint32_t l);
- Part():Continuation(new_ProxyMutex()), path(NULL), fd(-1),
- dir(0), buckets(0), recover_pos(0), prev_recover_pos(0), scan_pos(0), skip(0), start(0),
- len(0), data_blocks(0), hit_evacuate_window(0), agg_todo_size(0), agg_buf_pos(0), trigger(0),
- evacuate_size(0), disk(NULL), last_sync_serial(0), last_write_serial(0), recover_wrapped(false),
- dir_sync_waiting(0), dir_sync_in_progress(0), writing_end_marker(0) {
+ Vol()
+ : Continuation(new_ProxyMutex()), path(NULL), fd(-1),
+ dir(0), buckets(0), recover_pos(0), prev_recover_pos(0), scan_pos(0), skip(0), start(0),
+ len(0), data_blocks(0), hit_evacuate_window(0), agg_todo_size(0), agg_buf_pos(0), trigger(0),
+ evacuate_size(0), disk(NULL), last_sync_serial(0), last_write_serial(0), recover_wrapped(false),
+ dir_sync_waiting(0), dir_sync_in_progress(0), writing_end_marker(0) {
open_dir.mutex = mutex;
#if defined(_WIN32)
agg_buffer = (char *) malloc(AGG_SIZE);
@@ -260,15 +261,15 @@ struct Part:public Continuation
agg_buffer = (char *) ink_memalign(sysconf(_SC_PAGESIZE), AGG_SIZE);
#endif
memset(agg_buffer, 0, AGG_SIZE);
- SET_HANDLER(&Part::aggWrite);
+ SET_HANDLER(&Vol::aggWrite);
}
- ~Part() {
+ ~Vol() {
ink_memalign_free(agg_buffer);
}
};
-struct AIO_Callback_handler:public Continuation
+struct AIO_Callback_handler: public Continuation
{
int handle_disk_failure(int event, void *data);
@@ -277,19 +278,21 @@ struct AIO_Callback_handler:public Conti
}
};
-struct CachePart
+struct CacheVol
{
- int part_number;
+ int vol_number;
int scheme;
int size;
- int num_parts;
- Part **parts;
- DiskPart **disk_parts;
- LINK(CachePart, link);
- // per partition stats
- RecRawStatBlock *part_rsb;
-
- CachePart():part_number(-1), scheme(0), size(0), num_parts(0), parts(NULL), disk_parts(0), part_rsb(0) { }
+ int num_vols;
+ Vol **vols;
+ DiskVol **disk_vols;
+ LINK(CacheVol, link);
+ // per volume stats
+ RecRawStatBlock *vol_rsb;
+
+ CacheVol()
+ : vol_number(-1), scheme(0), size(0), num_vols(0), vols(NULL), disk_vols(0), vol_rsb(0)
+ { }
};
// element of the fragment table in the head of a multi-fragment document
@@ -326,118 +329,136 @@ struct Doc
// Global Data
-extern Part **gpart;
-extern volatile int gnpart;
+extern Vol **gvol;
+extern volatile int gnvol;
extern ClassAllocator<OpenDirEntry> openDirEntryAllocator;
extern ClassAllocator<EvacuationBlock> evacuationBlockAllocator;
extern ClassAllocator<EvacuationKey> evacuationKeyAllocator;
-extern unsigned short *part_hash_table;
+extern unsigned short *vol_hash_table;
// inline Functions
TS_INLINE int
-part_headerlen(Part *d) {
- return ROUND_TO_STORE_BLOCK(sizeof(PartHeaderFooter) + sizeof(uint16_t) * (d->segments-1));
+vol_headerlen(Vol *d) {
+ return ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter) + sizeof(uint16_t) * (d->segments-1));
}
+
TS_INLINE int
-part_dirlen(Part * d)
+vol_dirlen(Vol *d)
{
- return part_headerlen(d) +
+ return vol_headerlen(d) +
ROUND_TO_STORE_BLOCK(d->buckets * DIR_DEPTH * d->segments * SIZEOF_DIR) +
- ROUND_TO_STORE_BLOCK(sizeof(PartHeaderFooter));
+ ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter));
}
+
TS_INLINE int
-part_direntries(Part * d)
+vol_direntries(Vol *d)
{
return d->buckets * DIR_DEPTH * d->segments;
}
+
TS_INLINE int
-part_out_of_phase_valid(Part * d, Dir * e)
+vol_out_of_phase_valid(Vol *d, Dir *e)
{
return (dir_offset(e) - 1 >= ((d->header->agg_pos - d->start) / CACHE_BLOCK_SIZE));
}
+
TS_INLINE int
-part_out_of_phase_agg_valid(Part * d, Dir * e)
+vol_out_of_phase_agg_valid(Vol *d, Dir *e)
{
return (dir_offset(e) - 1 >= ((d->header->agg_pos - d->start + AGG_SIZE) / CACHE_BLOCK_SIZE));
}
+
TS_INLINE int
-part_out_of_phase_write_valid(Part * d, Dir * e)
+vol_out_of_phase_write_valid(Vol *d, Dir *e)
{
return (dir_offset(e) - 1 >= ((d->header->write_pos - d->start) / CACHE_BLOCK_SIZE));
}
+
TS_INLINE int
-part_in_phase_valid(Part * d, Dir * e)
+vol_in_phase_valid(Vol *d, Dir *e)
{
return (dir_offset(e) - 1 < ((d->header->write_pos + d->agg_buf_pos - d->start) / CACHE_BLOCK_SIZE));
}
+
TS_INLINE off_t
-part_offset(Part * d, Dir * e)
+vol_offset(Vol *d, Dir *e)
{
return d->start + (off_t) dir_offset(e) * CACHE_BLOCK_SIZE - CACHE_BLOCK_SIZE;
}
+
TS_INLINE off_t
-offset_to_part_offset(Part * d, off_t pos)
+offset_to_vol_offset(Vol *d, off_t pos)
{
return ((pos - d->start + CACHE_BLOCK_SIZE) / CACHE_BLOCK_SIZE);
}
+
TS_INLINE off_t
-part_offset_to_offset(Part * d, off_t pos)
+vol_offset_to_offset(Vol *d, off_t pos)
{
return d->start + pos * CACHE_BLOCK_SIZE - CACHE_BLOCK_SIZE;
}
+
TS_INLINE Dir *
-part_dir_segment(Part * d, int s)
+vol_dir_segment(Vol *d, int s)
{
return (Dir *) (((char *) d->dir) + (s * d->buckets) * DIR_DEPTH * SIZEOF_DIR);
}
+
TS_INLINE int
-part_in_phase_agg_buf_valid(Part * d, Dir * e)
+vol_in_phase_agg_buf_valid(Vol *d, Dir *e)
{
- return (part_offset(d, e) >= d->header->write_pos && part_offset(d, e) < (d->header->write_pos + d->agg_buf_pos));
+ return (vol_offset(d, e) >= d->header->write_pos && vol_offset(d, e) < (d->header->write_pos + d->agg_buf_pos));
}
+
TS_INLINE uint32_t
Doc::prefix_len()
{
return sizeofDoc + hlen + flen;
}
+
TS_INLINE uint32_t
Doc::data_len()
{
return len - sizeofDoc - hlen - flen;
}
+
TS_INLINE int
Doc::single_fragment()
{
return (total_len && (data_len() == total_len));
}
+
TS_INLINE uint32_t
Doc::nfrags() {
return flen / sizeof(Frag);
}
+
TS_INLINE Frag *
Doc::frags()
{
return (Frag*)(((char *) this) + sizeofDoc);
}
+
TS_INLINE char *
Doc::hdr()
{
return ((char *) this) + sizeofDoc + flen;
}
+
TS_INLINE char *
Doc::data()
{
return ((char *) this) + sizeofDoc + flen + hlen;
}
-int part_dir_clear(Part * d);
-int part_init(Part * d, char *s, off_t blocks, off_t skip, bool clear);
+int vol_dir_clear(Vol *d);
+int vol_init(Vol *d, char *s, off_t blocks, off_t skip, bool clear);
// inline Functions
TS_INLINE EvacuationBlock *
-evacuation_block_exists(Dir * dir, Part * p)
+evacuation_block_exists(Dir *dir, Vol *p)
{
EvacuationBlock *b = p->evacuate[dir_evac_bucket(dir)].head;
for (; b; b = b->link.next)
@@ -447,7 +468,7 @@ evacuation_block_exists(Dir * dir, Part
}
TS_INLINE void
-Part::cancel_trigger()
+Vol::cancel_trigger()
{
if (trigger) {
trigger->cancel_action();
@@ -456,7 +477,7 @@ Part::cancel_trigger()
}
TS_INLINE EvacuationBlock *
-new_EvacuationBlock(EThread * t)
+new_EvacuationBlock(EThread *t)
{
EvacuationBlock *b = THREAD_ALLOC(evacuationBlockAllocator, t);
b->init = 0;
@@ -467,7 +488,7 @@ new_EvacuationBlock(EThread * t)
}
TS_INLINE void
-free_EvacuationBlock(EvacuationBlock * b, EThread * t)
+free_EvacuationBlock(EvacuationBlock *b, EThread *t)
{
EvacuationKey *e = b->evac_frags.link.next;
while (e) {
@@ -479,13 +500,13 @@ free_EvacuationBlock(EvacuationBlock * b
}
TS_INLINE OpenDirEntry *
-Part::open_read(INK_MD5 * key)
+Vol::open_read(INK_MD5 *key)
{
return open_dir.open_read(key);
}
TS_INLINE int
-Part::within_hit_evacuate_window(Dir * xdir)
+Vol::within_hit_evacuate_window(Dir *xdir)
{
off_t oft = dir_offset(xdir) - 1;
off_t write_off = (header->write_pos + AGG_SIZE - start) / CACHE_BLOCK_SIZE;
@@ -497,9 +518,9 @@ Part::within_hit_evacuate_window(Dir * x
}
TS_INLINE uint32_t
-Part::round_to_approx_size(uint32_t l) {
+Vol::round_to_approx_size(uint32_t l) {
uint32_t ll = round_to_approx_dir_size(l);
return ROUND_TO_SECTOR(this, ll);
}
-#endif /* _P_CACHE_PART_H__ */
+#endif /* _P_CACHE_VOL_H__ */
Modified: trafficserver/traffic/trunk/iocore/cache/P_RamCache.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/P_RamCache.h?rev=1086711&r1=1086710&r2=1086711&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/P_RamCache.h (original)
+++ trafficserver/traffic/trunk/iocore/cache/P_RamCache.h Tue Mar 29 20:12:11 2011
@@ -34,7 +34,7 @@ struct RamCache {
virtual int put(INK_MD5 *key, IOBufferData *data, uint32_t len, bool copy = false, uint32_t auxkey1 = 0, uint32_t auxkey2 = 0) = 0;
virtual int fixup(INK_MD5 *key, uint32_t old_auxkey1, uint32_t old_auxkey2, uint32_t new_auxkey1, uint32_t new_auxkey2) = 0;
- virtual void init(int64_t max_bytes, Part *part) = 0;
+ virtual void init(int64_t max_bytes, Vol *vol) = 0;
virtual ~RamCache() {};
};
Modified: trafficserver/traffic/trunk/iocore/cache/RamCacheCLFUS.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/RamCacheCLFUS.cc?rev=1086711&r1=1086710&r2=1086711&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/RamCacheCLFUS.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/RamCacheCLFUS.cc Tue Mar 29 20:12:11 2011
@@ -76,10 +76,10 @@ struct RamCacheCLFUS : public RamCache {
int put(INK_MD5 *key, IOBufferData *data, uint32_t len, bool copy = false, uint32_t auxkey1 = 0, uint32_t auxkey2 = 0);
int fixup(INK_MD5 *key, uint32_t old_auxkey1, uint32_t old_auxkey2, uint32_t new_auxkey1, uint32_t new_auxkey2);
- void init(int64_t max_bytes, Part *part);
+ void init(int64_t max_bytes, Vol *vol);
// private
- Part *part; // for stats
+ Vol *vol; // for stats
int64_t history;
int ibuckets;
int nbuckets;
@@ -95,7 +95,7 @@ struct RamCacheCLFUS : public RamCache {
RamCacheCLFUSEntry *destroy(RamCacheCLFUSEntry *e);
void requeue_victims(RamCacheCLFUS *c, Que(RamCacheCLFUSEntry, lru_link) &victims);
void tick(); // move CLOCK on history
- RamCacheCLFUS(): max_bytes(0), bytes(0), objects(0), part(0), history(0), ibuckets(0), nbuckets(0), bucket(0),
+ RamCacheCLFUS(): max_bytes(0), bytes(0), objects(0), vol(0), history(0), ibuckets(0), nbuckets(0), bucket(0),
seen(0), ncompressed(0), compressed(0) { }
};
@@ -129,8 +129,8 @@ void RamCacheCLFUS::resize_hashtable() {
memset(seen, 0, size);
}
-void RamCacheCLFUS::init(int64_t abytes, Part *apart) {
- part = apart;
+void RamCacheCLFUS::init(int64_t abytes, Vol *avol) {
+ vol = avol;
max_bytes = abytes;
DDebug("ram_cache", "initializing ram_cache %" PRId64 " bytes", abytes);
if (!max_bytes)
@@ -301,7 +301,7 @@ RamCacheCLFUSEntry *RamCacheCLFUS::destr
void RamCacheCLFUS::compress_entries(EThread *thread, int do_at_most) {
if (!cache_config_ram_cache_compress)
return;
- MUTEX_TAKE_LOCK(part->mutex, thread);
+ MUTEX_TAKE_LOCK(vol->mutex, thread);
if (!compressed) {
compressed = lru[0].head;
ncompressed = 0;
@@ -334,7 +334,7 @@ void RamCacheCLFUS::compress_entries(ETh
Ptr<IOBufferData> edata = e->data;
uint32_t elen = e->len;
INK_MD5 key = e->key;
- MUTEX_UNTAKE_LOCK(part->mutex, thread);
+ MUTEX_UNTAKE_LOCK(vol->mutex, thread);
b = (char*)xmalloc(l);
bool failed = false;
switch (ctype) {
@@ -364,7 +364,7 @@ void RamCacheCLFUS::compress_entries(ETh
}
#endif
}
- MUTEX_TAKE_LOCK(part->mutex, thread);
+ MUTEX_TAKE_LOCK(vol->mutex, thread);
// see if the entry is till around
{
uint32_t i = key.word(3) % nbuckets;
@@ -423,7 +423,7 @@ void RamCacheCLFUS::compress_entries(ETh
compressed = e->lru_link.next;
ncompressed++;
}
- MUTEX_UNTAKE_LOCK(part->mutex, thread);
+ MUTEX_UNTAKE_LOCK(vol->mutex, thread);
return;
}