]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Some fixes for swapping out objects that are in STORE_OK state. Need
authorwessels <>
Wed, 26 May 1999 11:01:05 +0000 (11:01 +0000)
committerwessels <>
Wed, 26 May 1999 11:01:05 +0000 (11:01 +0000)
to make sure that we really write all the data and queue the
swapout file for closing.

DO NOT allow swapout of non-special objects during store rebuilding
phase.  This greatly speeds up the rebuild process and prevents
large memory consumption from objects that want to be deleted but
must wait until validation completes.

src/store_swapout.cc

index ed90a1d2c7d3794d193d7a4c73dc7722006daf6b..1b5a8e525c087c793634510dd2684edc180427bd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapout.cc,v 1.52 1999/05/26 03:08:12 wessels Exp $
+ * $Id: store_swapout.cc,v 1.53 1999/05/26 05:01:05 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Swapout Functions
  * AUTHOR: Duane Wessels
@@ -178,10 +178,19 @@ storeSwapOut(StoreEntry * e)
        if (e->swap_status != SWAPOUT_WRITING)
            break;
        swapout_size = (size_t) (mem->inmem_hi - mem->swapout.queue_offset);
-    } while (swapout_size >= DISK_PAGE_SIZE);
-    if (e->store_status == STORE_OK)
-       if (mem->inmem_hi == mem->swapout.queue_offset)
-           storeSwapOutFileClose(e);
+       if (e->store_status == STORE_PENDING)
+           if (swapout_size < DISK_PAGE_SIZE)
+               break;
+    } while (swapout_size > 0);
+    if (e->store_status == STORE_OK) {
+       /*
+        * If the state is STORE_OK, then all data must have been given
+        * to the filesystem at this point because storeSwapOut() is
+        * not going to be called again for this entry.
+        */
+       assert(mem->inmem_hi == mem->swapout.queue_offset);
+       storeSwapOutFileClose(e);
+    }
 }
 
 void
@@ -282,5 +291,8 @@ storeSwapOutAble(const StoreEntry * e)
     for (sc = e->mem_obj->clients; sc; sc = sc->next)
        if (sc->type == STORE_DISK_CLIENT)
            return 1;
+    if (store_dirs_rebuilding)
+       if (!EBIT_TEST(e->flags, ENTRY_SPECIAL))
+           return 0;
     return EBIT_TEST(e->flags, ENTRY_CACHABLE);
 }