store_swapin.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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);
46 sc->swapin_sio = storeOpen(e, storeSwapInFileClosed, sc);
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
Definition: StatCounters.cc:12
#define assert(EX)
Definition: assert.h:17
struct StatCounters::@131 swap
mem_status_t mem_status
Definition: Store.h:240
uint16_t flags
Definition: Store.h:232
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
Definition: store.cc:1915
const char * getMD5Text() const
Definition: store.cc:206
MemObject * mem_obj
Definition: Store.h:221
bool swapoutFailed() const
whether we failed to write this entry to disk
Definition: Store.h:138
void STIOCB(void *their_data, int errflag, StoreIOState::Pointer self)
Definition: StoreIOState.h:39
#define DBG_IMPORTANT
Definition: Stream.h:38
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:194
#define EBIT_TEST(flag, bit)
Definition: defines.h:69
@ NOT_IN_MEMORY
Definition: enums.h:35
@ ENTRY_VALIDATED
Definition: enums.h:113
static int sc[16]
Definition: smbdes.c:121
StoreIOState::Pointer storeOpen(StoreEntry *e, StoreIOState::STIOCB *callback, void *callback_data)
Definition: store_io.cc:58
void storeSwapInStart(store_client *sc)
Definition: store_swapin.cc:21
static StoreIOState::STIOCB storeSwapInFileClosed
Definition: store_swapin.cc:18

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors