Disks.cc File Reference
#include "squid.h"
#include "Debug.h"
#include "globals.h"
#include "profiler/Profiler.h"
#include "SquidConfig.h"
#include "Store.h"
#include "store/Disk.h"
#include "store/Disks.h"
#include "swap_log_op.h"
#include "util.h"
Include dependency graph for Disks.cc:

Go to the source code of this file.

Functions

static int64_t objectSizeForDirSelection (const StoreEntry &entry)
 
static int storeDirSelectSwapDirRoundRobin (const StoreEntry *e)
 
static int storeDirSelectSwapDirLeastLoad (const StoreEntry *e)
 
void storeDirOpenSwapLogs ()
 
void storeDirCloseSwapLogs ()
 
int storeDirWriteCleanLogs (int reopen)
 
void allocate_new_swapdir (Store::DiskConfig *swap)
 
void free_cachedir (Store::DiskConfig *swap)
 
void storeDirSwapLog (const StoreEntry *e, int op)
 

Variables

static STDIRSELECT storeDirSelectSwapDirRoundRobin
 
static STDIRSELECT storeDirSelectSwapDirLeastLoad
 
STDIRSELECTstoreDirSelectSwapDir = storeDirSelectSwapDirLeastLoad
 

Function Documentation

◆ allocate_new_swapdir()

void allocate_new_swapdir ( Store::DiskConfig swap)

◆ free_cachedir()

◆ objectSizeForDirSelection()

static int64_t objectSizeForDirSelection ( const StoreEntry entry)
static

The entry size to use for Disk::canStore() size limit checks. This is an optimization to avoid similar calculations in every cache_dir.

Definition at line 33 of file Disks.cc.

References assert, MemObject::endOffset(), MemObject::expectedReplySize(), StoreEntry::mem_obj, and MemObject::swap_hdr_sz.

Referenced by storeDirSelectSwapDirLeastLoad(), and storeDirSelectSwapDirRoundRobin().

◆ storeDirCloseSwapLogs()

void storeDirCloseSwapLogs ( void  )

Definition at line 577 of file Disks.cc.

References SquidConfig::cacheSwap, Config, INDEXSD, and Store::DiskConfig::n_configured.

Referenced by mainReconfigureStart().

◆ storeDirOpenSwapLogs()

void storeDirOpenSwapLogs ( void  )

◆ storeDirSelectSwapDirLeastLoad()

static int storeDirSelectSwapDirLeastLoad ( const StoreEntry e)
static

Spread load across all of the store directories

Note: We should modify this later on to prefer sticking objects in the tightest fit swapdir to conserve space, along with the actual swapdir usage. But for now, this hack will do while testing, so you should order your swapdirs in the config file from smallest max-size= to largest max-size=.

We also have to choose nleast == nconf since we need to consider ALL swapdirs, regardless of state. Again, this is a hack while we sort out the real usefulness of this algorithm.

Definition at line 96 of file Disks.cc.

References SquidConfig::cacheSwap, Store::Disk::canStore(), Config, Store::Storage::currentSize(), Store::Disk::flags, i, INDEXSD, INT_MAX, Store::Disk::maxObjectSize(), Store::Disk::maxSize(), Store::DiskConfig::n_configured, objectSizeForDirSelection(), and Store::Disk::Flags::selected.

◆ storeDirSelectSwapDirRoundRobin()

static int storeDirSelectSwapDirRoundRobin ( const StoreEntry e)
static

This new selection scheme simply does round-robin on all SwapDirs. A SwapDir is skipped if it is over the max_size (100%) limit, or overloaded.

Definition at line 54 of file Disks.cc.

References SquidConfig::cacheSwap, Config, i, INDEXSD, Store::DiskConfig::n_configured, and objectSizeForDirSelection().

◆ storeDirSwapLog()

void storeDirSwapLog ( const StoreEntry e,
int  op 
)

An entry written to the swap log MUST have the following properties.

  1. It MUST be a public key. It does no good to log a public ADD, change the key, then log a private DEL. So we need to log a DEL before we change a key from public to private.
  2. It MUST have a valid (> -1) swap_filen.

Definition at line 733 of file Disks.cc.

Referenced by Fs::Ufs::RebuildState::addIfFresh(), Store::Disks::evictCached(), StoreEntry::forcePublicKey(), and storeSwapOutFileClosed().

◆ storeDirWriteCleanLogs()

int storeDirWriteCleanLogs ( int  reopen)

storeDirWriteCleanLogs

Writes a "clean" swap log file from in-memory metadata. This is a rewrite of the original function to troll each StoreDir and write the logs, and flush at the end of the run. Thanks goes to Eric Stern, since this solution came out of his COSS code.

Definition at line 593 of file Disks.cc.

References SquidConfig::cacheSwap, Store::Disk::canLog(), Store::Disk::cleanLog, Config, current_time, DBG_IMPORTANT, debugs, getCurrentTime(), Store::Disk::index, INDEXSD, Store::DiskConfig::n_configured, Store::Disk::CleanLog::nextEntry(), NULL, Store::Controller::store_dirs_rebuilding, storeDirOpenSwapLogs(), tvSubDsec(), Store::Disk::CleanLog::write(), and Store::Disk::writeCleanStart().

Referenced by death(), fatal(), fatal_dump(), mainRotate(), SquidShutdown(), and testUfs::testUfsSearch().

Variable Documentation

◆ storeDirSelectSwapDir

STDIRSELECT* storeDirSelectSwapDir = storeDirSelectSwapDirLeastLoad

This function pointer is set according to 'store_dir_select_algorithm' in squid.conf.

Definition at line 28 of file Disks.cc.

Referenced by Store::Disks::init(), and storeCreate().

◆ storeDirSelectSwapDirLeastLoad

STDIRSELECT storeDirSelectSwapDirLeastLoad
static

Definition at line 23 of file Disks.cc.

Referenced by Store::Disks::init().

◆ storeDirSelectSwapDirRoundRobin

STDIRSELECT storeDirSelectSwapDirRoundRobin
static

Definition at line 22 of file Disks.cc.

Referenced by Store::Disks::init().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors