]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Addressed and updated XXXs and TODOs.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 2 Jul 2013 22:52:31 +0000 (16:52 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 2 Jul 2013 22:52:31 +0000 (16:52 -0600)
src/MemObject.cc
src/MemStore.cc
src/Transients.cc
src/fs/rock/RockIoState.cc
src/fs/rock/RockRebuild.cc
src/fs/rock/RockSwapDir.cc
src/ipc/StoreMap.cc
src/ipc/StoreMap.h

index ba4c32be71ba3659a433b06dd3a8337c07dd97e9..8c8c310772b38a79ef7d39ab4235050fd56ebaa8 100644 (file)
@@ -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();
index 0380ecc5491ddf038b73c50881c55f0b5c3de994..29ba17346512ea946d1e3994c8fe21e96b7df2cf 100644 (file)
@@ -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
index 5dfaabc405c4d3eeccdffb1fc8ea9eba201fe460..06139105bc6600848995b6fc8a93a0767f22e810 100644 (file)
@@ -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
index 01ec497f86e12e50a8ac1af7a3281fb223c81c9f..9704ce97238f7e478ac6c2ce3839df66432204c0 100644 (file)
@@ -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)
 {
index 61a7dc6161a698bb3b72e003db2011c33b4dc201..10eb4c4f335f6bcec791ae3e565098ee5b8241dc 100644 (file)
@@ -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
index 7cfc82a554b7a9f9b7d3ce056e4784accf9e64ed..9753e2ac5401cc43098c49242151248f58d579bc 100644 (file)
@@ -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<Ipc::Mem::PageStack> *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))
index db26250d0f75df3729f95cb39e3102dfc9f78703..09791b27210133c69ff48ec8d97c2c5f747e0d29 100644 (file)
@@ -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
 {
index c1edb2378b1598eab4f26255a7c60024778b3116..720fc84b681b5ef71c60372914f7cf2daf91ec2e 100644 (file)
@@ -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<uint64_t> 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<StoreMapSliceId> 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