27#ifndef _VENUS_FSO_CACHEFILE_H_ 
   28#define _VENUS_FSO_CACHEFILE_H_ 1 
   59#define CACHEFILENAMELEN 16 
   73static inline uint64_t ccblocks_to_bytes(uint64_t ccblocks)
 
   85static inline uint64_t bytes_to_ccblocks(uint64_t 
bytes)
 
   97static inline uint64_t bytes_to_ccblocks_floor(uint64_t 
bytes)
 
   99    return bytes_to_ccblocks(
bytes);
 
  109static inline uint64_t bytes_to_ccblocks_ceil(uint64_t 
bytes)
 
  121static inline uint64_t align_to_ccblock_ceil(uint64_t 
bytes)
 
  133static inline uint64_t align_to_ccblock_floor(uint64_t 
bytes)
 
  145static inline uint64_t ccblock_start(uint64_t b_pos)
 
  147    return bytes_to_ccblocks_floor(b_pos);
 
  158static inline uint64_t ccblock_end(uint64_t b_pos, int64_t b_count)
 
  160    return bytes_to_ccblocks_ceil(b_pos + b_count);
 
  171static inline uint64_t ccblock_length(uint64_t b_pos, int64_t b_count)
 
  173    return ccblock_end(b_pos, b_count) - ccblock_start(b_pos);
 
  184static inline uint64_t pos_align_to_ccblock(uint64_t b_pos)
 
  198static inline uint64_t length_align_to_ccblock(uint64_t b_pos, int64_t b_count)
 
  200    return ccblocks_to_bytes(ccblock_length(b_pos, b_count));
 
  203#define FS_BLOCKS_SIZE_MAX (4095) 
  204#define FS_BLOCKS_SIZE_MASK (~FS_BLOCKS_SIZE_MAX) 
  205#define FS_BLOCKS_ALIGN(size) \ 
  206    ((size + FS_BLOCKS_SIZE_MAX) & FS_BLOCKS_SIZE_MASK) 
  279    void AddChunk(uint64_t start, int64_t len);
 
  305    void ForEach(
void (*foreachcb)(uint64_t start, int64_t len,
 
  307                 void *usr_data = 
NULL);
 
  361    int ValidContainer();
 
  366    void UpdateValidData();
 
  377    CacheChunk GetNextHole(uint64_t start_b, uint64_t end_b);
 
  449    FILE *
FOpen(const 
char *mode);
 
  487    int Copy(
char *destname, 
int recovering = 0);
 
  506    void Stat(
struct stat *tstat);
 
  514    void Utimes(
const struct timeval times[2]);
 
  636    void print(
int fdes);
 
Definition: fso_cachefile.h:260
 
void ReadLock()
Definition: fso_cachefile.cc:779
 
CacheChunkList()
Definition: fso_cachefile.cc:625
 
~CacheChunkList()
Definition: fso_cachefile.cc:630
 
void ReverseRemove(uint64_t start, int64_t len)
Definition: fso_cachefile.cc:830
 
void ForEach(void(*foreachcb)(uint64_t start, int64_t len, void *usr_data_cb), void *usr_data=NULL)
Definition: fso_cachefile.cc:858
 
void WriteLock()
Definition: fso_cachefile.cc:784
 
void ReadUnlock()
Definition: fso_cachefile.cc:789
 
CacheChunk pop()
Definition: fso_cachefile.cc:880
 
bool ReverseCheck(uint64_t start, int64_t len)
Definition: fso_cachefile.cc:799
 
void WriteUnlock()
Definition: fso_cachefile.cc:794
 
uint Length()
Definition: fso_cachefile.h:341
 
void AddChunk(uint64_t start, int64_t len)
Definition: fso_cachefile.cc:771
 
Definition: fso_cachefile.h:208
 
CacheChunk(uint64_t start, int64_t len)
Definition: fso_cachefile.h:221
 
CacheChunk()
Definition: fso_cachefile.h:231
 
int64_t GetLength()
Definition: fso_cachefile.h:250
 
uint64_t GetStart()
Definition: fso_cachefile.h:243
 
bool isValid()
Definition: fso_cachefile.h:257
 
Definition: fso_cachefile.h:344
 
void SetValidData(uint64_t len) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:418
 
int FClose(FILE *f)
Definition: fso_cachefile.cc:520
 
int Open(int flags)
Definition: fso_cachefile.cc:488
 
int DecRef()
Definition: fso_cachefile.cc:286
 
char name[CACHEFILENAMELEN]
Definition: fso_cachefile.h:380
 
void Utimes(const struct timeval times[2])
Definition: fso_cachefile.cc:306
 
void print(FILE *fp)
Definition: fso_cachefile.h:625
 
void SetPartial(bool is_partial) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:121
 
FILE * FOpen(const char *mode)
Definition: fso_cachefile.cc:505
 
int Copy(CacheFile *destination) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:223
 
uint64_t ConsecutiveValidData()
Definition: fso_cachefile.cc:528
 
uint64_t Length()
Definition: fso_cachefile.h:577
 
static int64_t CopySegment(CacheFile *from, CacheFile *to, uint64_t pos, int64_t count) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:550
 
char * Name()
Definition: fso_cachefile.h:570
 
void Validate() EXCLUDES_TRANSACTION
Definition: fso_cachefile.cc:114
 
bool IsPartial()
Definition: fso_cachefile.h:606
 
void SetLength(uint64_t newlen) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:387
 
CacheChunkList * GetValidChunks(uint64_t start, int64_t len)
Definition: fso_cachefile.cc:725
 
void IncRef()
Definition: fso_cachefile.h:492
 
CacheChunkList * GetHoles(uint64_t start, int64_t len)
Definition: fso_cachefile.cc:692
 
CacheFile()
Definition: fso_cachefile.cc:93
 
friend class SegmentedCacheFile
Definition: fso_cachefile.h:345
 
int IsComplete()
Definition: fso_cachefile.h:599
 
void Truncate(uint64_t newlen) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:312
 
void Stat(struct stat *tstat)
Definition: fso_cachefile.cc:301
 
void print()
Definition: fso_cachefile.h:618
 
void Reset() EXCLUDES_TRANSACTION
Definition: fso_cachefile.cc:149
 
uint64_t ValidData()
Definition: fso_cachefile.h:584
 
int Close(int fd)
Definition: fso_cachefile.cc:498
 
void Create(int newlength=0) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:186
 
Definition: fso_cachefile.h:642
 
int64_t ExtractSegment(uint64_t pos, int64_t count) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:925
 
int64_t InjectSegment(uint64_t pos, int64_t count) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:931
 
~SegmentedCacheFile()
Definition: fso_cachefile.cc:912
 
void Associate(CacheFile *cf) REQUIRES_TRANSACTION
Definition: fso_cachefile.cc:918
 
int count()
Definition: dlist.cc:212
 
#define REQUIRES_TRANSACTION
Definition: coda_tsa.h:107
 
#define EXCLUDES_TRANSACTION
Definition: coda_tsa.h:108
 
uint64_t CacheChunkBlockBitmapSize
Definition: fso_cachefile.cc:64
 
uint64_t CacheChunkBlockSizeBits
Definition: fso_cachefile.cc:63
 
uint64_t CacheChunkBlockSizeMax
Definition: fso_cachefile.cc:62
 
uint64_t CacheChunkBlockSize
Definition: fso_cachefile.cc:61
 
#define CACHEFILENAMELEN
Definition: fso_cachefile.h:59
 
#define bytes(bits)
Definition: grunt.h:29
 
stdout
Definition: volusage.py:12
 
@ f
Definition: rvm_private.h:416
 
#define NULL
Definition: voltypes.h:44