Data Structures | Defines | Functions | Variables

P_CacheVol.h File Reference

A brief file description. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  VolHeaderFooter
struct  EvacuationKey
struct  EvacuationBlock
struct  Vol
struct  AIO_Callback_handler
struct  CacheVol
struct  Doc

Defines

#define CACHE_BLOCK_SHIFT   9
#define CACHE_BLOCK_SIZE   (1<<CACHE_BLOCK_SHIFT)
#define ROUND_TO_STORE_BLOCK(_x)   INK_ALIGN((_x), STORE_BLOCK_SIZE)
#define ROUND_TO_CACHE_BLOCK(_x)   INK_ALIGN((_x), CACHE_BLOCK_SIZE)
#define ROUND_TO_SECTOR(_p, _x)   INK_ALIGN((_x), _p->sector_size)
#define ROUND_TO(_x, _y)   INK_ALIGN((_x), (_y))
#define VOL_MAGIC   0xF1D0F00D
#define START_BLOCKS   16
#define START_POS   ((off_t)START_BLOCKS * CACHE_BLOCK_SIZE)
#define AGG_SIZE   (4 * 1024 * 1024)
#define AGG_HIGH_WATER   (AGG_SIZE / 2)
#define EVACUATION_SIZE   (2 * AGG_SIZE)
#define MAX_VOL_SIZE   ((off_t)512 * 1024 * 1024 * 1024 * 1024)
#define STORE_BLOCKS_PER_CACHE_BLOCK   (STORE_BLOCK_SIZE / CACHE_BLOCK_SIZE)
#define MAX_VOL_BLOCKS   (MAX_VOL_SIZE / CACHE_BLOCK_SIZE)
#define MAX_FRAG_SIZE   (AGG_SIZE - sizeofDoc)
#define LEAVE_FREE   DEFAULT_MAX_BUFFER_SIZE
#define PIN_SCAN_EVERY   16
#define VOL_HASH_TABLE_SIZE   32707
#define VOL_HASH_EMPTY   0xFFFF
#define VOL_HASH_ALLOC_SIZE   (8 * 1024 * 1024)
#define LOOKASIDE_SIZE   256
#define EVACUATION_BUCKET_SIZE   (2 * EVACUATION_SIZE)
#define RECOVERY_SIZE   EVACUATION_SIZE
#define AIO_NOT_IN_PROGRESS   0
#define AIO_AGG_WRITE_IN_PROGRESS   -1
#define AUTO_SIZE_RAM_CACHE   -1
#define DEFAULT_TARGET_FRAGMENT_SIZE   (1048576 - sizeofDoc)
#define dir_offset_evac_bucket(_o)   (_o / (EVACUATION_BUCKET_SIZE / CACHE_BLOCK_SIZE))
#define dir_evac_bucket(_e)   dir_offset_evac_bucket(dir_offset(_e))
#define offset_evac_bucket(_d, _o)   dir_offset_evac_bucket((offset_to_vol_offset(_d, _o)
#define DOC_MAGIC   ((uint32_t)0x5F129B13)
#define DOC_CORRUPT   ((uint32_t)0xDEADBABE)
#define DOC_NO_CHECKSUM   ((uint32_t)0xA0B0C0D0)
#define sizeofDoc   (((uint32_t)(uintptr_t)&((Doc*)0)->checksum)+(uint32_t)sizeof(uint32_t))

Functions

TS_INLINE int vol_headerlen (Vol *d)
TS_INLINE size_t vol_dirlen (Vol *d)
TS_INLINE int vol_direntries (Vol *d)
TS_INLINE int vol_out_of_phase_valid (Vol *d, Dir *e)
TS_INLINE int vol_out_of_phase_agg_valid (Vol *d, Dir *e)
TS_INLINE int vol_out_of_phase_write_valid (Vol *d, Dir *e)
TS_INLINE int vol_in_phase_valid (Vol *d, Dir *e)
TS_INLINE off_t vol_offset (Vol *d, Dir *e)
TS_INLINE off_t offset_to_vol_offset (Vol *d, off_t pos)
TS_INLINE off_t vol_offset_to_offset (Vol *d, off_t pos)
TS_INLINE Dirvol_dir_segment (Vol *d, int s)
TS_INLINE int vol_in_phase_agg_buf_valid (Vol *d, Dir *e)
TS_INLINE off_t vol_relative_length (Vol *v, off_t start_offset)
int vol_dir_clear (Vol *d)
int vol_init (Vol *d, char *s, off_t blocks, off_t skip, bool clear)
TS_INLINE EvacuationBlockevacuation_block_exists (Dir *dir, Vol *p)
TS_INLINE EvacuationBlocknew_EvacuationBlock (EThread *t)
TS_INLINE void free_EvacuationBlock (EvacuationBlock *b, EThread *t)

Variables

Vol ** gvol
volatile int gnvol
ClassAllocator< OpenDirEntry > openDirEntryAllocator
ClassAllocator< EvacuationBlockevacuationBlockAllocator
ClassAllocator< EvacuationKeyevacuationKeyAllocator
unsigned short * vol_hash_table

Detailed Description

A brief file description.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file P_CacheVol.h.


Define Documentation

#define AGG_HIGH_WATER   (AGG_SIZE / 2)

Definition at line 40 of file P_CacheVol.h.

Referenced by Vol::aggWrite().

#define AGG_SIZE   (4 * 1024 * 1024)
#define AIO_AGG_WRITE_IN_PROGRESS   -1

Definition at line 55 of file P_CacheVol.h.

#define AIO_NOT_IN_PROGRESS   0

Definition at line 54 of file P_CacheVol.h.

#define AUTO_SIZE_RAM_CACHE   -1

Definition at line 56 of file P_CacheVol.h.

Referenced by CacheProcessor::cacheInitialized().

#define CACHE_BLOCK_SHIFT   9

Definition at line 28 of file P_CacheVol.h.

#define CACHE_BLOCK_SIZE   (1<<CACHE_BLOCK_SHIFT)
#define DEFAULT_TARGET_FRAGMENT_SIZE   (1048576 - sizeofDoc)

Definition at line 57 of file P_CacheVol.h.

#define dir_evac_bucket (   _e  )     dir_offset_evac_bucket(dir_offset(_e))
#define dir_offset_evac_bucket (   _o  )     (_o / (EVACUATION_BUCKET_SIZE / CACHE_BLOCK_SIZE))

Definition at line 60 of file P_CacheVol.h.

Referenced by Vol::evac_range(), and Vol::evacuate_cleanup().

#define DOC_CORRUPT   ((uint32_t)0xDEADBABE)
#define DOC_MAGIC   ((uint32_t)0x5F129B13)
#define DOC_NO_CHECKSUM   ((uint32_t)0xA0B0C0D0)

Definition at line 70 of file P_CacheVol.h.

Referenced by CacheVC::handleReadDone().

#define EVACUATION_BUCKET_SIZE   (2 * EVACUATION_SIZE)

Definition at line 52 of file P_CacheVol.h.

Referenced by Vol::init().

#define EVACUATION_SIZE   (2 * AGG_SIZE)
#define LEAVE_FREE   DEFAULT_MAX_BUFFER_SIZE

Definition at line 46 of file P_CacheVol.h.

#define LOOKASIDE_SIZE   256

Definition at line 51 of file P_CacheVol.h.

#define MAX_FRAG_SIZE   (AGG_SIZE - sizeofDoc)
#define MAX_VOL_BLOCKS   (MAX_VOL_SIZE / CACHE_BLOCK_SIZE)

Definition at line 44 of file P_CacheVol.h.

#define MAX_VOL_SIZE   ((off_t)512 * 1024 * 1024 * 1024 * 1024)

Definition at line 42 of file P_CacheVol.h.

Referenced by create_config(), CacheDisk::create_volume(), and Vol::init().

#define offset_evac_bucket (   _d,
  _o 
)    dir_offset_evac_bucket((offset_to_vol_offset(_d, _o)

Definition at line 63 of file P_CacheVol.h.

#define PIN_SCAN_EVERY   16

Definition at line 47 of file P_CacheVol.h.

Referenced by Vol::scan_for_pinned_documents().

#define RECOVERY_SIZE   EVACUATION_SIZE

Definition at line 53 of file P_CacheVol.h.

#define ROUND_TO (   _x,
  _y 
)    INK_ALIGN((_x), (_y))

Definition at line 33 of file P_CacheVol.h.

#define ROUND_TO_CACHE_BLOCK (   _x  )     INK_ALIGN((_x), CACHE_BLOCK_SIZE)

Definition at line 31 of file P_CacheVol.h.

#define ROUND_TO_SECTOR (   _p,
  _x 
)    INK_ALIGN((_x), _p->sector_size)

Definition at line 32 of file P_CacheVol.h.

Referenced by Vol::round_to_approx_size().

#define ROUND_TO_STORE_BLOCK (   _x  )     INK_ALIGN((_x), STORE_BLOCK_SIZE)
#define sizeofDoc   (((uint32_t)(uintptr_t)&((Doc*)0)->checksum)+(uint32_t)sizeof(uint32_t))
#define START_BLOCKS   16

Definition at line 37 of file P_CacheVol.h.

#define START_POS   ((off_t)START_BLOCKS * CACHE_BLOCK_SIZE)

Definition at line 38 of file P_CacheVol.h.

Referenced by Vol::init(), and CacheProcessor::start_internal().

#define STORE_BLOCKS_PER_CACHE_BLOCK   (STORE_BLOCK_SIZE / CACHE_BLOCK_SIZE)

Definition at line 43 of file P_CacheVol.h.

#define VOL_HASH_ALLOC_SIZE   (8 * 1024 * 1024)

Definition at line 50 of file P_CacheVol.h.

#define VOL_HASH_EMPTY   0xFFFF

Definition at line 49 of file P_CacheVol.h.

Referenced by build_vol_hash_table().

#define VOL_HASH_TABLE_SIZE   32707

Definition at line 48 of file P_CacheVol.h.

Referenced by build_vol_hash_table(), and Cache::key_to_vol().

#define VOL_MAGIC   0xF1D0F00D

Definition at line 36 of file P_CacheVol.h.

Referenced by Vol::handle_dir_read().


Function Documentation

TS_INLINE EvacuationBlock* evacuation_block_exists ( Dir dir,
Vol p 
)
TS_INLINE void free_EvacuationBlock ( EvacuationBlock b,
EThread t 
)
TS_INLINE EvacuationBlock* new_EvacuationBlock ( EThread t  ) 
TS_INLINE off_t offset_to_vol_offset ( Vol d,
off_t  pos 
)
int vol_dir_clear ( Vol d  ) 

Definition at line 1232 of file Cache.cc.

References Vol::fd, Vol::hash_text, Vol::raw_dir, Vol::skip, vol_clear_init(), vol_dirlen(), and Warning.

Referenced by Cache_dir().

TS_INLINE Dir* vol_dir_segment ( Vol d,
int  s 
)

Definition at line 761 of file P_CacheVol.h.

References Vol::buckets, Vol::dir, DIR_DEPTH, and SIZEOF_DIR.

TS_INLINE int vol_direntries ( Vol d  ) 

Definition at line 676 of file P_CacheVol.h.

References Vol::buckets, DIR_DEPTH, and Vol::segments.

Referenced by Cache_dir(), and Vol::scan_for_pinned_documents().

TS_INLINE size_t vol_dirlen ( Vol d  ) 
TS_INLINE int vol_headerlen ( Vol d  ) 

Definition at line 663 of file P_CacheVol.h.

References ROUND_TO_STORE_BLOCK, and Vol::segments.

Referenced by Vol::init(), and vol_dirlen().

TS_INLINE int vol_in_phase_agg_buf_valid ( Vol d,
Dir e 
)

Definition at line 767 of file P_CacheVol.h.

References Vol::agg_buf_pos, Vol::header, vol_offset(), and VolHeaderFooter::write_pos.

TS_INLINE int vol_in_phase_valid ( Vol d,
Dir e 
)
int vol_init ( Vol d,
char *  s,
off_t  blocks,
off_t  skip,
bool  clear 
)
TS_INLINE off_t vol_offset ( Vol d,
Dir e 
)
TS_INLINE off_t vol_offset_to_offset ( Vol d,
off_t  pos 
)

Definition at line 755 of file P_CacheVol.h.

References CACHE_BLOCK_SIZE, and Vol::start.

Referenced by make_vol_map(), next_in_map(), and CacheVC::scanObject().

TS_INLINE int vol_out_of_phase_agg_valid ( Vol d,
Dir e 
)
TS_INLINE int vol_out_of_phase_valid ( Vol d,
Dir e 
)
TS_INLINE int vol_out_of_phase_write_valid ( Vol d,
Dir e 
)
TS_INLINE off_t vol_relative_length ( Vol v,
off_t  start_offset 
)

Definition at line 774 of file P_CacheVol.h.

References Vol::len, and Vol::skip.

Referenced by make_vol_map(), and next_in_map().


Variable Documentation

Referenced by evacuate_fragments().

volatile int gnvol
Vol** gvol

Definition at line 112 of file Cache.cc.

Referenced by Cache_dir(), CacheSync::mainEvent(), and sync_cache_dir_on_shutdown().

unsigned short* vol_hash_table