]> git.ipfire.org Git - thirdparty/squid.git/blame - src/store_swapin.cc
Maintenance: rework SASL detection (#1694)
[thirdparty/squid.git] / src / store_swapin.cc
CommitLineData
9cef6668 1/*
b8ae064d 2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
9cef6668 3 *
bbc27441
AJ
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.
9cef6668 7 */
8
bbc27441
AJ
9/* DEBUG: section 20 Storage Manager Swapin Functions */
10
582c2af2
FC
11#include "squid.h"
12#include "globals.h"
e4f1fdae 13#include "StatCounters.h"
e6ccf245 14#include "Store.h"
f82b5c64 15#include "store_swapin.h"
602d9612 16#include "StoreClient.h"
f09f5b26 17
4fcc8876 18static StoreIOState::STIOCB storeSwapInFileClosed;
2391a162 19
1f38f50a 20void
21storeSwapInStart(store_client * sc)
f09f5b26 22{
1f38f50a 23 StoreEntry *e = sc->entry;
62e76326 24
d46a87a8 25 if (!EBIT_TEST(e->flags, ENTRY_VALIDATED)) {
62e76326 26 /* We're still reloading and haven't validated this entry yet */
27 return;
f09f5b26 28 }
62e76326 29
e2851fe7 30 if (e->mem_status != NOT_IN_MEMORY)
bf95c10a 31 debugs(20, 3, "already IN_MEMORY");
e2851fe7 32
4310f8b0 33 debugs(20, 3, *e << " " << e->getMD5Text());
62e76326 34
4310f8b0 35 if (!e->hasDisk()) {
d816f28d 36 debugs(20, DBG_IMPORTANT, "ERROR: Squid BUG: Attempt to swap in a not-stored entry " << *e << ". Salvaged.");
62e76326 37 return;
5bd1abac 38 }
62e76326 39
02ba667b 40 if (e->swapoutFailed()) {
d816f28d 41 debugs(20, DBG_IMPORTANT, "ERROR: Squid BUG: Attempt to swap in a failed-to-store entry " << *e << ". Salvaged.");
02ba667b
EB
42 return;
43 }
44
aee3523a 45 assert(e->mem_obj != nullptr);
be42c788 46 sc->swapin_sio = storeOpen(e, storeSwapInFileClosed, sc);
f09f5b26 47}
48
2391a162 49static void
ced8def3 50storeSwapInFileClosed(void *data, int errflag, StoreIOState::Pointer)
f09f5b26 51{
e6ccf245 52 store_client *sc = (store_client *)data;
bf8fe701 53 debugs(20, 3, "storeSwapInFileClosed: sio=" << sc->swapin_sio.getRaw() << ", errflag=" << errflag);
aee3523a 54 sc->swapin_sio = nullptr;
62e76326 55
d23511c0 56 if (sc->_callback.pending()) {
62e76326 57 assert (errflag <= 0);
1fa761af 58 sc->noteSwapInDone(errflag);
9bc73deb 59 }
62e76326 60
e4f1fdae 61 ++statCounter.swap.ins;
f09f5b26 62}
cd748f27 63