Coda Distributed File System
Classes | Macros | Enumerations | Functions | Variables
fso.h File Reference
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <rpc2/rpc2.h>
#include <codadir.h>
#include <user.h>
#include <vice.h>
#include <bstree.h>
#include <rec_bstree.h>
#include <dlist.h>
#include <rec_dlist.h>
#include <ohash.h>
#include <rec_ohash.h>
#include <olist.h>
#include <rec_olist.h>
#include <lka.h>
#include "binding.h"
#include "comm.h"
#include "hdb.h"
#include "mariner.h"
#include "realmdb.h"
#include "venusrecov.h"
#include "vproc.h"
#include "fso_cachefile.h"
#include "venus.private.h"
Include dependency graph for fso.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  fsdb
 
struct  VenusStat
 
struct  MiniVenusStat
 
struct  AcRights
 
struct  FsoFlags
 
struct  VenusDirData
 
union  VenusData
 
class  fsobj
 
class  fso_iterator
 

Macros

#define FSDB   (rvg->recov_FSDB)
 
#define SERVER_SERVER   1
 
#define LOCAL_GLOBAL   2
 
#define MIXED_CONFLICT   3
 
#define FILE_CONFLICT   1
 
#define DIRECTORY_CONFLICT   2
 
#define LOCALCACHE   "_localcache" /* implies we have a locally cached copy */
 
#define LOCALCACHE_HIDDEN   ".localcache" /* implies we don't */
 
#define CLU_CASE_MASK   0x03
 
#define CLU_TRAVERSE_MTPT   0x04
 
#define PATH_VOLUME   0
 
#define PATH_FULL   1
 
#define PATH_REALM   2
 
#define PATH_COMPONENT   3
 
#define FSO_HOLD(f)
 
#define FSO_RELE(f)
 
#define UNREACHABLE(f)   ((f)->vol->IsUnreachable())
 
#define REACHABLE(f)   ((f)->vol->IsReachable())
 
#define RESOLVING(f)   ((f)->vol->IsResolving())
 
#define DIRTY(f)   ((f)->flags.dirty)
 
#define HAVESTATUS(f)   ((f)->state != FsoRunt)
 
#define STATUSVALID(f)   ((f)->IsValid(RC_STATUS))
 
#define HAVEDATA(f)   ((f)->data.havedata != 0)
 
#define PARTIALDATA(f)   ((f)->IsFile() && !(f)->cf.IsComplete())
 
#define HAVEALLDATA(f)   (HAVEDATA(f) && !PARTIALDATA(f))
 
#define DATAVALID(f)   ((f)->IsValid(RC_DATA))
 
#define EXECUTABLE(f)    (HAVESTATUS(f) && (f)->IsFile() && ((f)->stat.Mode & 0111))
 
#define DYING(f)   ((f)->state == FsoDying)
 
#define READING(f)   (((f)->openers - (f)->Writers) > 0)
 
#define WRITING(f)   ((f)->Writers > 0)
 
#define EXECUTING(f)   (EXECUTABLE(f) && READING(f) && !k_Purge(&(f)->fid))
 
#define ACTIVE(f)   (WRITING(f) || READING(f))
 
#define BUSY(f)   ((f)->refcnt > 0 || EXECUTING(f))
 
#define HOARDABLE(f)   ((f)->HoardPri > 0)
 
#define ISVASTRO(f)   ((f)->flags.vastro)
 
#define FETCHABLE(f)
 
#define REPLACEABLE(f)   ((f)->prio_handle.tree() != 0)
 
#define GCABLE(f)   (DYING(f) && !DIRTY(f) && !BUSY(f))
 
#define FLUSHABLE(f)   ((DYING(f) || REPLACEABLE(f)) && !DIRTY(f) && !BUSY(f))
 
#define BLOCKS(f)   (NBLOCKS((f)->stat.Length))
 
#define FSO_ASSERT(f, ex)
 
#define CFSOP_PRELUDE(str, comp, fid)
 
#define CFSOP_POSTLUDE(str)   MarinerLog((str));
 
#define PrintFsoState(state)
 
#define PrintVnodeType(vnodetype)
 
#define PrintMvStat(mvstat)
 

Enumerations

enum  FsoState { FsoRunt , FsoNormal , FsoDying }
 
enum  MountStatus { NORMAL , MOUNTPOINT , ROOT }
 
enum  fso_alloc_t { FROMHEAP , FROMFREELIST }
 
enum  HoardFetchState { HF_Fetch , HF_DontFetch }
 
enum  HoardAskState { HA_Ask , HA_DontAsk }
 

Functions

void FSODaemon (void) EXCLUDES_TRANSACTION
 
void FSOInit () EXCLUDES_TRANSACTION
 
int FSO_PriorityFN (bsnode *, bsnode *)
 
void UpdateCacheStats (CacheStats *c, enum CacheEvent event, unsigned long blocks)
 
void PrintCacheStats (const char *description, CacheStats *, int)
 
void VenusToViceStatus (VenusStat *, ViceStatus *)
 
void FSOD_Init (void)
 
void FSOD_ReclaimFSOs (void)
 

Variables

int global_kernfd
 
const int FSDB_MagicNumber = 3620289
 
const int FSDB_NBUCKETS = 2048
 
const int FSO_MagicNumber = 2687694
 
const int MAX_PIGGY_VALIDATIONS = 50
 
const int FSO_MAX_SPRI = H_MAX_PRI
 
const int FSO_MAX_MPRI = H_MAX_PRI
 
const int DFLT_SWT = 25
 
const int UNSET_SWT = -1
 
const int DFLT_MWT = 75
 
const int UNSET_MWT = -1
 
const int DFLT_SSF = 4
 
const int UNSET_SSF = -1
 
const int CPSIZE = 8
 
unsigned int CacheFiles
 
unsigned int PartialCacheFilesRatio
 
uint64_t WholeFileMaxSize
 
uint64_t WholeFileMinSize
 
uint64_t WholeFileMaxStall
 
int FSO_SWT
 
int FSO_MWT
 
int FSO_SSF
 

Macro Definition Documentation

◆ ACTIVE

#define ACTIVE (   f)    (WRITING(f) || READING(f))

◆ BLOCKS

#define BLOCKS (   f)    (NBLOCKS((f)->stat.Length))

◆ BUSY

#define BUSY (   f)    ((f)->refcnt > 0 || EXECUTING(f))

◆ CFSOP_POSTLUDE

#define CFSOP_POSTLUDE (   str)    MarinerLog((str));

◆ CFSOP_PRELUDE

#define CFSOP_PRELUDE (   str,
  comp,
  fid 
)
Value:
{ \
char buf[CODA_MAXNAMLEN + 1]; \
if (comp && comp[0] != '\0') \
strcpy(buf, comp); \
else \
sprintf(buf, "%s", FID_(&fid)); \
MarinerLog((str), buf); \
}
#define CODA_MAXNAMLEN
Definition: coda.h:114
char * FID_(const struct ViceFid *fid)
Definition: fid.c:203

◆ CLU_CASE_MASK

#define CLU_CASE_MASK   0x03

◆ CLU_TRAVERSE_MTPT

#define CLU_TRAVERSE_MTPT   0x04

◆ DATAVALID

#define DATAVALID (   f)    ((f)->IsValid(RC_DATA))

◆ DIRECTORY_CONFLICT

#define DIRECTORY_CONFLICT   2

◆ DIRTY

#define DIRTY (   f)    ((f)->flags.dirty)

◆ DYING

#define DYING (   f)    ((f)->state == FsoDying)

◆ EXECUTABLE

#define EXECUTABLE (   f)     (HAVESTATUS(f) && (f)->IsFile() && ((f)->stat.Mode & 0111))

◆ EXECUTING

#define EXECUTING (   f)    (EXECUTABLE(f) && READING(f) && !k_Purge(&(f)->fid))

◆ FETCHABLE

#define FETCHABLE (   f)
Value:
(!DYING(f) && REACHABLE(f) && !DIRTY(f) && \
(!HAVESTATUS(f) || !WRITING(f) || ISVASTRO(f)) && !f->IsLocalObj())
#define HAVESTATUS(f)
Definition: fso.h:793
#define DYING(f)
Definition: fso.h:801
#define ISVASTRO(f)
Definition: fso.h:808
#define DIRTY(f)
Definition: fso.h:792
#define REACHABLE(f)
Definition: fso.h:790
#define WRITING(f)
Definition: fso.h:803
@ f
Definition: rvm_private.h:416

◆ FILE_CONFLICT

#define FILE_CONFLICT   1

◆ FLUSHABLE

#define FLUSHABLE (   f)    ((DYING(f) || REPLACEABLE(f)) && !DIRTY(f) && !BUSY(f))

◆ FSDB

#define FSDB   (rvg->recov_FSDB)

◆ FSO_ASSERT

#define FSO_ASSERT (   f,
  ex 
)
Value:
{ \
if (!(ex)) { \
(f)->print(logFile); \
CHOKE("Assertion failed: file \"%s\", line %d\n", __FILE__, \
} \
}
FILE * logFile
Definition: venusutil.cc:82
#define __FILE__
Definition: odytypes.h:64
#define __LINE__
Definition: odytypes.h:68

◆ FSO_HOLD

#define FSO_HOLD (   f)
Value:
{ \
(f)->refcnt++; \
}

◆ FSO_RELE

#define FSO_RELE (   f)
Value:
{ \
(f)->refcnt--; \
}

◆ GCABLE

#define GCABLE (   f)    (DYING(f) && !DIRTY(f) && !BUSY(f))

◆ HAVEALLDATA

#define HAVEALLDATA (   f)    (HAVEDATA(f) && !PARTIALDATA(f))

◆ HAVEDATA

#define HAVEDATA (   f)    ((f)->data.havedata != 0)

◆ HAVESTATUS

#define HAVESTATUS (   f)    ((f)->state != FsoRunt)

◆ HOARDABLE

#define HOARDABLE (   f)    ((f)->HoardPri > 0)

◆ ISVASTRO

#define ISVASTRO (   f)    ((f)->flags.vastro)

◆ LOCAL_GLOBAL

#define LOCAL_GLOBAL   2

◆ LOCALCACHE

#define LOCALCACHE   "_localcache" /* implies we have a locally cached copy */

◆ LOCALCACHE_HIDDEN

#define LOCALCACHE_HIDDEN   ".localcache" /* implies we don't */

◆ MIXED_CONFLICT

#define MIXED_CONFLICT   3

◆ PARTIALDATA

#define PARTIALDATA (   f)    ((f)->IsFile() && !(f)->cf.IsComplete())

◆ PATH_COMPONENT

#define PATH_COMPONENT   3

◆ PATH_FULL

#define PATH_FULL   1

◆ PATH_REALM

#define PATH_REALM   2

◆ PATH_VOLUME

#define PATH_VOLUME   0

◆ PrintFsoState

#define PrintFsoState (   state)
Value:
(state == FsoRunt ? "Runt" : \
state == FsoNormal ? "Normal" : \
state == FsoDying ? "Dying" : \
"???")
@ FsoNormal
Definition: fso.h:255
@ FsoRunt
Definition: fso.h:254
@ FsoDying
Definition: fso.h:256

◆ PrintMvStat

#define PrintMvStat (   mvstat)
Value:
(mvstat == NORMAL ? "Normal" : \
mvstat == MOUNTPOINT ? "MountPoint" : \
mvstat == ROOT ? "Root" : \
"???")
@ MOUNTPOINT
Definition: fso.h:304
@ NORMAL
Definition: fso.h:303
@ ROOT
Definition: fso.h:305

◆ PrintVnodeType

#define PrintVnodeType (   vnodetype)
Value:
(vnodetype == (int)File ? "File" : \
vnodetype == (int)Directory ? "Directory" : \
vnodetype == (int)SymbolicLink ? "Symlink" : \
"???")

◆ REACHABLE

#define REACHABLE (   f)    ((f)->vol->IsReachable())

◆ READING

#define READING (   f)    (((f)->openers - (f)->Writers) > 0)

◆ REPLACEABLE

#define REPLACEABLE (   f)    ((f)->prio_handle.tree() != 0)

◆ RESOLVING

#define RESOLVING (   f)    ((f)->vol->IsResolving())

◆ SERVER_SERVER

#define SERVER_SERVER   1

◆ STATUSVALID

#define STATUSVALID (   f)    ((f)->IsValid(RC_STATUS))

◆ UNREACHABLE

#define UNREACHABLE (   f)    ((f)->vol->IsUnreachable())

◆ WRITING

#define WRITING (   f)    ((f)->Writers > 0)

Enumeration Type Documentation

◆ fso_alloc_t

Enumerator
FROMHEAP 
FROMFREELIST 

◆ FsoState

enum FsoState
Enumerator
FsoRunt 
FsoNormal 
FsoDying 

◆ HoardAskState

Enumerator
HA_Ask 
HA_DontAsk 

◆ HoardFetchState

Enumerator
HF_Fetch 
HF_DontFetch 

◆ MountStatus

Enumerator
NORMAL 
MOUNTPOINT 
ROOT 

Function Documentation

◆ FSO_PriorityFN()

int FSO_PriorityFN ( bsnode b1,
bsnode b2 
)

◆ FSOD_Init()

void FSOD_Init ( void  )

◆ FSOD_ReclaimFSOs()

void FSOD_ReclaimFSOs ( void  )

◆ FSODaemon()

void FSODaemon ( void  )

◆ FSOInit()

void FSOInit ( )

◆ PrintCacheStats()

void PrintCacheStats ( const char *  description,
CacheStats c,
int  fd 
)

◆ UpdateCacheStats()

void UpdateCacheStats ( CacheStats c,
enum CacheEvent  event,
unsigned long  blocks 
)

◆ VenusToViceStatus()

void VenusToViceStatus ( VenusStat venusstat,
ViceStatus *  vicestat 
)

Variable Documentation

◆ CacheFiles

unsigned int CacheFiles
extern

◆ CPSIZE

const int CPSIZE = 8

◆ DFLT_MWT

const int DFLT_MWT = 75

◆ DFLT_SSF

const int DFLT_SSF = 4

◆ DFLT_SWT

const int DFLT_SWT = 25

◆ FSDB_MagicNumber

const int FSDB_MagicNumber = 3620289

◆ FSDB_NBUCKETS

const int FSDB_NBUCKETS = 2048

◆ FSO_MagicNumber

const int FSO_MagicNumber = 2687694

◆ FSO_MAX_MPRI

const int FSO_MAX_MPRI = H_MAX_PRI

◆ FSO_MAX_SPRI

const int FSO_MAX_SPRI = H_MAX_PRI

◆ FSO_MWT

int FSO_MWT
extern

◆ FSO_SSF

int FSO_SSF
extern

◆ FSO_SWT

int FSO_SWT
extern

◆ global_kernfd

int global_kernfd
extern

◆ MAX_PIGGY_VALIDATIONS

const int MAX_PIGGY_VALIDATIONS = 50

◆ PartialCacheFilesRatio

unsigned int PartialCacheFilesRatio
extern

◆ UNSET_MWT

const int UNSET_MWT = -1

◆ UNSET_SSF

const int UNSET_SSF = -1

◆ UNSET_SWT

const int UNSET_SWT = -1

◆ WholeFileMaxSize

uint64_t WholeFileMaxSize
extern

◆ WholeFileMaxStall

uint64_t WholeFileMaxStall
extern

◆ WholeFileMinSize

uint64_t WholeFileMinSize
extern