/*
- * $Id: aiops.cc,v 1.12 2001/10/24 05:26:18 hno Exp $
+ * $Id: aiops.cc,v 1.13 2002/07/21 00:25:45 hno Exp $
*
* DEBUG: section 43 AIOPS
* AUTHOR: Stewart Forster <slf@connect.com.au>
squidaio_queue_request(squidaio_request_t * request)
{
static int high_start = 0;
- debug(41, 9) ("squidaio_queue_request: %p type=%d result=%p\n",
+ debug(43, 9) ("squidaio_queue_request: %p type=%d result=%p\n",
request, request->request_type, request->resultp);
/* Mark it as not executed (failing result, no error) */
request->ret = -1;
squidaio_request_t *request = resultp->_data;
if (request && request->resultp == resultp) {
- debug(41, 9) ("squidaio_cancel: %p type=%d result=%p\n",
+ debug(43, 9) ("squidaio_cancel: %p type=%d result=%p\n",
request, request->request_type, request->resultp);
request->cancelled = 1;
request->resultp = NULL;
if (!request) {
return NULL;
}
- debug(41, 9) ("squidaio_poll_done: %p type=%d result=%p\n",
+ debug(43, 9) ("squidaio_poll_done: %p type=%d result=%p\n",
request, request->request_type, request->resultp);
done_requests.head = request->next;
if (!done_requests.head)
/*
- * $Id: store_dir_aufs.cc,v 1.46 2002/06/26 09:55:57 hno Exp $
+ * $Id: store_dir_aufs.cc,v 1.47 2002/07/21 00:25:45 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
if (ql == 0)
loadav = 0;
loadav = ql * 1000 / MAGIC1;
- debug(41, 9) ("storeAufsDirCheckObj: load=%d\n", loadav);
+ debug(47, 9) ("storeAufsDirCheckObj: load=%d\n", loadav);
return loadav;
}
void
storeAufsDirRefObj(SwapDir * SD, StoreEntry * e)
{
- debug(1, 3) ("storeAufsDirRefObj: referencing %p %d/%d\n", e, e->swap_dirn,
+ debug(47, 3) ("storeAufsDirRefObj: referencing %p %d/%d\n", e, e->swap_dirn,
e->swap_filen);
if (SD->repl->Referenced)
SD->repl->Referenced(SD->repl, e, &e->repl);
void
storeAufsDirUnrefObj(SwapDir * SD, StoreEntry * e)
{
- debug(1, 3) ("storeAufsDirUnrefObj: referencing %p %d/%d\n", e, e->swap_dirn,
+ debug(47, 3) ("storeAufsDirUnrefObj: referencing %p %d/%d\n", e, e->swap_dirn,
e->swap_filen);
if (SD->repl->Dereferenced)
SD->repl->Dereferenced(SD->repl, e, &e->repl);
* supports are read/write, and since COSS works on a single file
* per storedir it should work just fine.
*
- * $Id: async_io.cc,v 1.9 2002/05/19 14:14:52 hno Exp $
+ * $Id: async_io.cc,v 1.10 2002/07/21 00:25:45 hno Exp $
*/
#include "squid.h"
/* Initiate aio */
if (aio_read(&qe->aq_e_aiocb) < 0) {
- debug(1, 1) ("Aiee! aio_read() returned error (%d)!\n", errno);
- assert(1 == 0);
+ fatalf(79, 1) ("Aiee! aio_read() returned error (%d)!\n", errno);
}
}
/* Initiate aio */
if (aio_write(&qe->aq_e_aiocb) < 0) {
- debug(1, 1) ("Aiee! aio_read() returned error (%d)!\n", errno);
+ fatalf("Aiee! aio_read() returned error (%d)!\n", errno);
assert(1 == 0);
}
}
/*
- * $Id: store_dir_coss.cc,v 1.36 2002/07/20 23:51:05 hno Exp $
+ * $Id: store_dir_coss.cc,v 1.37 2002/07/21 00:25:45 hno Exp $
*
* DEBUG: section 47 Store COSS Directory Routines
* AUTHOR: Eric Stern
path = storeCossDirSwapLogFile(sd, NULL);
fd = file_open(path, O_WRONLY | O_CREAT | O_BINARY);
if (fd < 0) {
- debug(79, 1) ("%s: %s\n", path, xstrerror());
+ debug(47, 1) ("%s: %s\n", path, xstrerror());
fatal("storeCossDirOpenSwapLog: Failed to open swap log.");
}
- debug(79, 3) ("Cache COSS Dir #%d log opened on FD %d\n", sd->index, fd);
+ debug(47, 3) ("Cache COSS Dir #%d log opened on FD %d\n", sd->index, fd);
cs->swaplog_fd = fd;
}
if (cs->swaplog_fd < 0) /* not open */
return;
file_close(cs->swaplog_fd);
- debug(79, 3) ("Cache COSS Dir #%d log closed on FD %d\n",
+ debug(47, 3) ("Cache COSS Dir #%d log closed on FD %d\n",
sd->index, cs->swaplog_fd);
cs->swaplog_fd = -1;
}
storeCossDirRebuild(sd);
cs->fd = file_open(sd->path, O_RDWR | O_CREAT);
if (cs->fd < 0) {
- debug(79, 1) ("%s: %s\n", sd->path, xstrerror());
+ debug(47, 1) ("%s: %s\n", sd->path, xstrerror());
fatal("storeCossDirInit: Failed to open a COSS directory.");
}
n_coss_dirs++;
/* load a number of objects per invocation */
for (count = 0; count < rb->speed; count++) {
if (fread(&s, ss, 1, rb->log) != 1) {
- debug(79, 1) ("Done reading %s swaplog (%d entries)\n",
+ debug(47, 1) ("Done reading %s swaplog (%d entries)\n",
rb->sd->path, rb->n_read);
fclose(rb->log);
rb->log = NULL;
continue;
if (s.op >= SWAP_LOG_MAX)
continue;
- debug(20, 3) ("storeCossRebuildFromSwapLog: %s %s %08X\n",
+ debug(47, 3) ("storeCossRebuildFromSwapLog: %s %s %08X\n",
swap_log_op_str[(int) s.op],
storeKeyText(s.key),
s.swap_filen);
} else {
x = log(++rb->counts.bad_log_op) / log(10.0);
if (0.0 == x - (double) (int) x)
- debug(20, 1) ("WARNING: %d invalid swap log entries found\n",
+ debug(47, 1) ("WARNING: %d invalid swap log entries found\n",
rb->counts.bad_log_op);
rb->counts.invalid++;
continue;
int clean)
{
StoreEntry *e = NULL;
- debug(20, 5) ("storeCossAddDiskRestore: %s, fileno=%08X\n", storeKeyText(key), file_number);
+ debug(47, 5) ("storeCossAddDiskRestore: %s, fileno=%08X\n", storeKeyText(key), file_number);
/* if you call this you'd better be sure file_number is not
* already in use! */
e = new_StoreEntry(STORE_ENTRY_WITHOUT_MEMOBJ, NULL, NULL);
* we'll use storeCossRebuildFromSwapLog().
*/
fp = storeCossDirOpenTmpSwapLog(sd, &clean, &zero);
- debug(20, 1) ("Rebuilding COSS storage in %s (%s)\n",
+ debug(47, 1) ("Rebuilding COSS storage in %s (%s)\n",
sd->path, clean ? "CLEAN" : "DIRTY");
rb->log = fp;
store_dirs_rebuilding++;
FILE *fp;
int fd;
if (stat(swaplog_path, &log_sb) < 0) {
- debug(47, 1) ("Cache COSS Dir #%d: No log file\n", sd->index);
+ debug(50, 1) ("Cache COSS Dir #%d: No log file\n", sd->index);
safe_free(swaplog_path);
safe_free(clean_path);
safe_free(new_path);
state->outbuf_offset = 0;
unlink(state->cln);
state->current = cs->index.tail;
- debug(20, 3) ("storeCOssDirWriteCleanLogs: opened %s, FD %d\n",
+ debug(50, 3) ("storeCOssDirWriteCleanLogs: opened %s, FD %d\n",
state->new, state->fd);
#if HAVE_FCHMOD
if (stat(state->cur, &sb) == 0)
if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) {
debug(50, 0) ("storeCossDirWriteCleanLogs: %s: write: %s\n",
state->new, xstrerror());
- debug(20, 0) ("storeCossDirWriteCleanLogs: Current swap logfile not replaced.\n");
+ debug(50, 0) ("storeCossDirWriteCleanLogs: Current swap logfile not replaced.\n");
file_close(state->fd);
state->fd = -1;
unlink(state->new);
if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) {
debug(50, 0) ("storeCossDirWriteCleanLogs: %s: write: %s\n",
state->new, xstrerror());
- debug(20, 0) ("storeCossDirWriteCleanLogs: Current swap logfile "
+ debug(50, 0) ("storeCossDirWriteCleanLogs: Current swap logfile "
"not replaced.\n");
file_close(state->fd);
state->fd = -1;
/*
- * $Id: store_dir_diskd.cc,v 1.68 2002/07/20 23:51:06 hno Exp $
+ * $Id: store_dir_diskd.cc,v 1.69 2002/07/21 00:25:46 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
getCurrentTime();
if (0 == stat(path, &st)) {
if (S_ISDIR(st.st_mode)) {
- debug(20, should_exist ? 3 : 1) ("%s exists\n", path);
+ debug(47, should_exist ? 3 : 1) ("%s exists\n", path);
} else {
fatalf("Swap directory %s is not a directory.", path);
}
} else if (0 == mkdir(path, 0755)) {
- debug(20, should_exist ? 1 : 3) ("%s created\n", path);
+ debug(47, should_exist ? 1 : 3) ("%s created\n", path);
created = 1;
} else {
fatalf("Failed to make swap directory %s: %s",
{
struct stat sb;
if (stat(path, &sb) < 0) {
- debug(20, 0) ("%s: %s\n", path, xstrerror());
+ debug(47, 0) ("%s: %s\n", path, xstrerror());
return -1;
}
if (S_ISDIR(sb.st_mode) == 0) {
- debug(20, 0) ("%s is not a directory\n", path);
+ debug(47, 0) ("%s is not a directory\n", path);
return -1;
}
return 0;
if (x < 0)
break;
else if (x != msg_snd_rcv_sz) {
- debug(79, 1) ("storeDiskdDirCallback: msgget returns %d\n",
+ debug(47, 1) ("storeDiskdDirCallback: msgget returns %d\n",
x);
break;
}
tlv *tlv_list;
tlv *t;
assert(rb != NULL);
- debug(20, 3) ("storeDiskdDirRebuildFromDirectory: DIR #%d\n", rb->sd->index);
+ debug(47, 3) ("storeDiskdDirRebuildFromDirectory: DIR #%d\n", rb->sd->index);
for (count = 0; count < rb->speed; count++) {
assert(fd == -1);
fd = storeDiskdDirGetNextFile(rb, &filn, &size);
if (fd == -2) {
- debug(20, 1) ("Done scanning %s swaplog (%d entries)\n",
+ debug(47, 1) ("Done scanning %s swaplog (%d entries)\n",
rb->sd->path, rb->n_read);
store_dirs_rebuilding--;
storeDiskdDirCloseTmpSwapLog(rb->sd);
assert(fd > -1);
/* lets get file stats here */
if (fstat(fd, &sb) < 0) {
- debug(20, 1) ("storeDiskdDirRebuildFromDirectory: fstat(FD %d): %s\n",
+ debug(47, 1) ("storeDiskdDirRebuildFromDirectory: fstat(FD %d): %s\n",
fd, xstrerror());
file_close(fd);
store_open_disk_fd--;
continue;
}
if ((++rb->counts.scancount & 0xFFFF) == 0)
- debug(20, 3) (" %s %7d files opened so far.\n",
+ debug(47, 3) (" %s %7d files opened so far.\n",
rb->sd->path, rb->counts.scancount);
- debug(20, 9) ("file_in: fd=%d %08X\n", fd, filn);
+ debug(47, 9) ("file_in: fd=%d %08X\n", fd, filn);
statCounter.syscalls.disk.reads++;
if (FD_READ_METHOD(fd, hdr_buf, SM_PAGE_SIZE) < 0) {
- debug(20, 1) ("storeDiskdDirRebuildFromDirectory: read(FD %d): %s\n",
+ debug(47, 1) ("storeDiskdDirRebuildFromDirectory: read(FD %d): %s\n",
fd, xstrerror());
file_close(fd);
store_open_disk_fd--;
#endif
tlv_list = storeSwapMetaUnpack(hdr_buf, &swap_hdr_len);
if (tlv_list == NULL) {
- debug(20, 1) ("storeDiskdDirRebuildFromDirectory: failed to get meta data\n");
+ debug(47, 1) ("storeDiskdDirRebuildFromDirectory: failed to get meta data\n");
/* XXX shouldn't this be a call to storeDiskdUnlink ? */
storeDiskdDirUnlinkFile(SD, filn);
continue;
}
- debug(20, 3) ("storeDiskdDirRebuildFromDirectory: successful swap meta unpacking\n");
+ debug(47, 3) ("storeDiskdDirRebuildFromDirectory: successful swap meta unpacking\n");
memset(key, '\0', MD5_DIGEST_CHARS);
memset(&tmpe, '\0', sizeof(StoreEntry));
for (t = tlv_list; t; t = t->next) {
storeSwapTLVFree(tlv_list);
tlv_list = NULL;
if (storeKeyNull(key)) {
- debug(20, 1) ("storeDiskdDirRebuildFromDirectory: NULL key\n");
+ debug(47, 1) ("storeDiskdDirRebuildFromDirectory: NULL key\n");
storeDiskdDirUnlinkFile(SD, filn);
continue;
}
} else if (tmpe.swap_file_sz == sb.st_size - swap_hdr_len) {
tmpe.swap_file_sz = sb.st_size;
} else if (tmpe.swap_file_sz != sb.st_size) {
- debug(20, 1) ("storeDiskdDirRebuildFromDirectory: SIZE MISMATCH %ld!=%ld\n",
+ debug(47, 1) ("storeDiskdDirRebuildFromDirectory: SIZE MISMATCH %ld!=%ld\n",
(long int) tmpe.swap_file_sz, (long int) sb.st_size);
storeDiskdDirUnlinkFile(SD, filn);
continue;
/* load a number of objects per invocation */
for (count = 0; count < rb->speed; count++) {
if (fread(&s, ss, 1, rb->log) != 1) {
- debug(20, 1) ("Done reading %s swaplog (%d entries)\n",
+ debug(47, 1) ("Done reading %s swaplog (%d entries)\n",
rb->sd->path, rb->n_read);
fclose(rb->log);
rb->log = NULL;
* to mask it off.
*/
s.swap_filen &= 0x00FFFFFF;
- debug(20, 3) ("storeDiskdDirRebuildFromSwapLog: %s %s %08X\n",
+ debug(47, 3) ("storeDiskdDirRebuildFromSwapLog: %s %s %08X\n",
swap_log_op_str[(int) s.op],
storeKeyText(s.key),
s.swap_filen);
} else {
x = log(++rb->counts.bad_log_op) / log(10.0);
if (0.0 == x - (double) (int) x)
- debug(20, 1) ("WARNING: %d invalid swap log entries found\n",
+ debug(47, 1) ("WARNING: %d invalid swap log entries found\n",
rb->counts.bad_log_op);
rb->counts.invalid++;
continue;
storeDiskdDirUnrefObj(SD, e);
} else {
debug_trap("storeDiskdDirRebuildFromSwapLog: bad condition");
- debug(20, 1) ("\tSee %s:%d\n", __FILE__, __LINE__);
+ debug(47, 1) ("\tSee %s:%d\n", __FILE__, __LINE__);
}
continue;
} else if (used) {
* point. If the log is dirty, the filesize check should have
* caught this. If the log is clean, there should never be a
* newer entry. */
- debug(20, 1) ("WARNING: newer swaplog entry for dirno %d, fileno %08X\n",
+ debug(47, 1) ("WARNING: newer swaplog entry for dirno %d, fileno %08X\n",
SD->index, s.swap_filen);
/* I'm tempted to remove the swapfile here just to be safe,
* but there is a bad race condition in the NOVM version if
int fd = -1;
int used = 0;
int dirs_opened = 0;
- debug(20, 3) ("storeDiskdDirGetNextFile: flag=%d, %d: /%02X/%02X\n",
+ debug(47, 3) ("storeDiskdDirGetNextFile: flag=%d, %d: /%02X/%02X\n",
rb->flags.init,
rb->sd->index,
rb->curlvl1,
rb->entry = readdir(rb->td); /* skip . and .. */
rb->entry = readdir(rb->td);
if (rb->entry == NULL && errno == ENOENT)
- debug(20, 1) ("storeDiskdDirGetNextFile: directory does not exist!.\n");
- debug(20, 3) ("storeDiskdDirGetNextFile: Directory %s\n", rb->fullpath);
+ debug(47, 1) ("storeDiskdDirGetNextFile: directory does not exist!.\n");
+ debug(47, 3) ("storeDiskdDirGetNextFile: Directory %s\n", rb->fullpath);
}
}
if (rb->td != NULL && (rb->entry = readdir(rb->td)) != NULL) {
rb->in_dir++;
if (sscanf(rb->entry->d_name, "%x", &rb->fn) != 1) {
- debug(20, 3) ("storeDiskdDirGetNextFile: invalid %s\n",
+ debug(47, 3) ("storeDiskdDirGetNextFile: invalid %s\n",
rb->entry->d_name);
continue;
}
if (!storeDiskdFilenoBelongsHere(rb->fn, rb->sd->index, rb->curlvl1, rb->curlvl2)) {
- debug(20, 3) ("storeDiskdDirGetNextFile: %08X does not belong in %d/%d/%d\n",
+ debug(47, 3) ("storeDiskdDirGetNextFile: %08X does not belong in %d/%d/%d\n",
rb->fn, rb->sd->index, rb->curlvl1, rb->curlvl2);
continue;
}
used = storeDiskdDirMapBitTest(SD, rb->fn);
if (used) {
- debug(20, 3) ("storeDiskdDirGetNextFile: Locked, continuing with next.\n");
+ debug(47, 3) ("storeDiskdDirGetNextFile: Locked, continuing with next.\n");
continue;
}
snprintf(rb->fullfilename, SQUID_MAXPATHLEN, "%s/%s",
rb->fullpath, rb->entry->d_name);
- debug(20, 3) ("storeDiskdDirGetNextFile: Opening %s\n", rb->fullfilename);
+ debug(47, 3) ("storeDiskdDirGetNextFile: Opening %s\n", rb->fullfilename);
fd = file_open(rb->fullfilename, O_RDONLY);
if (fd < 0)
debug(50, 1) ("storeDiskdDirGetNextFile: %s: %s\n", rb->fullfilename, xstrerror());
int clean)
{
StoreEntry *e = NULL;
- debug(20, 5) ("storeDiskdAddDiskRestore: %s, fileno=%08X\n", storeKeyText(key), file_number);
+ debug(47, 5) ("storeDiskdAddDiskRestore: %s, fileno=%08X\n", storeKeyText(key), file_number);
/* if you call this you'd better be sure file_number is not
* already in use! */
e = new_StoreEntry(STORE_ENTRY_WITHOUT_MEMOBJ, NULL, NULL);
}
if (!clean)
rb->flags.need_to_validate = 1;
- debug(20, 1) ("Rebuilding storage in %s (%s)\n",
+ debug(47, 1) ("Rebuilding storage in %s (%s)\n",
sd->path, clean ? "CLEAN" : "DIRTY");
store_dirs_rebuilding++;
eventAdd("storeRebuild", func, rb, 0.0, 1);
xfree(state);
return -1;
}
- debug(20, 3) ("storeDirWriteCleanLogs: opened %s, FD %d\n",
+ debug(47, 3) ("storeDirWriteCleanLogs: opened %s, FD %d\n",
state->new, state->fd);
#if HAVE_FCHMOD
if (stat(state->cur, &sb) == 0)
if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) {
debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n",
state->new, xstrerror());
- debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile not replaced.\n");
+ debug(47, 0) ("storeDirWriteCleanLogs: Current swap logfile not replaced.\n");
file_close(state->fd);
state->fd = -1;
unlink(state->new);
if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) {
debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n",
state->new, xstrerror());
- debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile "
+ debug(47, 0) ("storeDirWriteCleanLogs: Current swap logfile "
"not replaced.\n");
file_close(state->fd);
state->fd = -1;
* This is kinda cheap, but so we need this priority hack?
*/
}
- debug(20, 3) ("storeMaintainSwapSpace: f=%f, max_scan=%d, max_remove=%d\n", f, max_scan, max_remove);
+ debug(47, 3) ("storeMaintainSwapSpace: f=%f, max_scan=%d, max_remove=%d\n", f, max_scan, max_remove);
walker = SD->repl->PurgeInit(SD->repl, max_scan);
while (1) {
if (SD->cur_size < SD->low_size)
storeRelease(e);
}
walker->Done(walker);
- debug(20, (removed ? 2 : 3)) ("storeDiskdDirMaintain: %s removed %d/%d f=%.03f max_scan=%d\n",
+ debug(47, (removed ? 2 : 3)) ("storeDiskdDirMaintain: %s removed %d/%d f=%.03f max_scan=%d\n",
SD->path, removed, max_remove, f, max_scan);
}
void
storeDiskdDirRefObj(SwapDir * SD, StoreEntry * e)
{
- debug(1, 3) ("storeDiskdDirRefObj: referencing %p %d/%d\n", e, e->swap_dirn,
+ debug(47, 3) ("storeDiskdDirRefObj: referencing %p %d/%d\n", e, e->swap_dirn,
e->swap_filen);
if (SD->repl->Referenced)
SD->repl->Referenced(SD->repl, e, &e->repl);
void
storeDiskdDirUnrefObj(SwapDir * SD, StoreEntry * e)
{
- debug(1, 3) ("storeDiskdDirUnrefObj: referencing %p %d/%d\n", e,
+ debug(47, 3) ("storeDiskdDirUnrefObj: referencing %p %d/%d\n", e,
e->swap_dirn, e->swap_filen);
if (SD->repl->Dereferenced)
SD->repl->Dereferenced(SD->repl, e, &e->repl);
void
storeDiskdDirUnlinkFile(SwapDir * SD, sfileno f)
{
- debug(79, 3) ("storeDiskdDirUnlinkFile: unlinking fileno %08X\n", f);
+ debug(47, 3) ("storeDiskdDirUnlinkFile: unlinking fileno %08X\n", f);
/* storeDiskdDirMapBitReset(SD, f); */
#if USE_UNLINKD
unlinkdUnlink(storeDiskdDirFullPath(SD, f, NULL));
void
storeDiskdDirReplAdd(SwapDir * SD, StoreEntry * e)
{
- debug(20, 4) ("storeDiskdDirReplAdd: added node %p to dir %d\n", e,
+ debug(47, 4) ("storeDiskdDirReplAdd: added node %p to dir %d\n", e,
SD->index);
SD->repl->Add(SD->repl, e, &e->repl);
}
if (e->swap_dirn < 0)
return;
SD = INDEXSD(e->swap_dirn);
- debug(20, 4) ("storeDiskdDirReplRemove: remove node %p from dir %d\n", e,
+ debug(47, 4) ("storeDiskdDirReplRemove: remove node %p from dir %d\n", e,
SD->index);
SD->repl->Remove(SD->repl, e, &e->repl);
}
{
struct stat sb;
if (stat(storeDiskdDirFullPath(sd, e->swap_filen, NULL), &sb) < 0) {
- debug(20, 0) ("storeDiskdCleanupDoubleCheck: MISSING SWAP FILE\n");
- debug(20, 0) ("storeDiskdCleanupDoubleCheck: FILENO %08X\n", e->swap_filen);
- debug(20, 0) ("storeDiskdCleanupDoubleCheck: PATH %s\n",
+ debug(47, 0) ("storeDiskdCleanupDoubleCheck: MISSING SWAP FILE\n");
+ debug(47, 0) ("storeDiskdCleanupDoubleCheck: FILENO %08X\n", e->swap_filen);
+ debug(47, 0) ("storeDiskdCleanupDoubleCheck: PATH %s\n",
storeDiskdDirFullPath(sd, e->swap_filen, NULL));
storeEntryDump(e, 0);
return -1;
}
if (e->swap_file_sz != sb.st_size) {
- debug(20, 0) ("storeDiskdCleanupDoubleCheck: SIZE MISMATCH\n");
- debug(20, 0) ("storeDiskdCleanupDoubleCheck: FILENO %08X\n", e->swap_filen);
- debug(20, 0) ("storeDiskdCleanupDoubleCheck: PATH %s\n",
+ debug(47, 0) ("storeDiskdCleanupDoubleCheck: SIZE MISMATCH\n");
+ debug(47, 0) ("storeDiskdCleanupDoubleCheck: FILENO %08X\n", e->swap_filen);
+ debug(47, 0) ("storeDiskdCleanupDoubleCheck: PATH %s\n",
storeDiskdDirFullPath(sd, e->swap_filen, NULL));
- debug(20, 0) ("storeDiskdCleanupDoubleCheck: ENTRY SIZE: %ld, FILE SIZE: %ld\n",
+ debug(47, 0) ("storeDiskdCleanupDoubleCheck: ENTRY SIZE: %ld, FILE SIZE: %ld\n",
(long int) e->swap_file_sz, (long int) sb.st_size);
storeEntryDump(e, 0);
return -1;
diskd_state_pool = memPoolCreate("DISKD IO State data", sizeof(diskdstate_t));
memset(&diskd_stats, '\0', sizeof(diskd_stats));
cachemgrRegister("diskd", "DISKD Stats", storeDiskdStats, 0, 1);
- debug(79, 1) ("diskd started\n");
+ debug(47, 1) ("diskd started\n");
diskd_initialised = 1;
}
/*
- * $Id: store_io_diskd.cc,v 1.24 2002/07/20 23:51:06 hno Exp $
+ * $Id: store_io_diskd.cc,v 1.25 2002/07/21 00:25:46 hno Exp $
*
* DEBUG: section 79 Squid-side DISKD I/O functions.
* AUTHOR: Duane Wessels
O_RDONLY,
shm_offset);
if (x < 0) {
- debug(50, 1) ("storeDiskdSend OPEN: %s\n", xstrerror());
+ debug(79, 1) ("storeDiskdSend OPEN: %s\n", xstrerror());
storeDiskdShmPut(SD, shm_offset);
cbdataReferenceDone(sio->callback_data);
cbdataFree(sio);
sio->mode,
shm_offset);
if (x < 0) {
- debug(50, 1) ("storeDiskdSend OPEN: %s\n", xstrerror());
+ debug(79, 1) ("storeDiskdSend OPEN: %s\n", xstrerror());
storeDiskdShmPut(SD, shm_offset);
cbdataReferenceDone(sio->callback_data);
cbdataFree(sio);
0,
-1);
if (x < 0) {
- debug(50, 1) ("storeDiskdSend CLOSE: %s\n", xstrerror());
+ debug(79, 1) ("storeDiskdSend CLOSE: %s\n", xstrerror());
storeDiskdIOCallback(sio, DISK_ERROR);
}
diskdstate->flags.close_request = 1;
(int) offset,
shm_offset);
if (x < 0) {
- debug(50, 1) ("storeDiskdSend READ: %s\n", xstrerror());
+ debug(79, 1) ("storeDiskdSend READ: %s\n", xstrerror());
storeDiskdShmPut(SD, shm_offset);
storeDiskdIOCallback(sio, DISK_ERROR);
}
(int) offset,
shm_offset);
if (x < 0) {
- debug(50, 1) ("storeDiskdSend WRITE: %s\n", xstrerror());
+ debug(79, 1) ("storeDiskdSend WRITE: %s\n", xstrerror());
storeDiskdShmPut(SD, shm_offset);
storeDiskdIOCallback(sio, DISK_ERROR);
}
storeDiskdDirMapBitReset(SD, e->swap_filen);
if (diskdinfo->away >= diskdinfo->magic1) {
/* Damn, we need to issue a sync unlink here :( */
- debug(50, 2) ("storeDiskUnlink: Out of queue space, sync unlink\n");
+ debug(79, 2) ("storeDiskUnlink: Out of queue space, sync unlink\n");
storeDiskdDirUnlinkFile(SD, e->swap_filen);
return;
}
0,
shm_offset);
if (x < 0) {
- debug(50, 1) ("storeDiskdSend UNLINK: %s\n", xstrerror());
+ debug(79, 1) ("storeDiskdSend UNLINK: %s\n", xstrerror());
unlink(buf); /* XXX EWW! */
storeDiskdShmPut(SD, shm_offset);
}
diskd_stats.sent_count++;
diskdinfo->away++;
} else {
- debug(50, 1) ("storeDiskdSend: msgsnd: %s\n", xstrerror());
+ debug(79, 1) ("storeDiskdSend: msgsnd: %s\n", xstrerror());
cbdataReferenceDone(M.callback_data);
assert(++send_errors < 100);
}
/*
- * $Id: store_dir_ufs.cc,v 1.45 2002/06/26 09:55:59 hno Exp $
+ * $Id: store_dir_ufs.cc,v 1.46 2002/07/21 00:25:46 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
getCurrentTime();
if (0 == stat(path, &st)) {
if (S_ISDIR(st.st_mode)) {
- debug(20, should_exist ? 3 : 1) ("%s exists\n", path);
+ debug(47, should_exist ? 3 : 1) ("%s exists\n", path);
} else {
fatalf("Swap directory %s is not a directory.", path);
}
} else if (0 == mkdir(path, 0755)) {
- debug(20, should_exist ? 1 : 3) ("%s created\n", path);
+ debug(47, should_exist ? 1 : 3) ("%s created\n", path);
created = 1;
} else {
fatalf("Failed to make swap directory %s: %s",
{
struct stat sb;
if (stat(path, &sb) < 0) {
- debug(20, 0) ("%s: %s\n", path, xstrerror());
+ debug(47, 0) ("%s: %s\n", path, xstrerror());
return -1;
}
if (S_ISDIR(sb.st_mode) == 0) {
- debug(20, 0) ("%s is not a directory\n", path);
+ debug(47, 0) ("%s is not a directory\n", path);
return -1;
}
return 0;
tlv *tlv_list;
tlv *t;
assert(rb != NULL);
- debug(20, 3) ("storeUfsDirRebuildFromDirectory: DIR #%d\n", rb->sd->index);
+ debug(47, 3) ("storeUfsDirRebuildFromDirectory: DIR #%d\n", rb->sd->index);
for (count = 0; count < rb->speed; count++) {
assert(fd == -1);
fd = storeUfsDirGetNextFile(rb, &filn, &size);
if (fd == -2) {
- debug(20, 1) ("Done scanning %s swaplog (%d entries)\n",
+ debug(47, 1) ("Done scanning %s swaplog (%d entries)\n",
rb->sd->path, rb->n_read);
store_dirs_rebuilding--;
storeUfsDirCloseTmpSwapLog(rb->sd);
assert(fd > -1);
/* lets get file stats here */
if (fstat(fd, &sb) < 0) {
- debug(20, 1) ("storeUfsDirRebuildFromDirectory: fstat(FD %d): %s\n",
+ debug(47, 1) ("storeUfsDirRebuildFromDirectory: fstat(FD %d): %s\n",
fd, xstrerror());
file_close(fd);
store_open_disk_fd--;
continue;
}
if ((++rb->counts.scancount & 0xFFFF) == 0)
- debug(20, 3) (" %s %7d files opened so far.\n",
+ debug(47, 3) (" %s %7d files opened so far.\n",
rb->sd->path, rb->counts.scancount);
- debug(20, 9) ("file_in: fd=%d %08X\n", fd, filn);
+ debug(47, 9) ("file_in: fd=%d %08X\n", fd, filn);
statCounter.syscalls.disk.reads++;
if (FD_READ_METHOD(fd, hdr_buf, SM_PAGE_SIZE) < 0) {
- debug(20, 1) ("storeUfsDirRebuildFromDirectory: read(FD %d): %s\n",
+ debug(47, 1) ("storeUfsDirRebuildFromDirectory: read(FD %d): %s\n",
fd, xstrerror());
file_close(fd);
store_open_disk_fd--;
#endif
tlv_list = storeSwapMetaUnpack(hdr_buf, &swap_hdr_len);
if (tlv_list == NULL) {
- debug(20, 1) ("storeUfsDirRebuildFromDirectory: failed to get meta data\n");
+ debug(47, 1) ("storeUfsDirRebuildFromDirectory: failed to get meta data\n");
/* XXX shouldn't this be a call to storeUfsUnlink ? */
storeUfsDirUnlinkFile(SD, filn);
continue;
}
- debug(20, 3) ("storeUfsDirRebuildFromDirectory: successful swap meta unpacking\n");
+ debug(47, 3) ("storeUfsDirRebuildFromDirectory: successful swap meta unpacking\n");
memset(key, '\0', MD5_DIGEST_CHARS);
memset(&tmpe, '\0', sizeof(StoreEntry));
for (t = tlv_list; t; t = t->next) {
storeSwapTLVFree(tlv_list);
tlv_list = NULL;
if (storeKeyNull(key)) {
- debug(20, 1) ("storeUfsDirRebuildFromDirectory: NULL key\n");
+ debug(47, 1) ("storeUfsDirRebuildFromDirectory: NULL key\n");
storeUfsDirUnlinkFile(SD, filn);
continue;
}
} else if (tmpe.swap_file_sz == sb.st_size - swap_hdr_len) {
tmpe.swap_file_sz = sb.st_size;
} else if (tmpe.swap_file_sz != sb.st_size) {
- debug(20, 1) ("storeUfsDirRebuildFromDirectory: SIZE MISMATCH %ld!=%ld\n",
+ debug(47, 1) ("storeUfsDirRebuildFromDirectory: SIZE MISMATCH %ld!=%ld\n",
(long int) tmpe.swap_file_sz, (long int) sb.st_size);
storeUfsDirUnlinkFile(SD, filn);
continue;
/* load a number of objects per invocation */
for (count = 0; count < rb->speed; count++) {
if (fread(&s, ss, 1, rb->log) != 1) {
- debug(20, 1) ("Done reading %s swaplog (%d entries)\n",
+ debug(47, 1) ("Done reading %s swaplog (%d entries)\n",
rb->sd->path, rb->n_read);
fclose(rb->log);
rb->log = NULL;
* to mask it off.
*/
s.swap_filen &= 0x00FFFFFF;
- debug(20, 3) ("storeUfsDirRebuildFromSwapLog: %s %s %08X\n",
+ debug(47, 3) ("storeUfsDirRebuildFromSwapLog: %s %s %08X\n",
swap_log_op_str[(int) s.op],
storeKeyText(s.key),
s.swap_filen);
} else {
x = log(++rb->counts.bad_log_op) / log(10.0);
if (0.0 == x - (double) (int) x)
- debug(20, 1) ("WARNING: %d invalid swap log entries found\n",
+ debug(47, 1) ("WARNING: %d invalid swap log entries found\n",
rb->counts.bad_log_op);
rb->counts.invalid++;
continue;
storeUfsDirUnrefObj(SD, e);
} else {
debug_trap("storeUfsDirRebuildFromSwapLog: bad condition");
- debug(20, 1) ("\tSee %s:%d\n", __FILE__, __LINE__);
+ debug(47, 1) ("\tSee %s:%d\n", __FILE__, __LINE__);
}
continue;
} else if (used) {
* point. If the log is dirty, the filesize check should have
* caught this. If the log is clean, there should never be a
* newer entry. */
- debug(20, 1) ("WARNING: newer swaplog entry for dirno %d, fileno %08X\n",
+ debug(47, 1) ("WARNING: newer swaplog entry for dirno %d, fileno %08X\n",
SD->index, s.swap_filen);
/* I'm tempted to remove the swapfile here just to be safe,
* but there is a bad race condition in the NOVM version if
int fd = -1;
int used = 0;
int dirs_opened = 0;
- debug(20, 3) ("storeUfsDirGetNextFile: flag=%d, %d: /%02X/%02X\n",
+ debug(47, 3) ("storeUfsDirGetNextFile: flag=%d, %d: /%02X/%02X\n",
rb->flags.init,
rb->sd->index,
rb->curlvl1, rb->curlvl2);
rb->td = opendir(rb->fullpath);
dirs_opened++;
if (rb->td == NULL) {
- debug(50, 1) ("storeUfsDirGetNextFile: opendir: %s: %s\n",
+ debug(47, 1) ("storeUfsDirGetNextFile: opendir: %s: %s\n",
rb->fullpath, xstrerror());
} else {
rb->entry = readdir(rb->td); /* skip . and .. */
rb->entry = readdir(rb->td);
if (rb->entry == NULL && errno == ENOENT)
- debug(20, 1) ("storeUfsDirGetNextFile: directory does not exist!.\n");
- debug(20, 3) ("storeUfsDirGetNextFile: Directory %s\n", rb->fullpath);
+ debug(47, 1) ("storeUfsDirGetNextFile: directory does not exist!.\n");
+ debug(47, 3) ("storeUfsDirGetNextFile: Directory %s\n", rb->fullpath);
}
}
if (rb->td != NULL && (rb->entry = readdir(rb->td)) != NULL) {
rb->in_dir++;
if (sscanf(rb->entry->d_name, "%x", &rb->fn) != 1) {
- debug(20, 3) ("storeUfsDirGetNextFile: invalid %s\n",
+ debug(47, 3) ("storeUfsDirGetNextFile: invalid %s\n",
rb->entry->d_name);
continue;
}
if (!storeUfsFilenoBelongsHere(rb->fn, rb->sd->index, rb->curlvl1, rb->curlvl2)) {
- debug(20, 3) ("storeUfsDirGetNextFile: %08X does not belong in %d/%d/%d\n",
+ debug(47, 3) ("storeUfsDirGetNextFile: %08X does not belong in %d/%d/%d\n",
rb->fn, rb->sd->index, rb->curlvl1, rb->curlvl2);
continue;
}
used = storeUfsDirMapBitTest(SD, rb->fn);
if (used) {
- debug(20, 3) ("storeUfsDirGetNextFile: Locked, continuing with next.\n");
+ debug(47, 3) ("storeUfsDirGetNextFile: Locked, continuing with next.\n");
continue;
}
snprintf(rb->fullfilename, SQUID_MAXPATHLEN, "%s/%s",
rb->fullpath, rb->entry->d_name);
- debug(20, 3) ("storeUfsDirGetNextFile: Opening %s\n", rb->fullfilename);
+ debug(47, 3) ("storeUfsDirGetNextFile: Opening %s\n", rb->fullfilename);
fd = file_open(rb->fullfilename, O_RDONLY | O_BINARY);
if (fd < 0)
- debug(50, 1) ("storeUfsDirGetNextFile: %s: %s\n", rb->fullfilename, xstrerror());
+ debug(47, 1) ("storeUfsDirGetNextFile: %s: %s\n", rb->fullfilename, xstrerror());
else
store_open_disk_fd++;
continue;
int clean)
{
StoreEntry *e = NULL;
- debug(20, 5) ("storeUfsAddDiskRestore: %s, fileno=%08X\n", storeKeyText(key), file_number);
+ debug(47, 5) ("storeUfsAddDiskRestore: %s, fileno=%08X\n", storeKeyText(key), file_number);
/* if you call this you'd better be sure file_number is not
* already in use! */
e = new_StoreEntry(STORE_ENTRY_WITHOUT_MEMOBJ, NULL, NULL);
}
if (!clean)
rb->flags.need_to_validate = 1;
- debug(20, 1) ("Rebuilding storage in %s (%s)\n",
+ debug(47, 1) ("Rebuilding storage in %s (%s)\n",
sd->path, clean ? "CLEAN" : "DIRTY");
store_dirs_rebuilding++;
eventAdd("storeRebuild", func, rb, 0.0, 1);
state->outbuf_offset = 0;
state->walker = sd->repl->WalkInit(sd->repl);
unlink(state->cln);
- debug(20, 3) ("storeDirWriteCleanLogs: opened %s, FD %d\n",
+ debug(47, 3) ("storeDirWriteCleanLogs: opened %s, FD %d\n",
state->new, state->fd);
#if HAVE_FCHMOD
if (stat(state->cur, &sb) == 0)
if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) {
debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n",
state->new, xstrerror());
- debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile not replaced.\n");
+ debug(47, 0) ("storeDirWriteCleanLogs: Current swap logfile not replaced.\n");
file_close(state->fd);
state->fd = -1;
unlink(state->new);
if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) {
debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n",
state->new, xstrerror());
- debug(20, 0) ("storeDirWriteCleanLogs: Current swap logfile "
+ debug(50, 0) ("storeDirWriteCleanLogs: Current swap logfile "
"not replaced.\n");
file_close(state->fd);
state->fd = -1;
* This is kinda cheap, but so we need this priority hack?
*/
}
- debug(20, 3) ("storeMaintainSwapSpace: f=%f, max_scan=%d, max_remove=%d\n", f, max_scan, max_remove);
+ debug(47, 3) ("storeMaintainSwapSpace: f=%f, max_scan=%d, max_remove=%d\n", f, max_scan, max_remove);
walker = SD->repl->PurgeInit(SD->repl, max_scan);
while (1) {
if (SD->cur_size < SD->low_size)
storeRelease(e);
}
walker->Done(walker);
- debug(20, (removed ? 2 : 3)) ("storeUfsDirMaintain: %s removed %d/%d f=%.03f max_scan=%d\n",
+ debug(47, (removed ? 2 : 3)) ("storeUfsDirMaintain: %s removed %d/%d f=%.03f max_scan=%d\n",
SD->path, removed, max_remove, f, max_scan);
}
void
storeUfsDirRefObj(SwapDir * SD, StoreEntry * e)
{
- debug(1, 3) ("storeUfsDirRefObj: referencing %p %d/%d\n", e, e->swap_dirn,
+ debug(47, 3) ("storeUfsDirRefObj: referencing %p %d/%d\n", e, e->swap_dirn,
e->swap_filen);
if (SD->repl->Referenced)
SD->repl->Referenced(SD->repl, e, &e->repl);
void
storeUfsDirUnrefObj(SwapDir * SD, StoreEntry * e)
{
- debug(1, 3) ("storeUfsDirUnrefObj: referencing %p %d/%d\n", e, e->swap_dirn,
+ debug(47, 3) ("storeUfsDirUnrefObj: referencing %p %d/%d\n", e, e->swap_dirn,
e->swap_filen);
if (SD->repl->Dereferenced)
SD->repl->Dereferenced(SD->repl, e, &e->repl);
void
storeUfsDirReplAdd(SwapDir * SD, StoreEntry * e)
{
- debug(20, 4) ("storeUfsDirReplAdd: added node %p to dir %d\n", e,
+ debug(47, 4) ("storeUfsDirReplAdd: added node %p to dir %d\n", e,
SD->index);
SD->repl->Add(SD->repl, e, &e->repl);
}
storeUfsDirReplRemove(StoreEntry * e)
{
SwapDir *SD = INDEXSD(e->swap_dirn);
- debug(20, 4) ("storeUfsDirReplRemove: remove node %p from dir %d\n", e,
+ debug(47, 4) ("storeUfsDirReplRemove: remove node %p from dir %d\n", e,
SD->index);
SD->repl->Remove(SD->repl, e, &e->repl);
}
{
struct stat sb;
if (stat(storeUfsDirFullPath(sd, e->swap_filen, NULL), &sb) < 0) {
- debug(20, 0) ("storeUfsCleanupDoubleCheck: MISSING SWAP FILE\n");
- debug(20, 0) ("storeUfsCleanupDoubleCheck: FILENO %08X\n", e->swap_filen);
- debug(20, 0) ("storeUfsCleanupDoubleCheck: PATH %s\n",
+ debug(47, 0) ("storeUfsCleanupDoubleCheck: MISSING SWAP FILE\n");
+ debug(47, 0) ("storeUfsCleanupDoubleCheck: FILENO %08X\n", e->swap_filen);
+ debug(47, 0) ("storeUfsCleanupDoubleCheck: PATH %s\n",
storeUfsDirFullPath(sd, e->swap_filen, NULL));
storeEntryDump(e, 0);
return -1;
}
if (e->swap_file_sz != sb.st_size) {
- debug(20, 0) ("storeUfsCleanupDoubleCheck: SIZE MISMATCH\n");
- debug(20, 0) ("storeUfsCleanupDoubleCheck: FILENO %08X\n", e->swap_filen);
- debug(20, 0) ("storeUfsCleanupDoubleCheck: PATH %s\n",
+ debug(47, 0) ("storeUfsCleanupDoubleCheck: SIZE MISMATCH\n");
+ debug(47, 0) ("storeUfsCleanupDoubleCheck: FILENO %08X\n", e->swap_filen);
+ debug(47, 0) ("storeUfsCleanupDoubleCheck: PATH %s\n",
storeUfsDirFullPath(sd, e->swap_filen, NULL));
- debug(20, 0) ("storeUfsCleanupDoubleCheck: ENTRY SIZE: %ld, FILE SIZE: %ld\n",
+ debug(47, 0) ("storeUfsCleanupDoubleCheck: ENTRY SIZE: %ld, FILE SIZE: %ld\n",
(long int) e->swap_file_sz, (long int) sb.st_size);
storeEntryDump(e, 0);
return -1;
/*
- * $Id: unlinkd.cc,v 1.47 2002/07/20 23:51:03 hno Exp $
+ * $Id: unlinkd.cc,v 1.48 2002/07/21 00:25:44 hno Exp $
*
- * DEBUG: section 12 Unlink Daemon
+ * DEBUG: section 2 Unlink Daemon
* AUTHOR: Duane Wessels
*
* SQUID Web Proxy Cache http://www.squid-cache.org/