Squid Web Cache master
Loading...
Searching...
No Matches
store_swapin.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/* DEBUG: section 20 Storage Manager Swapin Functions */
10
11#include "squid.h"
12#include "globals.h"
13#include "StatCounters.h"
14#include "Store.h"
15#include "store_swapin.h"
16#include "StoreClient.h"
17
19
20void
22{
23 StoreEntry *e = sc->entry;
24
26 /* We're still reloading and haven't validated this entry yet */
27 return;
28 }
29
30 if (e->mem_status != NOT_IN_MEMORY)
31 debugs(20, 3, "already IN_MEMORY");
32
33 debugs(20, 3, *e << " " << e->getMD5Text());
34
35 if (!e->hasDisk()) {
36 debugs(20, DBG_IMPORTANT, "ERROR: Squid BUG: Attempt to swap in a not-stored entry " << *e << ". Salvaged.");
37 return;
38 }
39
40 if (e->swapoutFailed()) {
41 debugs(20, DBG_IMPORTANT, "ERROR: Squid BUG: Attempt to swap in a failed-to-store entry " << *e << ". Salvaged.");
42 return;
43 }
44
45 assert(e->mem_obj != nullptr);
47}
48
49static void
51{
52 store_client *sc = (store_client *)data;
53 debugs(20, 3, "storeSwapInFileClosed: sio=" << sc->swapin_sio.getRaw() << ", errflag=" << errflag);
54 sc->swapin_sio = nullptr;
55
56 if (sc->_callback.pending()) {
57 assert (errflag <= 0);
58 sc->noteSwapInDone(errflag);
59 }
60
62}
63
StatCounters statCounter
#define assert(EX)
Definition assert.h:17
C * getRaw() const
Definition RefCount.h:89
struct StatCounters::@113 swap
mem_status_t mem_status
Definition Store.h:239
uint16_t flags
Definition Store.h:231
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
Definition store.cc:1929
const char * getMD5Text() const
Definition store.cc:207
MemObject * mem_obj
Definition Store.h:220
bool swapoutFailed() const
whether we failed to write this entry to disk
Definition Store.h:137
void STIOCB(void *their_data, int errflag, StoreIOState::Pointer self)
void noteSwapInDone(bool error)
StoreEntry * entry
struct store_client::Callback _callback
StoreIOState::Pointer swapin_sio
#define DBG_IMPORTANT
Definition Stream.h:38
#define debugs(SECTION, LEVEL, CONTENT)
Definition Stream.h:192
#define EBIT_TEST(flag, bit)
Definition defines.h:67
@ ENTRY_VALIDATED
Definition enums.h:108
@ NOT_IN_MEMORY
Definition enums.h:30
StoreIOState::Pointer storeOpen(StoreEntry *e, StoreIOState::STIOCB *callback, void *callback_data)
Definition store_io.cc:58
void storeSwapInStart(store_client *sc)
static StoreIOState::STIOCB storeSwapInFileClosed