From: Alex Rousskov Date: Sun, 20 Jan 2013 01:58:16 +0000 (-0700) Subject: Initialize freeSlots before the map in case we decide to free something X-Git-Tag: SQUID_3_5_0_1~444^2~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d26fb333ef360c3c9aa86c6726a2b58b7d5bf7fc;p=thirdparty%2Fsquid.git Initialize freeSlots before the map in case we decide to free something during initialization (e.g., after reading something from the db file in sync mode). Removed allSlots as unused. --- diff --git a/src/fs/rock/RockSwapDir.cc b/src/fs/rock/RockSwapDir.cc index 2bc3fd3d2e..db102acba2 100644 --- a/src/fs/rock/RockSwapDir.cc +++ b/src/fs/rock/RockSwapDir.cc @@ -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. diff --git a/src/fs/rock/RockSwapDir.h b/src/fs/rock/RockSwapDir.h index 1480601be0..6866d1b536 100644 --- a/src/fs/rock/RockSwapDir.h +++ b/src/fs/rock/RockSwapDir.h @@ -117,7 +117,6 @@ private: DiskIOStrategy *io; RefCount theFile; ///< cache storage for this cache_dir - DbCellHeader *allSlots; ///< SlotId to DbCellHeader mapping Ipc::Mem::Pointer freeSlots; ///< free slots Ipc::Mem::PageId *waitingForPage; ///< one-page cache for a "hot" free slot