]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Made some of the Rock collapsing behavior dependent on collapsed_forwarding.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 29 May 2013 16:24:49 +0000 (10:24 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 29 May 2013 16:24:49 +0000 (10:24 -0600)
Do not write empty rock I/O buffer to disk.

Added more comments and polished.

src/fs/rock/RockIoState.cc
src/fs/rock/RockIoState.h
src/fs/rock/RockSwapDir.cc
src/ipc/Messages.h

index f8e461eb832ecc85f8f90f96e01d5ccddb176986..c7ed4722c5b74aa1d3225d04655654e8993b4f6e 100644 (file)
@@ -175,11 +175,14 @@ 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?
+            writeBufToDisk(false);
         }
     }
 
-    // XXX: check that there are workers waiting for data, i.e. readers > 0
-    writeBufToDisk();
 }
 
 /// Buffers incoming data for the current slot.
@@ -242,6 +245,7 @@ Rock::IoState::writeToDisk(const SlotId sidNext)
     sidCurrent = sidNext;
 }
 
+/// Write header-less (XXX) or complete buffer to disk.
 void
 Rock::IoState::writeBufToDisk(const bool last)
 {
index ee6f6a3dfc3a944732815c2ca15d59167339aa11..f22a736e0aeec8de58825aeec898615bc3c7c38a 100644 (file)
@@ -50,7 +50,7 @@ private:
     void tryWrite(char const *buf, size_t size, off_t offset);
     size_t writeToBuffer(char const *buf, size_t size);
     void writeToDisk(const SlotId nextSlot);
-    void writeBufToDisk(const bool last = false);
+    void writeBufToDisk(const bool last);
     SlotId reserveSlotForWriting();
     
     void callBack(int errflag);
index 5b08b23839281ee330165eef36da75ce27c6f7e8..a732232fd718c11680aedbd1475a405d0104f687 100644 (file)
@@ -748,8 +748,10 @@ Rock::SwapDir::writeCompleted(int errflag, size_t rlen, RefCount< ::WriteRequest
         return;
     }
 
-    // XXX: check that there are workers waiting for data, i.e. readers > 0
-    CollapsedForwarding::NewData(sio);
+    // XXX: can we check that this is needed w/o stalling readers
+    // that appear right after our check?
+    if (Config.onoff.collapsed_forwarding)
+        CollapsedForwarding::NewData(sio);
 
     if (errflag == DISK_OK) {
         // do not increment sio.offset_ because we do it in sio->write()
index 14837ff81be86126ebad24e64fa030e043a855bc..e7e8d07f9b2f6ee8419cd65e3638b5a9fe3e0fc3 100644 (file)
@@ -15,7 +15,8 @@ namespace Ipc
 typedef enum { mtNone = 0, mtRegistration,
                mtStrandSearchRequest, mtStrandSearchResponse,
                mtSharedListenRequest, mtSharedListenResponse,
-               mtIpcIoNotification, mtCollapsedForwardingNotification,
+               mtIpcIoNotification,
+               mtCollapsedForwardingNotification,
                mtCacheMgrRequest, mtCacheMgrResponse
 #if SQUID_SNMP
                ,