return Ipc::Mem::PageSize();
}
-void
-MemStore::updateSize(int64_t eSize, int sign)
-{
- // XXX: irrelevant, but Store parent forces us to implement this
- fatal("MemStore::updateSize should not be called");
-}
-
void
MemStore::reference(StoreEntry &)
{
virtual void reference(StoreEntry &);
virtual void dereference(StoreEntry &);
virtual void maintain();
- virtual void updateSize(int64_t size, int sign);
static int64_t EntryLimit();
/// called when the entry is no longer needed by any transaction
virtual void handleIdleEntry(StoreEntry &e) {}
- /* These should really be private */
- virtual void updateSize(int64_t size, int sign) = 0;
-
private:
static RefCount<Store> CurrentRoot;
};
virtual void maintain();
- virtual void updateSize(int64_t, int);
-
virtual StoreSearch *search(String const url, HttpRequest *);
private:
virtual void dereference(StoreEntry &); /* Unreference this object */
- virtual void updateSize(int64_t size, int sign);
-
/* the number of store dirs being rebuilt. */
static int store_dirs_rebuilding;
/// called when the entry is about to forget its association with cache_dir
virtual void disconnect(StoreEntry &) {}
+ /// called when entry swap out is complete
+ virtual void swappedOut(const StoreEntry &e) = 0;
+
protected:
void parseOptions(int reconfiguring);
void dumpOptions(StoreEntry * e) const;
virtual void logEntry(const StoreEntry & e, int op) const;
virtual void parse (int index, char *path);
virtual void reconfigure (int, char *);
+ virtual void swappedOut(const StoreEntry &e);
/* internals */
virtual off_t storeCossFilenoToDiskOffset(sfileno);
virtual sfileno storeCossDiskOffsetToFileno(off_t);
EBIT_CLR(e->flags, KEY_PRIVATE);
e->ping_status = PING_NONE;
EBIT_CLR(e->flags, ENTRY_VALIDATED);
+ SD->updateSize(e->swap_file_sz, 1);
e->hashInsert(key); /* do it after we clear KEY_PRIVATE */
storeCossAdd(SD, e);
assert(e->swap_filen >= 0);
fatal("COSS requires max-size to be set to something other than -1!\n");
}
+void
+CossSwapDir::swappedOut(const StoreEntry &e)
+{
+ updateSize(e.swap_file_sz, 1);
+}
+
void
CossSwapDir::dump(StoreEntry &entry)const
{
CossSwapDir::unlink(StoreEntry & e)
{
debugs(79, 3, "storeCossUnlink: offset " << e.swap_filen);
+ if (e.swap_status == SWAPOUT_DONE && EBIT_TEST(e.flags, ENTRY_VALIDATED))
+ updateSize(e.swap_file_sz, -1);
StoreFScoss::GetInstance().stats.unlink.ops++;
StoreFScoss::GetInstance().stats.unlink.success++;
storeCossRemove(this, &e);
return ::SwapDir::doReportStat() && (!UsingSmp() || IamDiskProcess());
}
+void
+Rock::SwapDir::swappedOut(const StoreEntry &)
+{
+ // stats are not stored but computed when needed
+}
+
int64_t
Rock::SwapDir::entryLimitAllowed() const
{
return map && map->full();
}
-void
-Rock::SwapDir::updateSize(int64_t size, int sign)
-{
- // stats are not stored but computed when needed
-}
-
// storeSwapOutFileClosed calls this nethod on DISK_NO_SPACE_LEFT,
// but it should not happen for us
void
virtual uint64_t currentSize() const;
virtual uint64_t currentCount() const;
virtual bool doReportStat() const;
+ virtual void swappedOut(const StoreEntry &e);
int64_t entryLimitHigh() const { return 0xFFFFFF; } /// Core sfileno maximum
int64_t entryLimitAllowed() const;
virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
virtual void maintain();
- virtual void updateSize(int64_t size, int sign);
virtual void diskFull();
virtual void reference(StoreEntry &e);
virtual void dereference(StoreEntry &e);
e->ping_status = PING_NONE;
EBIT_CLR(e->flags, ENTRY_VALIDATED);
mapBitSet(e->swap_filen);
+ updateSize(e->swap_file_sz, 1);
e->hashInsert(key); /* do it after we clear KEY_PRIVATE */
replacementAdd (e);
return e;
{
debugs(79, 3, "storeUfsUnlink: dirno " << index << ", fileno "<<
std::setfill('0') << std::hex << std::uppercase << std::setw(8) << e.swap_filen);
+ if (e.swap_status == SWAPOUT_DONE && EBIT_TEST(e.flags, ENTRY_VALIDATED))
+ updateSize(e.swap_file_sz, -1);
replacementRemove(&e);
mapBitReset(e.swap_filen);
UFSSwapDir::unlinkFile(e.swap_filen);
IO->sync();
}
+void
+UFSSwapDir::swappedOut(const StoreEntry &e)
+{
+ updateSize(e.swap_file_sz, 1);
+}
+
StoreSearch *
UFSSwapDir::search(String const url, HttpRequest *request)
{
virtual void reconfigure(int, char *);
virtual int callback();
virtual void sync();
+ virtual void swappedOut(const StoreEntry &e);
void unlinkFile(sfileno f);
// move down when unlink is a virtual method
storeLog(STORE_LOG_RELEASE, this);
if (swap_filen > -1) {
-
- // update size before unlink() below clears swap_status
- // TODO: the store/SwapDir::unlink should update the size!
- if (swap_status == SWAPOUT_DONE)
- if (EBIT_TEST(flags, ENTRY_VALIDATED))
- store()->updateSize(swap_file_sz, -1);
-
// log before unlink() below clears swap_filen
if (!EBIT_TEST(flags, KEY_PRIVATE))
storeDirSwapLog(this, SWAP_LOG_DEL);
dynamic_cast<SwapDir *>(INDEXSD(e->swap_dirn))->logEntry(*e, op);
}
-void
-StoreController::updateSize(int64_t size, int sign)
-{
- fatal("StoreController has no independent size\n");
-}
-
void
SwapDir::updateSize(int64_t size, int sign)
{
}
}
-void
-StoreHashIndex::updateSize(int64_t, int)
-{}
-
void
StoreHashIndex::sync()
{
* otherwise, set it in the validation procedure
*/
-
- if (e->swap_status == SWAPOUT_DONE)
- e->store()->updateSize(e->swap_file_sz, 1);
-
if ((++validated & 0x3FFFF) == 0)
/* TODO format the int with with a stream operator */
debugs(20, 1, " " << validated << " Entries Validated so far.");
assert(e->objectLen() >= 0); // we checked that above
e->swap_file_sz = e->objectLen() + mem->swap_hdr_sz;
e->swap_status = SWAPOUT_DONE;
- e->store()->updateSize(e->swap_file_sz, 1);
+ e->store()->swappedOut(*e);
// XXX: For some Stores, it is pointless to re-check cachability here
// and it leads to double counts in store_check_cachable_hist. We need
virtual void dereference(StoreEntry &) {} /* Unreference this object */
- virtual void updateSize(int64_t size, int sign) {}
-
virtual StoreSearch *search(String const url, HttpRequest *);
};