From: Alex Rousskov Date: Tue, 2 Jul 2013 22:52:31 +0000 (-0600) Subject: Addressed and updated XXXs and TODOs. X-Git-Tag: SQUID_3_5_0_1~444^2~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6d2c26325d7e5bee46b7ca6be4f7da35debd55e;p=thirdparty%2Fsquid.git Addressed and updated XXXs and TODOs. --- diff --git a/src/MemObject.cc b/src/MemObject.cc index ba4c32be71..8c8c310772 100644 --- a/src/MemObject.cc +++ b/src/MemObject.cc @@ -128,7 +128,7 @@ MemObject::MemObject(): smpCollapsed(false) MemObject::~MemObject() { debugs(20, 3, HERE << "del MemObject " << this); - const Ctx ctx = ctx_enter(storeId_.termedBuf()); /* XXX: need URI? */ + const Ctx ctx = ctx_enter(urlXXX()); #if URL_CHECKSUM_DEBUG checkUrlChecksum(); diff --git a/src/MemStore.cc b/src/MemStore.cc index 0380ecc549..29ba173465 100644 --- a/src/MemStore.cc +++ b/src/MemStore.cc @@ -251,14 +251,13 @@ MemStore::updateCollapsed(StoreEntry &collapsed) return updateCollapsedWith(collapsed, index, anchor); } +/// updates collapsed entry after its anchor has been located bool MemStore::updateCollapsedWith(StoreEntry &collapsed, const sfileno index, const Ipc::StoreMapAnchor &anchor) { - collapsed.swap_file_sz = anchor.basics.swap_file_sz; // XXX: make atomic - + collapsed.swap_file_sz = anchor.basics.swap_file_sz; const bool copied = copyFromShm(collapsed, index, anchor); - - return copied; // XXX: when do we unlock the map slot? + return copied; } /// anchors StoreEntry to an already locked map entry diff --git a/src/Transients.cc b/src/Transients.cc index 5dfaabc405..06139105bc 100644 --- a/src/Transients.cc +++ b/src/Transients.cc @@ -4,7 +4,7 @@ */ #include "squid.h" -#include "CollapsedForwarding.h" /* XXX: who should broadcast and when? */ +#include "CollapsedForwarding.h" #include "base/RunnersRegistry.h" #include "HttpReply.h" #include "ipc/mem/Page.h" @@ -379,7 +379,7 @@ Transients::EntryLimit() if (!UsingSmp() || !Config.onoff.collapsed_forwarding) return 0; // no SMP collapsed forwarding possible or needed - return 16*1024; // XXX: make configurable + return 16*1024; // TODO: make configurable? } /// initializes shared memory segment used by Transients diff --git a/src/fs/rock/RockIoState.cc b/src/fs/rock/RockIoState.cc index 01ec497f86..9704ce9723 100644 --- a/src/fs/rock/RockIoState.cc +++ b/src/fs/rock/RockIoState.cc @@ -14,6 +14,7 @@ #include "MemObject.h" #include "Mem.h" #include "Parsing.h" +#include "Transients.h" Rock::IoState::IoState(Rock::SwapDir::Pointer &aDir, StoreEntry *anEntry, @@ -101,7 +102,7 @@ Rock::IoState::read_(char *buf, size_t len, off_t coreOff, STRCB *cb, void *data while (coreOff >= objOffset + currentReadableSlice().size) { objOffset += currentReadableSlice().size; sidCurrent = currentReadableSlice().next; - assert(sidCurrent >= 0); // XXX: handle "read offset too big" error + assert(sidCurrent >= 0); // TODO: handle "read offset too big" error } offset_ = coreOff; @@ -175,10 +176,8 @@ Rock::IoState::tryWrite(char const *buf, size_t size, off_t coreOff) const SlotId sidNext = reserveSlotForWriting(); // throws assert(sidNext >= 0); writeToDisk(sidNext); - } else if (Config.onoff.collapsed_forwarding) { - // write partial buffer for all collapsed hit readers to see - // XXX: can we check that this is needed w/o stalling readers - // that appear right after our check? + } else if (Store::Root().transientReaders(*e)) { + // write partial buffer for all remote hit readers to see writeBufToDisk(-1); } } @@ -239,7 +238,7 @@ Rock::IoState::writeToDisk(const SlotId sidNext) sidCurrent = sidNext; } -/// Write header-less (XXX) or complete buffer to disk. +/// Write header-less (ugh) or complete buffer to disk. void Rock::IoState::writeBufToDisk(const SlotId sidNext) { diff --git a/src/fs/rock/RockRebuild.cc b/src/fs/rock/RockRebuild.cc index 61a7dc6161..10eb4c4f33 100644 --- a/src/fs/rock/RockRebuild.cc +++ b/src/fs/rock/RockRebuild.cc @@ -275,7 +275,7 @@ Rock::Rebuild::importEntry(Ipc::StoreMapAnchor &anchor, const sfileno fileno, co return false; const uint64_t knownSize = header.entrySize > 0 ? - header.entrySize : anchor.basics.swap_file_sz; + header.entrySize : anchor.basics.swap_file_sz.get(); if (!loadedE.swap_file_sz && knownSize) loadedE.swap_file_sz = knownSize; // the entry size may still be unknown at this time diff --git a/src/fs/rock/RockSwapDir.cc b/src/fs/rock/RockSwapDir.cc index 7cfc82a554..9753e2ac54 100644 --- a/src/fs/rock/RockSwapDir.cc +++ b/src/fs/rock/RockSwapDir.cc @@ -114,7 +114,7 @@ Rock::SwapDir::updateCollapsed(StoreEntry &collapsed) bool Rock::SwapDir::updateCollapsedWith(StoreEntry &collapsed, const Ipc::StoreMapAnchor &anchor) { - collapsed.swap_file_sz = anchor.basics.swap_file_sz; // XXX: make atomic + collapsed.swap_file_sz = anchor.basics.swap_file_sz; return true; } @@ -995,14 +995,14 @@ void Rock::SwapDirRr::create(const RunnerRegistry &) SwapDir::DirMap::Init(sd->inodeMapPath(), capacity); mapOwners.push_back(mapOwner); - // XXX: remove pool id and counters from PageStack + // TODO: somehow remove pool id and counters from PageStack? Ipc::Mem::Owner *const freeSlotsOwner = shm_new(Ipc::Mem::PageStack)(sd->freeSlotsPath(), i+1, capacity, sizeof(DbCellHeader)); freeSlotsOwners.push_back(freeSlotsOwner); - // XXX: add method to initialize PageStack with no free pages + // TODO: add method to initialize PageStack with no free pages while (true) { Ipc::Mem::PageId pageId; if (!freeSlotsOwner->object()->pop(pageId)) diff --git a/src/ipc/StoreMap.cc b/src/ipc/StoreMap.cc index db26250d0f..09791b2721 100644 --- a/src/ipc/StoreMap.cc +++ b/src/ipc/StoreMap.cc @@ -392,12 +392,6 @@ Ipc::StoreMap::entryCount() const return shared->count; } -bool -Ipc::StoreMap::full() const -{ - return entryCount() >= entryLimit(); -} - void Ipc::StoreMap::updateStats(ReadWriteLockStats &stats) const { diff --git a/src/ipc/StoreMap.h b/src/ipc/StoreMap.h index c1edb2378b..720fc84b68 100644 --- a/src/ipc/StoreMap.h +++ b/src/ipc/StoreMap.h @@ -64,13 +64,13 @@ public: time_t lastref; time_t expires; time_t lastmod; - uint64_t swap_file_sz; // [app]; XXX: make atomic + Atomic::WordT swap_file_sz; // [app] uint16_t refcount; uint16_t flags; } basics; - /// where the chain of StoreEntry slices begins [app]; XXX: make atomic - StoreMapSliceId start; + /// where the chain of StoreEntry slices begins [app] + Atomic::WordT start; #if 0 /// possible persistent states @@ -186,7 +186,6 @@ public: /// copies slice to its designated position void importSlice(const SliceId sliceId, const Slice &slice); - bool full() const; ///< there are no empty slices left; XXX: remove as unused? bool valid(const int n) const; ///< whether n is a valid slice coordinate int entryCount() const; ///< number of writeable and readable entries int entryLimit() const; ///< maximum entryCount() possible