error(true);
} else {
closed = false;
- store_open_disk_fd++;
+ ++store_open_disk_fd;
debugs(79, 3, HERE << ": opened FD " << fd);
}
qe->aq_e_aiocb.aio_buf = request->buf;
/* Account */
- strategy->aq.aq_numpending++;
+ ++ strategy->aq.aq_numpending;
/* Initiate aio */
if (aio_read(&qe->aq_e_aiocb) < 0) {
/* Loop through all slots */
- for (i = 0; i < MAX_ASYNCOP; i++) {
+ for (i = 0; i < MAX_ASYNCOP; ++i) {
if (aq.aq_queue[i].aq_e_state == AQ_ENTRY_USED) {
aqe = &aq.aq_queue[i];
/* Active, get status */
{
/* Later we should use something a little more .. efficient :) */
- for (int i = 0; i < MAX_ASYNCOP; i++) {
+ for (int i = 0; i < MAX_ASYNCOP; ++i) {
if (aq.aq_queue[i].aq_e_state == AQ_ENTRY_FREE)
/* Found! */
return i;
FILE_FLAG_OVERLAPPED, /* file attributes */
NULL /* handle to template file */
)) != INVALID_HANDLE_VALUE) {
- statCounter.syscalls.disk.opens++;
+ ++ statCounter.syscalls.disk.opens;
fd = _open_osfhandle((long) hndl, 0);
commSetCloseOnExec(fd);
fd_open(fd, FD_FILE, path);
{
CloseHandle((HANDLE)_get_osfhandle(fd));
fd_close(fd);
- statCounter.syscalls.disk.closes++;
+ ++ statCounter.syscalls.disk.closes;
}
error(true);
} else {
closed = false;
- store_open_disk_fd++;
+ ++store_open_disk_fd;
debugs(79, 3, "BlockingFile::open: opened FD " << fd);
}
if (fd > -1) {
closed = true;
file_close(fd);
- store_open_disk_fd--;
+ --store_open_disk_fd;
fd = -1;
}
}
ioRequestor = NULL;
}
- diskd_stats.open.ops++;
+ ++diskd_stats.open.ops;
}
void
return;
}
- diskd_stats.create.ops++;
+ ++diskd_stats.create.ops;
}
void
return;
}
- diskd_stats.read.ops++;
+ ++diskd_stats.read.ops;
}
void
return;
}
- diskd_stats.close.ops++;
+ ++diskd_stats.close.ops;
}
bool
debugs(79, 3, "storeDiskdOpenDone: status " << M->status);
if (M->status < 0) {
- diskd_stats.open.fail++;
+ ++diskd_stats.open.fail;
errorOccured = true;
} else {
- diskd_stats.open.success++;
+ ++diskd_stats.open.success;
}
ioCompleted();
debugs(79, 3, "storeDiskdCreateDone: status " << M->status);
if (M->status < 0) {
- diskd_stats.create.fail++;
+ ++diskd_stats.create.fail;
errorOccured = true;
} else {
- diskd_stats.create.success++;
+ ++diskd_stats.create.success;
}
ioCompleted();
return;
}
- diskd_stats.write.ops++;
+ ++diskd_stats.write.ops;
}
void
debugs(79, 3, "DiskdFile::closeDone: status " << M->status);
if (M->status < 0) {
- diskd_stats.close.fail++;
+ ++diskd_stats.close.fail;
errorOccured = true;
} else {
- diskd_stats.close.success++;
+ ++diskd_stats.close.success;
}
ioCompleted();
readRequest->RefCountDereference();
if (M->status < 0) {
- diskd_stats.read.fail++;
+ ++diskd_stats.read.fail;
ioCompleted();
errorOccured = true;
ioRequestor->readCompleted(NULL, -1, DISK_ERROR, readRequest);
return;
}
- diskd_stats.read.success++;
+ ++diskd_stats.read.success;
ioCompleted();
ioRequestor->readCompleted (IO->shm.buf + M->shm_offset, M->status, DISK_OK, readRequest);
if (M->status < 0) {
errorOccured = true;
- diskd_stats.write.fail++;
+ ++diskd_stats.write.fail;
ioCompleted();
ioRequestor->writeCompleted (DISK_ERROR,0, writeRequest);
return;
}
- diskd_stats.write.success++;
+ ++diskd_stats.write.success;
ioCompleted();
ioRequestor->writeCompleted (DISK_OK,M->status, writeRequest);
}
void
DiskdIOStrategy::openFailed()
{
- diskd_stats.open_fail_queue_len++;
+ ++diskd_stats.open_fail_queue_len;
}
DiskFile::Pointer
// shm.put (shm_offset);
}
- diskd_stats.unlink.ops++;
+ ++diskd_stats.unlink.ops;
}
void
char *aBuf = NULL;
int i;
- for (i = 0; i < nbufs; i++) {
+ for (i = 0; i < nbufs; ++i) {
if (CBIT_TEST(inuse_map, i))
continue;
assert(aBuf);
assert(aBuf >= buf);
assert(aBuf < buf + (nbufs * SHMBUF_BLKSZ));
- diskd_stats.shmbuf_count++;
+ ++diskd_stats.shmbuf_count;
if (diskd_stats.max_shmuse < diskd_stats.shmbuf_count)
diskd_stats.max_shmuse = diskd_stats.shmbuf_count;
inuse_map = (char *)xcalloc((nbufs + 7) / 8, 1);
diskd_stats.shmbuf_count += nbufs;
- for (int i = 0; i < nbufs; i++) {
+ for (int i = 0; i < nbufs; ++i) {
CBIT_SET(inuse_map, i);
put (i * SHMBUF_BLKSZ);
}
++statCounter.syscalls.disk.unlinks;
if (M->status < 0)
- diskd_stats.unlink.fail++;
+ ++diskd_stats.unlink.fail;
else
- diskd_stats.unlink.success++;
+ ++diskd_stats.unlink.success;
}
void
last_seq_no = M->seq_no;
if (0 == x) {
- diskd_stats.sent_count++;
- away++;
+ ++diskd_stats.sent_count;
+ ++away;
} else {
debugs(79, 1, "storeDiskdSend: msgsnd: " << xstrerror());
cbdataReferenceDone(M->callback_data);
int retval = 0;
if (away >= magic2) {
- diskd_stats.block_queue_len++;
+ ++diskd_stats.block_queue_len;
retval = 1;
/* We might not have anything to do, but our queue
* is full.. */
break;
}
- diskd_stats.recv_count++;
+ ++diskd_stats.recv_count;
--away;
handle(&M);
retval = 1; /* Return that we've actually done some work */
}
#endif
- Opening_FD++;
+ ++Opening_FD;
ioRequestor = callback;
}
#endif
- Opening_FD++;
+ ++Opening_FD;
ioRequestor = callback;
debugs(79, 1, "\t" << path_);
errorOccured = true;
} else {
- store_open_disk_fd++;
+ ++store_open_disk_fd;
commSetCloseOnExec(fd);
fd_open(fd, FD_FILE, path_);
}
int retval = 0;
assert(initialised);
- squidaio_counts.check_callback++;
+ ++squidaio_counts.check_callback;
for (;;) {
if ((resultp = squidaio_poll_done()) == NULL)
assert(NUMTHREADS);
- for (i = 0; i < NUMTHREADS; i++) {
+ for (i = 0; i < NUMTHREADS; ++i) {
threadp = (squidaio_thread_t *)squidaio_thread_pool->alloc();
threadp->status = _THREAD_STARTING;
threadp->current_req = NULL;
done_queue.tailp = &request->next;
pthread_mutex_unlock(&done_queue.mutex);
CommIO::NotifyIOCompleted();
- threadp->requests++;
+ ++ threadp->requests;
} /* while forever */
return NULL;
threadp = threads;
- for (i = 0; i < NUMTHREADS; i++) {
+ for (i = 0; i < NUMTHREADS; ++i) {
storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1, (unsigned long)threadp->thread, threadp->requests);
threadp = threadp->next;
}
assert(NUMTHREADS);
- for (i = 0; i < NUMTHREADS; i++) {
+ for (i = 0; i < NUMTHREADS; ++i) {
threadp = (squidaio_thread_t *)squidaio_thread_pool->alloc();
threadp->status = _THREAD_STARTING;
threadp->current_req = NULL;
threadp = threads;
- for (i = 0; i < NUMTHREADS; i++) {
+ for (i = 0; i < NUMTHREADS; ++i) {
threadp->exit = 1;
hthreads[i] = threadp->thread;
threadp = threadp->next;
WaitForMultipleObjects(NUMTHREADS, hthreads, TRUE, 2000);
- for (i = 0; i < NUMTHREADS; i++) {
+ for (i = 0; i < NUMTHREADS; ++i) {
CloseHandle(hthreads[i]);
}
CommIO::NotifyIOCompleted();
Sleep(0);
- threadp->requests++;
+ ++ threadp->requests;
} /* while forever */
CloseHandle(cond);
threadp = threads;
- for (i = 0; i < NUMTHREADS; i++) {
+ for (i = 0; i < NUMTHREADS; ++i) {
storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1, threadp->dwThreadId, threadp->requests);
threadp = threadp->next;
}
squidaio_ctrl_t *ctrlp;
assert(DiskThreadsIOStrategy::Instance.initialised);
- squidaio_counts.open_start++;
+ ++squidaio_counts.open_start;
ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc();
ctrlp->fd = -2;
ctrlp->done_handler = callback;
squidaio_ctrl_t *ctrlp;
assert(DiskThreadsIOStrategy::Instance.initialised);
- squidaio_counts.close_start++;
+ ++squidaio_counts.close_start;
aioCancel(fd);
ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc();
ctrlp->fd = fd;
dlink_node *m, *next;
assert(DiskThreadsIOStrategy::Instance.initialised);
- squidaio_counts.cancel++;
+ ++squidaio_counts.cancel;
for (m = used_list.head; m; m = next) {
next = m->next;
int seekmode;
assert(DiskThreadsIOStrategy::Instance.initialised);
- squidaio_counts.write_start++;
+ ++squidaio_counts.write_start;
ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc();
ctrlp->fd = fd;
ctrlp->done_handler = callback;
int seekmode;
assert(DiskThreadsIOStrategy::Instance.initialised);
- squidaio_counts.read_start++;
+ ++squidaio_counts.read_start;
ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc();
ctrlp->fd = fd;
ctrlp->done_handler = callback;
squidaio_ctrl_t *ctrlp;
assert(DiskThreadsIOStrategy::Instance.initialised);
- squidaio_counts.stat_start++;
+ ++squidaio_counts.stat_start;
ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc();
ctrlp->fd = -2;
ctrlp->done_handler = callback;
{
squidaio_ctrl_t *ctrlp;
assert(DiskThreadsIOStrategy::Instance.initialised);
- squidaio_counts.unlink_start++;
+ ++squidaio_counts.unlink_start;
ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc();
ctrlp->fd = -2;
ctrlp->done_handler = callback;
return false;
}
- store_open_disk_fd++;
+ ++store_open_disk_fd;
debugs(79,3, HERE << "rock db opened " << path << ": FD " << TheFile);
return true;
}
debugs(79,3, HERE << "open error: " << xstrerror());
error_ = true;
} else {
- store_open_disk_fd++;
+ ++store_open_disk_fd;
debugs(79,3, HERE << "FD " << fd);
// setup mapping boundaries
xmlChar **tmp = (xmlChar **)atts;
while (tmp && *tmp != NULL) {
- count++;
- tmp++;
+ ++count;
+ ++tmp;
}
// we increased on every key and value
}
/* Find MAC address from net table */
- for (i = 0 ; i < NetTable->dwNumEntries ; i++) {
+ for (i = 0 ; i < NetTable->dwNumEntries ; ++i) {
in_addr a;
a.s_addr = NetTable->table[i].dwAddr;
if (c == a && (NetTable->table[i].dwType > 2)) {
case '\r':
*p++ = '\\';
*p++ = 'r';
- str++;
+ ++str;
break;
case '\n':
*p++ = '\\';
*p++ = 'n';
- str++;
+ ++str;
break;
case '\t':
*p++ = '\\';
*p++ = 't';
- str++;
+ ++str;
break;
default:
*p++ = '\\';
*p++ = *str;
- str++;
+ ++str;
break;
}
}
- *p++ = '\0';
+ *p = '\0';
}
void
char *
Format::Token::scanForToken(TokenTableEntry const table[], char *cur)
{
- for (TokenTableEntry const *lte = table; lte->configTag != NULL; lte++) {
+ for (TokenTableEntry const *lte = table; lte->configTag != NULL; ++lte) {
debugs(46, 8, HERE << "compare tokens '" << lte->configTag << "' with '" << cur << "'");
if (strncmp(lte->configTag, cur, strlen(lte->configTag)) == 0) {
type = lte->tokenType;
break;
}
- cur++;
- l--;
+ ++cur;
+ --l;
}
goto done;
if (!*cur)
goto done;
- cur++;
+ ++cur;
// select quoting style for his particular token
switch (*cur) {
case '"':
quote = LOG_QUOTE_QUOTES;
- cur++;
+ ++cur;
break;
case '\'':
quote = LOG_QUOTE_RAW;
- cur++;
+ ++cur;
break;
case '[':
quote = LOG_QUOTE_MIMEBLOB;
- cur++;
+ ++cur;
break;
case '#':
quote = LOG_QUOTE_URL;
- cur++;
+ ++cur;
break;
default:
if (*cur == '-') {
left = 1;
- cur++;
+ ++cur;
}
if (*cur == '0') {
zero = 1;
- cur++;
+ ++cur;
}
if (xisdigit(*cur))
if (*cur == '{') {
char *cp;
- cur++;
+ ++cur;
l = strcspn(cur, "}");
cp = (char *)xmalloc(l + 1);
xstrncpy(cp, cur, l + 1);
cur += l;
if (*cur == '}')
- cur++;
+ ++cur;
}
type = LFT_NONE;
// Scan each registered token namespace
debugs(46, 9, HERE << "check for token in " << TheConfig.tokens.size() << " namespaces.");
- for (std::list<TokenNamespace>::const_iterator itr = TheConfig.tokens.begin(); itr != TheConfig.tokens.end(); itr++) {
+ for (std::list<TokenNamespace>::const_iterator itr = TheConfig.tokens.begin(); itr != TheConfig.tokens.end(); ++itr) {
debugs(46, 7, HERE << "check for possible " << itr->prefix << ":: token");
const size_t len = itr->prefix.size();
if (itr->prefix.cmp(cur, len) == 0 && cur[len] == ':' && cur[len+1] == ':') {
if (*cur == ' ') {
space = 1;
- cur++;
+ ++cur;
}
done:
int i;
divisor = 1000000;
- for (i = widthMax; i > 1; i--)
+ for (i = widthMax; i > 1; --i)
divisor /= 10;
if (!divisor)
while (strlen(pathtmp) && pathtmp[strlen(pathtmp) - 1] == '.')
pathtmp[strlen(pathtmp) - 1] = '\0';
- for (pathtmp2 = pathtmp; *pathtmp2 == '.'; pathtmp2++);
+ for (pathtmp2 = pathtmp; *pathtmp2 == '.'; ++pathtmp2);
snprintf(path, MAXPATHLEN - 64, Config.Log.swap, pathtmp2);
if (strncmp(path, Config.Log.swap, MAXPATHLEN - 64) == 0) {
cstate->flags.reading = 0;
if (errflag) {
- StoreFScoss::GetInstance().stats.read.fail++;
+ ++ StoreFScoss::GetInstance().stats.read.fail;
if (errflag > 0) {
errno = errflag;
rlen = -1;
} else {
- StoreFScoss::GetInstance().stats.read.success++;
+ ++ StoreFScoss::GetInstance().stats.read.success;
if (cstate->readbuffer == NULL) {
cstate->readbuffer = (char *)xmalloc(cstate->st_size);
if (errflag) {
- StoreFScoss::GetInstance().stats.stripe_write.fail++;
+ ++ StoreFScoss::GetInstance().stats.stripe_write.fail;
debugs(79, 1, "storeCossWriteMemBufDone: got failure (" << errflag << ")");
debugs(79, 1, "size=" << cossWrite->membuf->diskend - cossWrite->membuf->diskstart);
} else {
- StoreFScoss::GetInstance().stats.stripe_write.success++;
+ ++ StoreFScoss::GetInstance().stats.stripe_write.success;
}
dlinkDelete(&cossWrite->membuf->node, &membufs);
cbdataFree(cossWrite->membuf);
- StoreFScoss::GetInstance().stats.stripes--;
+ -- StoreFScoss::GetInstance().stats.stripes;
}
void
RebuildState *rb = (RebuildState *)data;
CossSwapDir *sd = rb->sd;
sd->startMembuf();
- StoreController::store_dirs_rebuilding--;
+ -- StoreController::store_dirs_rebuilding;
storeCossDirCloseTmpSwapLog(rb->sd);
storeRebuildComplete(&rb->counts);
cbdataFree(rb);
assert(rb != NULL);
/* load a number of objects per invocation */
- for (int aCount = 0; aCount < rb->speed; aCount++) {
+ for (int aCount = 0; aCount < rb->speed; ++aCount) {
if (fread(&s, ss, 1, rb->log) != 1) {
debugs(47, 1, "Done reading " << rb->sd->path << " swaplog (" << rb->n_read << " entries)");
fclose(rb->log);
return;
}
- rb->n_read++;
+ ++ rb->n_read;
if (s.op <= SWAP_LOG_NOP)
continue;
e->release();
/* Fake an unlink here, this is a bad hack :( */
storeCossRemove(rb->sd, e);
- rb->counts.objcount--;
- rb->counts.cancelcount++;
+ -- rb->counts.objcount;
+ ++ rb->counts.cancelcount;
}
continue;
} else {
(int) x)
debugs(47, 1, "WARNING: " << rb->counts.bad_log_op << " invalid swap log entries found");
- rb->counts.invalid++;
+ ++ rb->counts.invalid;
continue;
}
}
if (EBIT_TEST(s.flags, KEY_PRIVATE)) {
- rb->counts.badflags++;
+ ++ rb->counts.badflags;
continue;
}
if (e) {
/* key already exists, current entry is newer */
/* keep old, ignore new */
- rb->counts.dupcount++;
+ ++ rb->counts.dupcount;
continue;
}
- rb->counts.objcount++;
+ ++ rb->counts.objcount;
e = rb->sd->addDiskRestore(s.key,
s.swap_filen,
fp = storeCossDirOpenTmpSwapLog(sd, &clean, &zero);
debugs(47, 1, "Rebuilding COSS storage in " << sd->path << " (" << (clean ? "CLEAN" : "DIRTY") << ")");
rb->log = fp;
- StoreController::store_dirs_rebuilding++;
+ ++ StoreController::store_dirs_rebuilding;
if (!clean || fp == NULL) {
/* COSS cannot yet rebuild from a dirty state. If the log
closeLog();
- n_coss_dirs--;
+ --n_coss_dirs;
safe_free(ioModule);
int check = blksz;
while (check > 1) {
- nbits++;
+ ++nbits;
check >>= 1;
}
if (which == COSS_ALLOC_REALLOC) {
checkf = e->swap_filen;
- StoreFScoss::GetInstance().stats.alloc.realloc++;
+ ++ StoreFScoss::GetInstance().stats.alloc.realloc;
} else {
checkf = -1;
- StoreFScoss::GetInstance().stats.alloc.alloc++;
+ ++ StoreFScoss::GetInstance().stats.alloc.alloc;
}
if (e->swap_file_sz > 0)
* tried to allocate past the end of the disk, so wrap
* back to the beginning
*/
- StoreFScoss::GetInstance().stats.disk_overflows++;
+ ++ StoreFScoss::GetInstance().stats.disk_overflows;
current_membuf->flags.full = 1;
current_membuf->diskend = current_offset;
current_membuf->maybeWrite(this);
/*
* Skip the blank space at the end of the stripe. start over.
*/
- StoreFScoss::GetInstance().stats.stripe_overflows++;
+ ++ StoreFScoss::GetInstance().stats.stripe_overflows;
current_membuf->flags.full = 1;
current_offset = current_membuf->diskend;
current_membuf->maybeWrite(this);
current_offset = ((current_offset + blksz_mask) >> blksz_bits ) << blksz_bits;
return storeCossDiskOffsetToFileno(retofs);
} else {
- StoreFScoss::GetInstance().stats.alloc.collisions++;
+ ++ StoreFScoss::GetInstance().stats.alloc.collisions;
debugs(79, 3, "CossSwapDir::allocate: Collision");
return -1;
}
cur_size -= fs.blksize * sizeInBlocks(e.swap_file_sz);
--n_disk_objects;
}
- StoreFScoss::GetInstance().stats.unlink.ops++;
- StoreFScoss::GetInstance().stats.unlink.success++;
+ ++ StoreFScoss::GetInstance().stats.unlink.ops;
+ ++ StoreFScoss::GetInstance().stats.unlink.success;
storeCossRemove(this, &e);
}
* the squid code is broken
*/
assert(e.mem_obj->object_sz != -1);
- StoreFScoss::GetInstance().stats.create.ops++;
+ ++ StoreFScoss::GetInstance().stats.create.ops;
/*
* this one is kinda strange - Eric called allocate(), then
storeCossAdd(this, &e);
cstate->lockMemBuf();
- StoreFScoss::GetInstance().stats.create.success++;
+ ++ StoreFScoss::GetInstance().stats.create.success;
return sio;
}
sfileno f = e.swap_filen;
debugs(79, 3, "storeCossOpen: offset " << f);
- StoreFScoss::GetInstance().stats.open.ops++;
+ ++ StoreFScoss::GetInstance().stats.open.ops;
StoreIOState::Pointer sio = new CossState (this);
cstate = dynamic_cast<CossState *>(sio.getRaw());
if (p) {
cstate->readbuffer = (char *)xmalloc(cstate->st_size);
memcpy(cstate->readbuffer, p, cstate->st_size);
- StoreFScoss::GetInstance().stats.open_mem_hits++;
+ ++ StoreFScoss::GetInstance().stats.open_mem_hits;
} else {
/* Do the allocation */
/* this is the first time we've been called on a new sio
* read the whole object into memory, then return the
* requested amount
*/
- StoreFScoss::GetInstance().stats.open_mem_misses++;
+ ++ StoreFScoss::GetInstance().stats.open_mem_misses;
/*
* This bit of code actually does the LRU disk thing - we realloc
* a place for the object here, and the file_read() reads the object
if (sio->swap_filen == -1) {
/* We have to clean up neatly .. */
- StoreFScoss::GetInstance().stats.open.fail++;
- numcollisions++;
+ ++ StoreFScoss::GetInstance().stats.open.fail;
+ ++numcollisions;
debugs(79, 2, "storeCossOpen: Reallocation of " << e.swap_dirn << "/" << e.swap_filen << " failed");
/* XXX XXX XXX Will squid call storeUnlink for this object? */
return NULL;
*/
}
- StoreFScoss::GetInstance().stats.open.success++;
+ ++ StoreFScoss::GetInstance().stats.open.success;
return sio;
}
{
debugs(79, 3, "storeCossClose: offset " << swap_filen);
- StoreFScoss::GetInstance().stats.close.ops++;
- StoreFScoss::GetInstance().stats.close.success++;
+ ++ StoreFScoss::GetInstance().stats.close.ops;
+ ++ StoreFScoss::GetInstance().stats.close.success;
SD->storeCossMemBufUnlock(this);
doCallback(0);
}
char *p;
CossSwapDir *SD = (CossSwapDir *)INDEXSD(swap_dirn);
- StoreFScoss::GetInstance().stats.read.ops++;
+ ++ StoreFScoss::GetInstance().stats.read.ops;
assert(read.callback == NULL);
assert(read.callback_data == NULL);
read.callback = callback;
* the squid code is broken
*/
assert(e->mem_obj->object_sz != -1);
- StoreFScoss::GetInstance().stats.write.ops++;
+ ++ StoreFScoss::GetInstance().stats.write.ops;
debugs(79, 3, "storeCossWrite: offset " << offset_ << ", len " << (unsigned long int) size);
diskoffset = SD->storeCossFilenoToDiskOffset(swap_filen) + offset_;
if (free_func)
(free_func) ((char *)buf);
- StoreFScoss::GetInstance().stats.write.success++;
+ ++ StoreFScoss::GetInstance().stats.write.success;
}
off_t
debugs(79, 3, "storeCossMemBufUnlock: unlocking " << t << ", lockcount " << t->lockcount);
- t->lockcount--;
+ -- t->lockcount;
cstate->locked_membuf = NULL;
void
CossMemBuf::write(CossSwapDir * SD)
{
- StoreFScoss::GetInstance().stats.stripe_write.ops++;
+ ++ StoreFScoss::GetInstance().stats.stripe_write.ops;
debugs(79, 3, "CossMemBuf::write: offset " << diskstart << ", len " << (diskend - diskstart));
flags.writing = 1;
/* XXX Remember that diskstart/diskend are block offsets! */
if ((o >= (off_t)newmb->diskstart) && (o < (off_t)newmb->diskend)) {
e->release();
- numreleased++;
+ ++numreleased;
} else
break;
}
if (numreleased > 0)
debugs(79, 3, "CossSwapDir::createMemBuf: this allocation released " << numreleased << " storeEntries");
- StoreFScoss::GetInstance().stats.stripes++;
+ ++ StoreFScoss::GetInstance().stats.stripes;
return newmb;
}
if (buf.contentSize() < static_cast<mb_size_t>(sizeof(header))) {
debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << sd->index << "]: " <<
"Ignoring truncated cache entry meta data at " << dbOffset);
- counts.invalid++;
+ ++counts.invalid;
return;
}
memcpy(&header, buf.content(), sizeof(header));
if (!header.sane()) {
debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << sd->index << "]: " <<
"Ignoring malformed cache entry meta data at " << dbOffset);
- counts.invalid++;
+ ++counts.invalid;
return;
}
buf.consume(sizeof(header)); // optimize to avoid memmove()
if (!storeRebuildParseEntry(buf, loadedE, key, counts, header.payloadSize)) {
// skip empty slots
if (loadedE.swap_filen > 0 || loadedE.swap_file_sz > 0) {
- counts.invalid++;
+ ++counts.invalid;
//sd->unlink(filen); leave garbage on disk, it should not hurt
}
return;
if (!storeRebuildKeepEntry(loadedE, key, counts))
return;
- counts.objcount++;
+ ++counts.objcount;
// loadedE->dump(5);
sd->addEntry(filen, header, loadedE);
if (!e)
break; /* no more objects */
- removed++;
+ ++removed;
e->release();
}
if (!pathIsDirectory(path))
return true;
- for (int j = 0; j < l1; j++) {
+ for (int j = 0; j < l1; ++j) {
char const *aPath = swapSubDir(j);
if (!pathIsDirectory(aPath))
{
LOCAL_ARRAY(char, name, MAXPATHLEN);
- for (int i = 0; i < l1; i++) {
+ for (int i = 0; i < l1; ++i) {
snprintf(name, MAXPATHLEN, "%s/%02X", path, i);
int should_exist;
debugs(47, 1, "Making directories in " << name);
- for (int k = 0; k < l2; k++) {
+ for (int k = 0; k < l2; ++k) {
snprintf(name, MAXPATHLEN, "%s/%02X/%02X", path, i, k);
createDirectory(name, should_exist);
}
while (strlen(pathtmp) && pathtmp[strlen(pathtmp) - 1] == '.')
pathtmp[strlen(pathtmp) - 1] = '\0';
- for (pathtmp2 = pathtmp; *pathtmp2 == '.'; pathtmp2++);
+ for (pathtmp2 = pathtmp; *pathtmp2 == '.'; ++pathtmp2);
snprintf(lpath, MAXPATHLEN - 64, Config.Log.swap, pathtmp2);
if (strncmp(lpath, Config.Log.swap, MAXPATHLEN - 64) == 0) {
if (k > 10)
k = 10;
- for (n = 0; n < k; n++) {
+ for (n = 0; n < k; ++n) {
debugs(36, 3, "storeDirClean: Cleaning file "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << files[n]);
snprintf(p2, MAXPATHLEN + 1, "%s/%08X", p1, files[n]);
safeunlink(p2, 0);
*/
UFSDirToGlobalDirMapping = (int *)xcalloc(NumberOfUFSDirs, sizeof(*UFSDirToGlobalDirMapping));
- for (i = 0, n = 0; i < Config.cacheSwap.n_configured; i++) {
+ for (i = 0, n = 0; i < Config.cacheSwap.n_configured; ++i) {
/* This is bogus, the controller should just clean each instance once */
sd = dynamic_cast <SwapDir *>(INDEXSD(i));
/* if the rebuild is finished, start cleaning directories. */
if (0 == StoreController::store_dirs_rebuilding) {
n = DirClean(swap_index);
- swap_index++;
+ ++swap_index;
}
eventAdd("storeDirClean", CleanEvent, NULL,
if (!rb->isDone())
eventAdd("storeRebuild", RebuildStep, rb, 0.01, 1);
else {
- StoreController::store_dirs_rebuilding--;
+ -- StoreController::store_dirs_rebuilding;
storeRebuildComplete(&rb->counts);
delete rb;
}
assert(fd > -1);
/* lets get file stats here */
- n_read++;
+ ++n_read;
if (fstat(fd, &sb) < 0) {
debugs(47, 1, "commonUfsDirRebuildFromDirectory: fstat(FD " << fd << "): " << xstrerror());
file_close(fd);
- store_open_disk_fd--;
+ --store_open_disk_fd;
fd = -1;
return;
}
(int64_t)sb.st_size);
file_close(fd);
- store_open_disk_fd--;
+ --store_open_disk_fd;
fd = -1;
if (!loaded) {
if (!storeRebuildKeepEntry(tmpe, key, counts))
return;
- counts.objcount++;
+ ++counts.objcount;
// tmpe.dump(5);
currentEntry(sd->addDiskRestore(key,
filn,
return;
}
- n_read++;
+ ++n_read;
if (!swapData.sane()) {
- counts.invalid++;
+ ++counts.invalid;
return;
}
}
currentEntry()->release();
- counts.objcount--;
- counts.cancelcount++;
+ --counts.objcount;
+ ++counts.cancelcount;
}
return;
} else {
if (0.0 == x - (double) (int) x)
debugs(47, 1, "WARNING: " << counts.bad_log_op << " invalid swap log entries found");
- counts.invalid++;
+ ++counts.invalid;
return;
}
++counts.scancount; // XXX: should not this be incremented earlier?
if (!sd->validFileno(swapData.swap_filen, 0)) {
- counts.invalid++;
+ ++counts.invalid;
return;
}
if (EBIT_TEST(swapData.flags, KEY_PRIVATE)) {
- counts.badflags++;
+ ++counts.badflags;
return;
}
if (used && !disk_entry_newer) {
/* log entry is old, ignore it */
- counts.clashcount++;
+ ++counts.clashcount;
return;
} else if (used && currentEntry() && currentEntry()->swap_filen == swapData.swap_filen && currentEntry()->swap_dirn == sd->index) {
/* swapfile taken, same URL, newer, update meta */
* were in a slow rebuild and the the swap file number got taken
* and the validation procedure hasn't run. */
assert(flags.need_to_validate);
- counts.clashcount++;
+ ++counts.clashcount;
return;
} else if (currentEntry() && !disk_entry_newer) {
/* key already exists, current entry is newer */
/* keep old, ignore new */
- counts.dupcount++;
+ ++counts.dupcount;
return;
} else if (currentEntry()) {
/* key already exists, this swapfile not being used */
}
currentEntry()->release();
- counts.dupcount++;
+ ++counts.dupcount;
} else {
/* URL doesnt exist, swapfile not in use */
/* load new */
(void) 0;
}
- counts.objcount++;
+ ++counts.objcount;
currentEntry(sd->addDiskRestore(swapData.key,
swapData.swap_filen,
td = opendir(fullpath);
- dirs_opened++;
+ ++dirs_opened;
if (td == NULL) {
debugs(47, 1, "commonUfsDirGetNextFile: opendir: " << fullpath << ": " << xstrerror());
}
if (td != NULL && (entry = readdir(td)) != NULL) {
- in_dir++;
+ ++in_dir;
if (sscanf(entry->d_name, "%x", &fn) != 1) {
debugs(47, 3, "commonUfsDirGetNextFile: invalid " << entry->d_name);
if (fd < 0)
debugs(47, 1, "commonUfsDirGetNextFile: " << fullfilename << ": " << xstrerror());
else
- store_open_disk_fd++;
+ ++store_open_disk_fd;
continue;
}