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
18
static
StoreIOState::STIOCB
storeSwapInFileClosed
;
19
20
void
21
storeSwapInStart
(
store_client
* sc)
22
{
23
StoreEntry
*e = sc->
entry
;
24
25
if
(!
EBIT_TEST
(e->
flags
,
ENTRY_VALIDATED
)) {
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
);
46
sc->
swapin_sio
=
storeOpen
(e,
storeSwapInFileClosed
, sc);
47
}
48
49
static
void
50
storeSwapInFileClosed
(
void
*data,
int
errflag,
StoreIOState::Pointer
)
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
61
++
statCounter
.
swap
.
ins
;
62
}
63
statCounter
StatCounters statCounter
Definition
StatCounters.cc:12
StatCounters.h
StoreClient.h
Store.h
assert
#define assert(EX)
Definition
assert.h:17
RefCount< StoreIOState >
RefCount::getRaw
C * getRaw() const
Definition
RefCount.h:89
StatCounters::swap
struct StatCounters::@113 swap
StatCounters::ins
int ins
Definition
StatCounters.h:159
StoreEntry
Definition
Store.h:38
StoreEntry::mem_status
mem_status_t mem_status
Definition
Store.h:239
StoreEntry::flags
uint16_t flags
Definition
Store.h:231
StoreEntry::hasDisk
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
Definition
store.cc:1929
StoreEntry::getMD5Text
const char * getMD5Text() const
Definition
store.cc:207
StoreEntry::mem_obj
MemObject * mem_obj
Definition
Store.h:220
StoreEntry::swapoutFailed
bool swapoutFailed() const
whether we failed to write this entry to disk
Definition
Store.h:137
StoreIOState::STIOCB
void STIOCB(void *their_data, int errflag, StoreIOState::Pointer self)
Definition
StoreIOState.h:39
store_client
Definition
StoreClient.h:74
store_client::noteSwapInDone
void noteSwapInDone(bool error)
Definition
store_client.cc:464
store_client::entry
StoreEntry * entry
Definition
StoreClient.h:113
store_client::_callback
struct store_client::Callback _callback
store_client::swapin_sio
StoreIOState::Pointer swapin_sio
Definition
StoreClient.h:114
DBG_IMPORTANT
#define DBG_IMPORTANT
Definition
Stream.h:38
debugs
#define debugs(SECTION, LEVEL, CONTENT)
Definition
Stream.h:192
EBIT_TEST
#define EBIT_TEST(flag, bit)
Definition
defines.h:67
ENTRY_VALIDATED
@ ENTRY_VALIDATED
Definition
enums.h:108
NOT_IN_MEMORY
@ NOT_IN_MEMORY
Definition
enums.h:30
globals.h
squid.h
storeOpen
StoreIOState::Pointer storeOpen(StoreEntry *e, StoreIOState::STIOCB *callback, void *callback_data)
Definition
store_io.cc:58
storeSwapInStart
void storeSwapInStart(store_client *sc)
Definition
store_swapin.cc:21
storeSwapInFileClosed
static StoreIOState::STIOCB storeSwapInFileClosed
Definition
store_swapin.cc:18
store_swapin.h
store_client::Callback::pending
bool pending() const
Definition
store_client.cc:1078
squid
src
store_swapin.cc
Generated by
1.9.8