]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Initialize freeSlots before the map in case we decide to free something
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 20 Jan 2013 01:58:16 +0000 (18:58 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sun, 20 Jan 2013 01:58:16 +0000 (18:58 -0700)
during initialization (e.g., after reading something from the db file
in sync mode).

Removed allSlots as unused.

src/fs/rock/RockSwapDir.cc
src/fs/rock/RockSwapDir.h

index 2bc3fd3d2e3ee41f861502e417fdfb8b1d6b5654..db102acba273baaa06e9605ce1e4e17ba2c0ea4c 100644 (file)
@@ -31,7 +31,7 @@
 const int64_t Rock::SwapDir::HeaderSize = 16*1024;
 
 Rock::SwapDir::SwapDir(): ::SwapDir("rock"), 
-    slotSize(HeaderSize), filePath(NULL), map(NULL), io(NULL), allSlots(NULL),
+    slotSize(HeaderSize), filePath(NULL), map(NULL), io(NULL),
     waitingForPage(NULL)
 {
 }
@@ -216,6 +216,8 @@ Rock::SwapDir::init()
     // are refcounted. We up our count once to avoid implicit delete's.
     lock();
 
+    freeSlots = shm_old(Ipc::Mem::PageStack)(freeSlotsPath());
+
     Must(!map);
     map = new DirMap(inodeMapPath());
     map->cleaner = this;
@@ -235,8 +237,6 @@ Rock::SwapDir::init()
     theFile->configure(fileConfig);
     theFile->open(O_RDWR, 0644, this);
 
-    freeSlots = shm_old(Ipc::Mem::PageStack)(freeSlotsPath());
-
     // Increment early. Otherwise, if one SwapDir finishes rebuild before
     // others start, storeRebuildComplete() will think the rebuild is over!
     // TODO: move store_dirs_rebuilding hack to store modules that need it.
index 1480601be0683e562c344173a5455736baf570cc..6866d1b536d246c3c8c8b99a1067dfd74c517e41 100644 (file)
@@ -117,7 +117,6 @@ private:
 
     DiskIOStrategy *io;
     RefCount<DiskFile> theFile; ///< cache storage for this cache_dir
-    DbCellHeader *allSlots; ///< SlotId to DbCellHeader mapping
     Ipc::Mem::Pointer<Ipc::Mem::PageStack> freeSlots; ///< free slots
        Ipc::Mem::PageId *waitingForPage; ///< one-page cache for a "hot" free slot