--------------------- PatchSet 2981 Date: 2001/09/09 09:25:38 Author: serassio Branch: nt-2_3-tolsty Tag: (none) Log: Fixed indent problems Members: src/store.c:1.1.1.3.4.5.2.4.2.1->1.1.1.3.4.5.2.4.2.2 src/store_client.c:1.1.1.3.4.2.2.1.2.1->1.1.1.3.4.2.2.1.2.2 src/store_digest.c:1.1.1.3.4.1.2.1.2.1->1.1.1.3.4.1.2.1.2.2 src/store_dir.c:1.1.1.3.4.2.2.7.2.1->1.1.1.3.4.2.2.7.2.2 src/store_io.c:1.1.1.1.20.1.2.1->1.1.1.1.20.1.2.2 src/store_io_ufs.c:1.1.1.1.4.1.2.1.2.1->1.1.1.1.4.1.2.1.2.2 Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.1.1.3.4.5.2.4.2.1 retrieving revision 1.1.1.3.4.5.2.4.2.2 diff -u -r1.1.1.3.4.5.2.4.2.1 -r1.1.1.3.4.5.2.4.2.2 --- squid/src/store.c 27 Aug 2001 21:48:21 -0000 1.1.1.3.4.5.2.4.2.1 +++ squid/src/store.c 9 Sep 2001 09:25:38 -0000 1.1.1.3.4.5.2.4.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: store.c,v 1.1.1.3.4.5.2.4.2.1 2001/08/27 21:48:21 tolsty Exp $ + * $Id: store.c,v 1.1.1.3.4.5.2.4.2.2 2001/09/09 09:25:38 serassio Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -38,35 +39,37 @@ #define STORE_IN_MEM_BUCKETS (229) -const char *memStatusStr[] = { +const char *memStatusStr[] = +{ "NOT_IN_MEMORY", "IN_MEMORY" }; -const char *pingStatusStr[] = { +const char *pingStatusStr[] = +{ "PING_NONE", "PING_WAITING", "PING_DONE" }; -const char *storeStatusStr[] = { +const char *storeStatusStr[] = +{ "STORE_OK", "STORE_PENDING" }; -const char *swapStatusStr[] = { +const char *swapStatusStr[] = +{ "SWAPOUT_NONE", "SWAPOUT_WRITING", "SWAPOUT_DONE" }; -typedef struct lock_ctrl_t -{ +typedef struct lock_ctrl_t { SIH *callback; void *callback_data; StoreEntry *e; -} -lock_ctrl_t; +} lock_ctrl_t; /* * local function prototypes @@ -380,8 +383,7 @@ assert(!EBIT_TEST(e->flags, RELEASE_REQUEST)); newkey = storeKeyPublic(mem->url, mem->method); if ((e2 = (StoreEntry *) hash_lookup(store_table, newkey))) { - debug(20, 3) ("storeSetPublicKey: Making old '%s' private.\n", - mem->url); + debug(20, 3) ("storeSetPublicKey: Making old '%s' private.\n", mem->url); storeSetPrivateKey(e2); storeRelease(e2); newkey = storeKeyPublic(mem->url, mem->method); @@ -395,8 +397,7 @@ } StoreEntry * -storeCreateEntry(const char *url, const char *log_url, request_flags flags, - method_t method) +storeCreateEntry(const char *url, const char *log_url, request_flags flags, method_t method) { StoreEntry *e = NULL; MemObject *mem = NULL; @@ -447,7 +448,8 @@ assert(e->store_status == STORE_PENDING); if (len) { debug(20, 5) ("storeAppend: appending %d bytes for '%s'\n", - len, storeKeyText(e->key)); + len, + storeKeyText(e->key)); storeGetMemSpace(len); stmemAppend(&mem->data_hdr, buf, len); mem->inmem_hi += len; @@ -460,7 +462,7 @@ void #if STDC_HEADERS -storeAppendPrintf(StoreEntry * e, const char *fmt, ...) +storeAppendPrintf(StoreEntry * e, const char *fmt,...) #else storeAppendPrintf(va_alist) va_dcl @@ -491,10 +493,8 @@ storeAppend(e, buf, strlen(buf)); } -struct _store_check_cachable_hist -{ - struct - { +struct _store_check_cachable_hist { + struct { int non_get; int not_entry_cachable; int release_request; @@ -506,15 +506,11 @@ int too_many_open_files; int too_many_open_fds; int lru_age_too_low; - } - no; - struct - { + } no; + struct { int Default; - } - yes; -} -store_check_cachable_hist; + } yes; +} store_check_cachable_hist; int storeTooManyDiskFilesOpen(void) @@ -556,8 +552,7 @@ } else if (EBIT_TEST(e->flags, RELEASE_REQUEST)) { debug(20, 2) ("storeCheckCachable: NO: release requested\n"); store_check_cachable_hist.no.release_request++; - } else if (e->store_status == STORE_OK - && EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) { + } else if (e->store_status == STORE_OK && EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) { debug(20, 2) ("storeCheckCachable: NO: wrong content-length\n"); store_check_cachable_hist.no.wrong_content_length++; } else if (EBIT_TEST(e->flags, ENTRY_NEGCACHED)) { @@ -567,8 +562,7 @@ } else if (e->mem_obj->inmem_hi > Config.Store.maxObjectSize) { debug(20, 2) ("storeCheckCachable: NO: too big\n"); store_check_cachable_hist.no.too_big++; - } else if (e->mem_obj->reply->content_length > - (int) Config.Store.maxObjectSize) { + } else if (e->mem_obj->reply->content_length > (int) Config.Store.maxObjectSize) { debug(20, 2) ("storeCheckCachable: NO: too big\n"); store_check_cachable_hist.no.too_big++; } else if (storeCheckTooSmall(e)) { @@ -703,7 +697,10 @@ /* Notify the server side */ if (mem->abort.callback) { eventAdd("mem->abort.callback", - mem->abort.callback, mem->abort.data, 0.0, 0); + mem->abort.callback, + mem->abort.data, + 0.0, + 0); mem->abort.callback = NULL; mem->abort.data = NULL; } @@ -757,8 +754,7 @@ continue; } released++; - debug(20, - 3) ("Released memory object with key %f size %d refs %d url %s\n", + debug(20, 3) ("Released memory object with key %f size %d refs %d url %s\n", age, e->swap_file_sz, e->refcount, e->mem_obj->url); min_age = age; storePurgeMem(e); @@ -841,9 +837,7 @@ eventAdd("MaintainSwapSpace", storeMaintainSwapSpace, NULL, 1.0, 1); return; } else { - f = - (double) (store_swap_size - store_swap_low) / (store_swap_high - - store_swap_low); + f = (double) (store_swap_size - store_swap_low) / (store_swap_high - store_swap_low); f = f < 0.0 ? 0.0 : f > 1.0 ? 1.0 : f; max_scan = (int) (f * 400.0 + 100.0); max_remove = (int) (f * 70.0 + 10.0); @@ -873,9 +867,7 @@ * It will always be "SPECIAL" and therefore never removed. */ debug(20, 4) ("storeMaintainSwapSpace: locked url %s\n", - (e->mem_obj - && e->mem_obj->url) ? e->mem_obj->url : storeKeyText(e-> - key)); + (e->mem_obj && e->mem_obj->url) ? e->mem_obj->url : storeKeyText(e->key)); linklistPush(&locked_entries, e); } locked++; @@ -887,8 +879,7 @@ * checks... */ expired++; - debug(20, - 3) ("Released store object age %f size %d refs %d key %s\n", + debug(20, 3) ("Released store object age %f size %d refs %d key %s\n", age, e->swap_file_sz, e->refcount, storeKeyText(e->key)); min_age = age; storeRelease(e); @@ -947,10 +938,7 @@ break; } #endif - debug(20, (expired ? 2 : 3)) - - - ("storeMaintainSwapSpace: scanned %d/%d removed %d/%d locked %d f=%.03f\n", + debug(20, (expired ? 2 : 3)) ("storeMaintainSwapSpace: scanned %d/%d removed %d/%d locked %d f=%.03f\n", scanned, max_scan, expired, max_remove, locked, f); debug(20, 3) ("storeMaintainSwapSpace stats:\n"); debug(20, 3) (" %6d objects\n", memInUse(MEM_STOREENTRY)); @@ -1001,8 +989,7 @@ storeDirMapBitReset(e->swap_file_number); if (e->swap_status == SWAPOUT_DONE) if (EBIT_TEST(e->flags, ENTRY_VALIDATED)) - storeDirUpdateSwapSize(e->swap_file_number, e->swap_file_sz, - -1); + storeDirUpdateSwapSize(e->swap_file_number, e->swap_file_sz, -1); if (!EBIT_TEST(e->flags, KEY_PRIVATE)) storeDirSwapLog(e, SWAP_LOG_DEL); } @@ -1059,9 +1046,9 @@ const HttpReply *reply; assert(e->mem_obj != NULL); reply = e->mem_obj->reply; - debug(20, 3) ("storeEntryValidLength: Checking '%s'\n", - storeKeyText(e->key)); - debug(20, 5) ("storeEntryValidLength: object_len = %d\n", objectLen(e)); + debug(20, 3) ("storeEntryValidLength: Checking '%s'\n", storeKeyText(e->key)); + debug(20, 5) ("storeEntryValidLength: object_len = %d\n", + objectLen(e)); debug(20, 5) ("storeEntryValidLength: hdr_sz = %d\n", reply->hdr_sz); debug(20, 5) ("storeEntryValidLength: content_length = %d\n", @@ -1090,7 +1077,8 @@ return 1; debug(20, 3) ("storeEntryValidLength: %d bytes too %s; '%s'\n", diff < 0 ? -diff : diff, - diff < 0 ? "big" : "small", storeKeyText(e->key)); + diff < 0 ? "big" : "small", + storeKeyText(e->key)); return 0; } @@ -1162,9 +1150,12 @@ eventAdd("storeLateRelease", storeLateRelease, NULL, 1.0, 1); storeDirInit(); storeRebuildStart(); - cachemgrRegister("storedir", "Store Directory Stats", storeDirStats, 0, 1); + cachemgrRegister("storedir", + "Store Directory Stats", + storeDirStats, 0, 1); cachemgrRegister("store_check_cachable_stats", - "storeCheckCachable() Stats", storeCheckCachableStats, 0, 1); + "storeCheckCachable() Stats", + storeCheckCachableStats, 0, 1); } void @@ -1222,14 +1213,13 @@ * near the high water mark. The LRU age value can be examined on the * cachemgr 'info' page. */ -time_t storeExpiredReferenceAge(void) +time_t +storeExpiredReferenceAge(void) { double x; double z; time_t age; - x = - (double) (store_swap_high - store_swap_size) / (store_swap_high - - store_swap_low); + x = (double) (store_swap_high - store_swap_size) / (store_swap_high - store_swap_low); x = x < 0.0 ? 0.0 : x > 1.0 ? 1.0 : x; z = pow((double) (Config.referenceAge / 60), x); age = (time_t) (z * 60.0); @@ -1306,8 +1296,8 @@ * squid_curtime because it results in a negative served_date. */ if (age > squid_curtime - served_date) - if (squid_curtime > age) - served_date = squid_curtime - age; + if (squid_curtime > age) + served_date = squid_curtime - age; entry->expires = reply->expires; entry->lastmod = reply->last_modified; entry->timestamp = served_date; @@ -1334,20 +1324,30 @@ void storeMemObjectDump(MemObject * mem) { - debug(20, 1) ("MemObject->data.head: %p\n", mem->data_hdr.head); - debug(20, 1) ("MemObject->data.tail: %p\n", mem->data_hdr.tail); + debug(20, 1) ("MemObject->data.head: %p\n", + mem->data_hdr.head); + debug(20, 1) ("MemObject->data.tail: %p\n", + mem->data_hdr.tail); debug(20, 1) ("MemObject->data.origin_offset: %d\n", mem->data_hdr.origin_offset); debug(20, 1) ("MemObject->start_ping: %d.%06d\n", - (int) mem->start_ping.tv_sec, (int) mem->start_ping.tv_usec); - debug(20, 1) ("MemObject->inmem_hi: %d\n", (int) mem->inmem_hi); - debug(20, 1) ("MemObject->inmem_lo: %d\n", (int) mem->inmem_lo); - debug(20, 1) ("MemObject->clients: %p\n", mem->clients); - debug(20, 1) ("MemObject->nclients: %d\n", mem->nclients); - debug(20, 1) ("MemObject->reply: %p\n", mem->reply); - debug(20, 1) ("MemObject->request: %p\n", mem->request); + (int) mem->start_ping.tv_sec, + (int) mem->start_ping.tv_usec); + debug(20, 1) ("MemObject->inmem_hi: %d\n", + (int) mem->inmem_hi); + debug(20, 1) ("MemObject->inmem_lo: %d\n", + (int) mem->inmem_lo); + debug(20, 1) ("MemObject->clients: %p\n", + mem->clients); + debug(20, 1) ("MemObject->nclients: %d\n", + mem->nclients); + debug(20, 1) ("MemObject->reply: %p\n", + mem->reply); + debug(20, 1) ("MemObject->request: %p\n", + mem->request); debug(20, 1) ("MemObject->log_url: %p %s\n", - mem->log_url, checkNullString(mem->log_url)); + mem->log_url, + checkNullString(mem->log_url)); } void @@ -1363,8 +1363,7 @@ debug(20, l) ("StoreEntry->swap_file_sz: %d\n", (int) e->swap_file_sz); debug(20, l) ("StoreEntry->refcount: %d\n", e->refcount); debug(20, l) ("StoreEntry->flags: %s\n", storeEntryFlags(e)); - debug(20, l) ("StoreEntry->swap_file_number: %d\n", - (int) e->swap_file_number); + debug(20, l) ("StoreEntry->swap_file_number: %d\n", (int) e->swap_file_number); debug(20, l) ("StoreEntry->lock_count: %d\n", (int) e->lock_count); debug(20, l) ("StoreEntry->mem_status: %d\n", (int) e->mem_status); debug(20, l) ("StoreEntry->ping_status: %d\n", (int) e->ping_status); Index: squid/src/store_client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_client.c,v retrieving revision 1.1.1.3.4.2.2.1.2.1 retrieving revision 1.1.1.3.4.2.2.1.2.2 diff -u -r1.1.1.3.4.2.2.1.2.1 -r1.1.1.3.4.2.2.1.2.2 --- squid/src/store_client.c 27 Aug 2001 21:48:22 -0000 1.1.1.3.4.2.2.1.2.1 +++ squid/src/store_client.c 9 Sep 2001 09:25:38 -0000 1.1.1.3.4.2.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: store_client.c,v 1.1.1.3.4.2.2.1.2.1 2001/08/27 21:48:22 tolsty Exp $ + * $Id: store_client.c,v 1.1.1.3.4.2.2.1.2.2 2001/09/09 09:25:38 serassio Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -159,14 +160,21 @@ void storeClientCopy(StoreEntry * e, off_t seen_offset, - off_t copy_offset, size_t size, char *buf, STCB * callback, void *data) + off_t copy_offset, + size_t size, + char *buf, + STCB * callback, + void *data) { store_client *sc; assert(!EBIT_TEST(e->flags, ENTRY_ABORTED)); - debug(20, 3) - ("storeClientCopy: %s, seen %d, want %d, size %d, cb %p, cbdata %p\n", - storeKeyText(e->key), (int) seen_offset, (int) copy_offset, (int) size, - callback, data); + debug(20, 3) ("storeClientCopy: %s, seen %d, want %d, size %d, cb %p, cbdata %p\n", + storeKeyText(e->key), + (int) seen_offset, + (int) copy_offset, + (int) size, + callback, + data); sc = storeClientListSearch(e->mem_obj, data); assert(sc != NULL); assert(sc->callback == NULL); @@ -210,8 +218,7 @@ if (sc->flags.copy_event_pending) return; if (EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT)) { - debug(20, - 5) ("storeClientCopy2: returning because ENTRY_FWD_HDR_WAIT set\n"); + debug(20, 5) ("storeClientCopy2: returning because ENTRY_FWD_HDR_WAIT set\n"); return; } if (sc->flags.store_copying) { @@ -236,17 +243,13 @@ sc->flags.disk_io_pending = 0; sc->callback = NULL; callback(sc->callback_data, sc->copy_buf, 0); - } else if (e->store_status == STORE_PENDING - && sc->seen_offset >= mem->inmem_hi) { + } else if (e->store_status == STORE_PENDING && sc->seen_offset >= mem->inmem_hi) { /* client has already seen this, wait for more */ debug(20, 3) ("storeClientCopy2: Waiting for more\n"); - } else if (sc->copy_offset >= mem->inmem_lo - && sc->copy_offset < mem->inmem_hi) { + } else if (sc->copy_offset >= mem->inmem_lo && sc->copy_offset < mem->inmem_hi) { /* What the client wants is in memory */ debug(20, 3) ("storeClientCopy2: Copying from memory\n"); - sz = - stmemCopy(&mem->data_hdr, sc->copy_offset, sc->copy_buf, - sc->copy_size); + sz = stmemCopy(&mem->data_hdr, sc->copy_offset, sc->copy_buf, sc->copy_size); sc->flags.disk_io_pending = 0; sc->callback = NULL; callback(sc->callback_data, sc->copy_buf, sz); @@ -292,13 +295,20 @@ assert(sc->callback != NULL); if (mem->swap_hdr_sz == 0) { storeRead(sc->swapin_sio, - sc->copy_buf, sc->copy_size, 0, storeClientReadHeader, sc); + sc->copy_buf, + sc->copy_size, + 0, + storeClientReadHeader, + sc); } else { if (sc->entry->swap_status == SWAPOUT_WRITING) - assert(storeOffset(mem->swapout.sio) > - sc->copy_offset + mem->swap_hdr_sz); - storeRead(sc->swapin_sio, sc->copy_buf, sc->copy_size, - sc->copy_offset + mem->swap_hdr_sz, storeClientReadBody, sc); + assert(storeOffset(mem->swapout.sio) > sc->copy_offset + mem->swap_hdr_sz); + storeRead(sc->swapin_sio, + sc->copy_buf, + sc->copy_size, + sc->copy_offset + mem->swap_hdr_sz, + storeClientReadBody, + sc); } } @@ -482,7 +492,8 @@ return 1; } -off_t storeLowestMemReaderOffset(const StoreEntry * entry) +off_t +storeLowestMemReaderOffset(const StoreEntry * entry) { const MemObject *mem = entry->mem_obj; off_t lowest = mem->inmem_hi; Index: squid/src/store_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_digest.c,v retrieving revision 1.1.1.3.4.1.2.1.2.1 retrieving revision 1.1.1.3.4.1.2.1.2.2 diff -u -r1.1.1.3.4.1.2.1.2.1 -r1.1.1.3.4.1.2.1.2.2 --- squid/src/store_digest.c 27 Aug 2001 21:48:22 -0000 1.1.1.3.4.1.2.1.2.1 +++ squid/src/store_digest.c 9 Sep 2001 09:25:38 -0000 1.1.1.3.4.1.2.1.2.2 @@ -1,5 +1,5 @@ /* - * $Id: store_digest.c,v 1.1.1.3.4.1.2.1.2.1 2001/08/27 21:48:22 tolsty Exp $ + * $Id: store_digest.c,v 1.1.1.3.4.1.2.1.2.2 2001/09/09 09:25:38 serassio Exp $ * * DEBUG: section 71 Store Digest Manager * AUTHOR: Alex Rousskov @@ -47,8 +47,7 @@ * local types */ -typedef struct -{ +typedef struct { StoreDigestCBlock cblock; int rebuild_lock; /* bucket number */ StoreEntry *rewrite_lock; /* store entry with the digest */ @@ -56,19 +55,16 @@ int rewrite_offset; int rebuild_count; int rewrite_count; -} -StoreDigestState; +} StoreDigestState; -typedef struct -{ +typedef struct { int del_count; /* #store entries deleted from store_digest */ int del_lost_count; /* #store entries not found in store_digest on delete */ int add_count; /* #store entries accepted to store_digest */ int add_coll_count; /* #accepted entries that collided with existing ones */ int rej_count; /* #store entries not accepted to store_digest */ int rej_coll_count; /* #not accepted entries that collided with existing ones */ -} -StoreDigestStats; +} StoreDigestStats; /* local vars */ static StoreDigestState sd_state; @@ -106,11 +102,11 @@ return; } store_digest = cacheDigestCreate(cap, Config.digest.bits_per_entry); - debug(71, - 1) ("Local cache digest enabled; rebuild/rewrite every %d/%d sec\n", + debug(71, 1) ("Local cache digest enabled; rebuild/rewrite every %d/%d sec\n", Config.digest.rebuild_period, Config.digest.rewrite_period); memset(&sd_state, 0, sizeof(sd_state)); - cachemgrRegister("store_digest", "Store Digest", storeDigestReport, 0, 1); + cachemgrRegister("store_digest", "Store Digest", + storeDigestReport, 0, 1); #else store_digest = NULL; debug(71, 3) ("Local cache digest is 'off'\n"); @@ -163,10 +159,11 @@ } if (store_digest) { cacheDigestReport(store_digest, "store", e); - storeAppendPrintf(e, - "\t added: %d rejected: %d ( %.2f %%) del-ed: %d\n", - sd_stats.add_count, sd_stats.rej_count, xpercent(sd_stats.rej_count, - sd_stats.rej_count + sd_stats.add_count), sd_stats.del_count); + storeAppendPrintf(e, "\t added: %d rejected: %d ( %.2f %%) del-ed: %d\n", + sd_stats.add_count, + sd_stats.rej_count, + xpercent(sd_stats.rej_count, sd_stats.rej_count + sd_stats.add_count), + sd_stats.del_count); storeAppendPrintf(e, "\t collisions: on add: %.2f %% on rej: %.2f %%\n", xpercent(sd_stats.add_coll_count, sd_stats.add_count), xpercent(sd_stats.rej_coll_count, sd_stats.rej_count)); @@ -220,8 +217,7 @@ /* still here? check staleness */ /* Note: We should use the time of the next rebuild, not (cur_time+period) */ if (refreshCheckDigest(e, Config.digest.rebuild_period)) { - debug(71, - 6) ("storeDigestAdd: entry expires within %d secs, ignoring\n", + debug(71, 6) ("storeDigestAdd: entry expires within %d secs, ignoring\n", Config.digest.rebuild_period); return 0; } @@ -257,18 +253,13 @@ assert(store_digest); /* prevent overlapping if rebuild schedule is too tight */ if (sd_state.rebuild_lock) { - debug(71, 1) - - - ("storeDigestRebuildStart: overlap detected, consider increasing rebuild period\n"); + debug(71, 1) ("storeDigestRebuildStart: overlap detected, consider increasing rebuild period\n"); return; } sd_state.rebuild_lock = 1; - debug(71, 2) ("storeDigestRebuildStart: rebuild #%d\n", - sd_state.rebuild_count + 1); + debug(71, 2) ("storeDigestRebuildStart: rebuild #%d\n", sd_state.rebuild_count + 1); if (sd_state.rewrite_lock) { - debug(71, - 2) ("storeDigestRebuildStart: waiting for Rewrite to finish.\n"); + debug(71, 2) ("storeDigestRebuildStart: waiting for Rewrite to finish.\n"); return; } storeDigestRebuildResume(); @@ -283,7 +274,7 @@ sd_state.rebuild_offset = 0; /* resize or clear */ if (!storeDigestResize()) - cacheDigestClear(store_digest); /* not clean()! */ + cacheDigestClear(store_digest); /* not clean()! */ memset(&sd_stats, 0, sizeof(sd_stats)); eventAdd("storeDigestRebuildStep", storeDigestRebuildStep, NULL, 0.0, 1); } @@ -312,12 +303,10 @@ assert(sd_state.rebuild_lock); if (sd_state.rebuild_offset + bcount > store_hash_buckets) bcount = store_hash_buckets - sd_state.rebuild_offset; - debug(71, 3) - ("storeDigestRebuildStep: buckets: %d offset: %d chunk: %d buckets\n", + debug(71, 3) ("storeDigestRebuildStep: buckets: %d offset: %d chunk: %d buckets\n", store_hash_buckets, sd_state.rebuild_offset, bcount); while (bcount--) { - hash_link *link_ptr = - hash_get_bucket(store_table, sd_state.rebuild_offset); + hash_link *link_ptr = hash_get_bucket(store_table, sd_state.rebuild_offset); for (; link_ptr; link_ptr = link_ptr->next) { storeDigestAdd((StoreEntry *) link_ptr); } @@ -327,8 +316,7 @@ if (sd_state.rebuild_offset >= store_hash_buckets) storeDigestRebuildFinish(); else - eventAdd("storeDigestRebuildStep", storeDigestRebuildStep, NULL, 0.0, - 1); + eventAdd("storeDigestRebuildStep", storeDigestRebuildStep, NULL, 0.0, 1); } @@ -343,14 +331,10 @@ assert(store_digest); /* prevent overlapping if rewrite schedule is too tight */ if (sd_state.rewrite_lock) { - debug(71, 1) - - - ("storeDigestRewrite: overlap detected, consider increasing rewrite period\n"); + debug(71, 1) ("storeDigestRewrite: overlap detected, consider increasing rewrite period\n"); return; } - debug(71, 2) ("storeDigestRewrite: start rewrite #%d\n", - sd_state.rewrite_count + 1); + debug(71, 2) ("storeDigestRewrite: start rewrite #%d\n", sd_state.rewrite_count + 1); /* make new store entry */ url = internalLocalUri("/squid-internal-periodic/", StoreDigestFileName); flags = null_request_flags; @@ -358,13 +342,11 @@ sd_state.rewrite_lock = e = storeCreateEntry(url, url, flags, METHOD_GET); assert(sd_state.rewrite_lock); cbdataAdd(sd_state.rewrite_lock, NULL, 0); - debug(71, 3) ("storeDigestRewrite: url: %s key: %s\n", url, - storeKeyText(e->key)); + debug(71, 3) ("storeDigestRewrite: url: %s key: %s\n", url, storeKeyText(e->key)); e->mem_obj->request = requestLink(urlParse(METHOD_GET, url)); /* wait for rebuild (if any) to finish */ if (sd_state.rebuild_lock) { - debug(71, - 2) ("storeDigestRewriteStart: waiting for rebuild to finish.\n"); + debug(71, 2) ("storeDigestRewriteStart: waiting for rebuild to finish.\n"); return; } storeDigestRewriteResume(); @@ -384,17 +366,15 @@ /* fake reply */ httpReplyReset(e->mem_obj->reply); httpReplySetHeaders(e->mem_obj->reply, 1.0, 200, "Cache Digest OK", - "application/cache-digest", - store_digest->mask_size + sizeof(sd_state.cblock), squid_curtime, - squid_curtime + Config.digest.rewrite_period); + "application/cache-digest", store_digest->mask_size + sizeof(sd_state.cblock), + squid_curtime, squid_curtime + Config.digest.rewrite_period); debug(71, 3) ("storeDigestRewrite: entry expires on %d (%+d)\n", e->mem_obj->reply->expires, e->mem_obj->reply->expires - squid_curtime); storeBuffer(e); httpReplySwapOut(e->mem_obj->reply, e); storeDigestCBlockSwapOut(e); storeBufferFlush(e); - eventAdd("storeDigestSwapOutStep", storeDigestSwapOutStep, - sd_state.rewrite_lock, 0.0, 1); + eventAdd("storeDigestSwapOutStep", storeDigestSwapOutStep, sd_state.rewrite_lock, 0.0, 1); } /* finishes swap out sequence for the digest; schedules next rewrite */ @@ -436,8 +416,7 @@ if (sd_state.rewrite_offset + chunk_size > store_digest->mask_size) chunk_size = store_digest->mask_size - sd_state.rewrite_offset; storeAppend(e, store_digest->mask + sd_state.rewrite_offset, chunk_size); - debug(71, - 3) ("storeDigestSwapOutStep: size: %d offset: %d chunk: %d bytes\n", + debug(71, 3) ("storeDigestSwapOutStep: size: %d offset: %d chunk: %d bytes\n", store_digest->mask_size, sd_state.rewrite_offset, chunk_size); sd_state.rewrite_offset += chunk_size; /* are we done ? */ @@ -476,8 +455,7 @@ const int lo_cap = 1 + store_swap_size / Config.Store.avgObjectSize; const int e_count = memInUse(MEM_STOREENTRY); int cap = e_count ? e_count : hi_cap; - debug(71, - 2) ("storeDigestCalcCap: have: %d, want %d entries; limits: [%d, %d]\n", + debug(71, 2) ("storeDigestCalcCap: have: %d, want %d entries; limits: [%d, %d]\n", e_count, cap, lo_cap, hi_cap); if (cap < lo_cap) cap = lo_cap; Index: squid/src/store_dir.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_dir.c,v retrieving revision 1.1.1.3.4.2.2.7.2.1 retrieving revision 1.1.1.3.4.2.2.7.2.2 diff -u -r1.1.1.3.4.2.2.7.2.1 -r1.1.1.3.4.2.2.7.2.2 --- squid/src/store_dir.c 27 Aug 2001 21:48:22 -0000 1.1.1.3.4.2.2.7.2.1 +++ squid/src/store_dir.c 9 Sep 2001 09:25:38 -0000 1.1.1.3.4.2.2.7.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: store_dir.c,v 1.1.1.3.4.2.2.7.2.1 2001/08/27 21:48:22 tolsty Exp $ + * $Id: store_dir.c,v 1.1.1.3.4.2.2.7.2.2 2001/09/09 09:25:38 serassio Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -44,7 +45,8 @@ #include #endif -const char *SwapDirType[] = { +const char *SwapDirType[] = +{ "ufs", "!ERROR!" }; @@ -87,7 +89,7 @@ #endif } while (pid > 0 || (pid < 0 && errno == EINTR)); #else - } + } #endif } @@ -280,7 +282,9 @@ return; assert(op > SWAP_LOG_NOP && op < SWAP_LOG_MAX); debug(20, 3) ("storeDirSwapLog: %s %s %08X\n", - swap_log_op_str[op], storeKeyText(e->key), e->swap_file_number); + swap_log_op_str[op], + storeKeyText(e->key), + e->swap_file_number); sd = &Config.cacheSwap.swapDirs[dirn]; sd->log.write(sd, e, op); } @@ -312,8 +316,7 @@ store_swap_size); storeAppendPrintf(sentry, "Current Capacity : %d%% used, %d%% free\n", percent((int) store_swap_size, (int) Config.Swap.maxSize), - percent((int) (Config.Swap.maxSize - store_swap_size), - (int) Config.Swap.maxSize)); + percent((int) (Config.Swap.maxSize - store_swap_size), (int) Config.Swap.maxSize)); storeUfsDirStats(sentry); /* XXX */ } @@ -362,8 +365,8 @@ for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) { sd = &Config.cacheSwap.swapDirs[dirn]; if (sd->log.open) - sd->log.open(sd); - } + sd->log.open(sd); + } } void @@ -499,8 +502,7 @@ (((fsbs) != 0 && (fsbs) < (bs)) ? \ (num) / ((bs) / (fsbs)) : (num) * ((fsbs) / (bs))) int -storeDirGetUFSStats(const char *path, int *totl_kb, int *free_kb, int *totl_in, - int *free_in) +storeDirGetUFSStats(const char *path, int *totl_kb, int *free_kb, int *totl_in, int *free_in) { #if HAVE_STATVFS struct statvfs sfs; Index: squid/src/store_io.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_io.c,v retrieving revision 1.1.1.1.20.1.2.1 retrieving revision 1.1.1.1.20.1.2.2 diff -u -r1.1.1.1.20.1.2.1 -r1.1.1.1.20.1.2.2 --- squid/src/store_io.c 27 Aug 2001 21:48:22 -0000 1.1.1.1.20.1.2.1 +++ squid/src/store_io.c 9 Sep 2001 09:25:38 -0000 1.1.1.1.20.1.2.2 @@ -1,5 +1,4 @@ #define STORE_IO_C - #include "squid.h" storeIOState * @@ -13,8 +12,7 @@ void storeClose(storeIOState * sio) { - SwapDir *SD = - &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT]; + SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT]; if (sio->flags.closing) return; sio->flags.closing = 1; @@ -22,20 +20,16 @@ } void -storeRead(storeIOState * sio, char *buf, size_t size, off_t offset, - STRCB * callback, void *callback_data) +storeRead(storeIOState * sio, char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data) { - SwapDir *SD = - &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT]; + SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT]; SD->obj.read(sio, buf, size, offset, callback, callback_data); } void -storeWrite(storeIOState * sio, char *buf, size_t size, off_t offset, - FREE * free_func) +storeWrite(storeIOState * sio, char *buf, size_t size, off_t offset, FREE * free_func) { - SwapDir *SD = - &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT]; + SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT]; SD->obj.write(sio, buf, size, offset, free_func); } @@ -46,7 +40,8 @@ SD->obj.unlink(f); } -off_t storeOffset(storeIOState * sio) +off_t +storeOffset(storeIOState * sio) { return sio->offset; } Index: squid/src/store_io_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/store_io_ufs.c,v retrieving revision 1.1.1.1.4.1.2.1.2.1 retrieving revision 1.1.1.1.4.1.2.1.2.2 diff -u -r1.1.1.1.4.1.2.1.2.1 -r1.1.1.1.4.1.2.1.2.2 --- squid/src/store_io_ufs.c 27 Aug 2001 21:48:22 -0000 1.1.1.1.4.1.2.1.2.1 +++ squid/src/store_io_ufs.c 9 Sep 2001 09:25:38 -0000 1.1.1.1.4.1.2.1.2.2 @@ -1,5 +1,6 @@ + /* - * $Id: store_io_ufs.c,v 1.1.1.1.4.1.2.1.2.1 2001/08/27 21:48:22 tolsty Exp $ + * $Id: store_io_ufs.c,v 1.1.1.1.4.1.2.1.2.2 2001/09/09 09:25:38 serassio Exp $ * * DEBUG: section 79 Storage Manager UFS Interface * AUTHOR: Duane Wessels @@ -88,8 +89,7 @@ } void -storeUfsRead(storeIOState * sio, char *buf, size_t size, off_t offset, - STRCB * callback, void *callback_data) +storeUfsRead(storeIOState * sio, char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data) { assert(sio->read.callback == NULL); assert(sio->read.callback_data == NULL); @@ -100,18 +100,26 @@ sio->swap_file_number, sio->type.ufs.fd); sio->offset = offset; sio->type.ufs.flags.reading = 1; - file_read(sio->type.ufs.fd, buf, size, offset, storeUfsReadDone, sio); + file_read(sio->type.ufs.fd, + buf, + size, + offset, + storeUfsReadDone, + sio); } void -storeUfsWrite(storeIOState * sio, char *buf, size_t size, off_t offset, - FREE * free_func) +storeUfsWrite(storeIOState * sio, char *buf, size_t size, off_t offset, FREE * free_func) { - debug(79, 3) ("storeUfsWrite: fileno %08X, FD %d\n", sio->swap_file_number, - sio->type.ufs.fd); + debug(79, 3) ("storeUfsWrite: fileno %08X, FD %d\n", sio->swap_file_number, sio->type.ufs.fd); sio->type.ufs.flags.writing = 1; file_write(sio->type.ufs.fd, - offset, buf, size, storeUfsWriteDone, sio, free_func); + offset, + buf, + size, + storeUfsWriteDone, + sio, + free_func); } void