nfs-ganesha 1.4
Classes | Defines | Typedefs | Enumerations | Functions

cache_content.h File Reference

Management of the cached content layer. More...

#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <time.h>
#include <pthread.h>
#include <dirent.h>
#include <sys/stat.h>
#include "LRU_List.h"
#include "HashData.h"
#include "HashTable.h"
#include "fsal.h"
#include "cache_inode.h"

Go to the source code of this file.

Classes

struct  cache_content_gc_policy__
struct  cache_content_opened_file__
struct  cache_content_client_parameter__
struct  cache_content_internal_md__
struct  cache_content_local_entry__
struct  cache_content_entry__
struct  cache_content_stat__
struct  cache_content_stat__::func_inode_stats
struct  cache_content_client__
struct  cache_content_dirinfo__
struct  cache_content_flush_thread_data__

Defines

#define CONF_LABEL_CACHE_CONTENT_GCPOL   "FileContent_GC_Policy"
#define CONF_LABEL_CACHE_CONTENT_CLIENT   "FileContent_Client"
#define CONF_LABEL_CACHE_CONTENT_PARAM   "FileContent_Param"
#define CACHE_CONTENT_NEW_ENTRY   0
#define CACHE_CONTENT_RELEASE_ENTRY   1
#define CACHE_CONTENT_READ_ENTRY   2
#define CACHE_CONTENT_WRITE_ENTRY   3
#define CACHE_CONTENT_TRUNCATE   4
#define CACHE_CONTENT_FLUSH   5
#define CACHE_CONTENT_REFRESH   6
#define CACHE_CONTENT_NB_COMMAND   7
#define CACHE_CONTENT_FLAGS_READ   0x0000001
#define CACHE_CONTENT_FLAGS_WRITE   0x0000002
#define CACHE_CONTENT_FLAGS_READ_WRITE   0x0000003
#define CACHE_CONTENT_SPEC_DATA_SIZE   400
#define CACHE_CONTENT_DIR_INITIALIZER   NULL
#define CACHE_CONTENT_SUCCESS   0
#define CACHE_CONTENT_INVALID_ARGUMENT   1
#define CACHE_CONTENT_UNAPPROPRIATED_KEY   2
#define CACHE_CONTENT_BAD_CACHE_INODE_ENTRY   3
#define CACHE_CONTENT_ENTRY_EXISTS   4
#define CACHE_CONTENT_FSAL_ERROR   5
#define CACHE_CONTENT_LOCAL_CACHE_ERROR   6
#define CACHE_CONTENT_MALLOC_ERROR   7
#define CACHE_CONTENT_LRU_ERROR   8
#define CACHE_CONTENT_NOT_FOUND   9
#define CACHE_CONTENT_LOCAL_CACHE_NOT_FOUND   10
#define CACHE_CONTENT_TOO_LARGE_FOR_CACHE   11
#define cache_content_read(a, b, c, d, e, f, g, h, i)   cache_content_rdwr( a, CACHE_CONTENT_READ, b, c, d, e, f, g, h, i )
#define cache_content_write(a, b, c, d, e, f, g, h, i)   cache_content_rdwr( a, CACHE_CONTENT_WRITE, b, c, d, e, f, g, h, i )

Typedefs

typedef int cache_content_status_t
typedef struct
cache_content_gc_policy__ 
cache_content_gc_policy_t
typedef struct
cache_content_opened_file__ 
cache_content_opened_file_t
typedef enum
cache_content_sync_state__ 
cache_content_sync_state_t
typedef enum
cache_content_entry_valid_state__ 
cache_content_entry_valid_state_t
typedef enum
cache_content_flush_behaviour__ 
cache_content_flush_behaviour_t
typedef struct
cache_content_client_parameter__ 
cache_content_client_parameter_t
typedef char cache_content_spec_data_t [CACHE_CONTENT_SPEC_DATA_SIZE]
typedef struct
cache_content_internal_md__ 
cache_content_internal_md_t
typedef struct
cache_content_local_entry__ 
cache_content_local_entry_t
typedef struct
cache_content_entry__ 
cache_content_entry_t
typedef struct cache_content_stat__ cache_content_stat_t
typedef struct
cache_content_client__ 
cache_content_client_t
typedef enum cache_content_op__ cache_content_op_t
typedef struct
cache_content_dirinfo__ 
cache_content_dirinfo_t
typedef enum
cache_content_nametype__ 
cache_content_nametype_t
typedef enum
cache_content_create_behaviour__ 
cache_content_add_behaviour_t
typedef enum
cache_content_refresh_how__ 
cache_content_refresh_how_t
typedef struct
cache_content_flush_thread_data__ 
cache_content_flush_thread_data_t

Enumerations

enum  cache_content_sync_state__ { JUST_CREATED = 1, SYNC_OK = 2, FLUSH_NEEDED = 3, REFRESH_NEEDED = 4 }
enum  cache_content_entry_valid_state__ { STATE_OK = 1, TO_BE_GARBAGGED = 2 }
enum  cache_content_flush_behaviour__ { CACHE_CONTENT_FLUSH_AND_DELETE = 1, CACHE_CONTENT_FLUSH_SYNC_ONLY = 2 }
enum  cache_content_op__ { CACHE_CONTENT_OP_GET = 1, CACHE_CONTENT_OP_SET = 2, CACHE_CONTENT_OP_FLUSH = 3 }
enum  cache_content_nametype__ { CACHE_CONTENT_UNASSIGNED = 1, CACHE_CONTENT_DATA_FILE = 2, CACHE_CONTENT_INDEX_FILE = 3, CACHE_CONTENT_DIR = 4 }
enum  cache_content_create_behaviour__ { ADD_ENTRY = 1, RECOVER_ENTRY = 2, RENEW_ENTRY }
enum  cache_content_refresh_how__ { KEEP_LOCAL = 1, FORCE_FROM_FSAL = 2, DEFAULT_REFRESH }

Functions

int cache_content_client_init (cache_content_client_t *pclient, cache_content_client_parameter_t param, char *name)
cache_content_status_t cache_content_create_name (char *path, cache_content_nametype_t type, fsal_op_context_t *pcontext, cache_entry_t *pentry_inode, cache_content_client_t *pclient)
int cache_content_init (cache_content_client_parameter_t param, cache_content_status_t *pstatus)
int cache_content_init_dir (cache_content_client_parameter_t param, unsigned short export_id)
cache_content_entry_tcache_content_new_entry (cache_entry_t *pentry_inode, cache_content_spec_data_t *pspecdata, cache_content_client_t *pclient, cache_content_add_behaviour_t how, fsal_op_context_t *pcontext, cache_content_status_t *pstatus)
cache_content_status_t cache_content_release_entry (cache_content_entry_t *pentry, cache_content_client_t *pclient, cache_content_status_t *pstatus)
cache_content_status_t cache_content_open (cache_content_entry_t *pentry, cache_content_client_t *pclient, cache_content_status_t *pstatus)
cache_content_status_t cache_content_close (cache_content_entry_t *pentry, cache_content_client_t *pclient, cache_content_status_t *pstatus)
cache_content_status_t cache_content_rdwr (cache_content_entry_t *pentry, cache_inode_io_direction_t read_or_write, uint64_t offset, size_t *pio_size_in, size_t *pio_size_out, void *buffer, fsal_boolean_t *p_fsal_eof, struct stat *pbuffstat, cache_content_client_t *pclient, fsal_op_context_t *pcontext, cache_content_status_t *pstatus)
cache_content_status_t cache_content_truncate (cache_content_entry_t *pentry, fsal_size_t length, cache_content_client_t *pclient, cache_content_status_t *pstatus)
cache_content_status_t cache_content_flush (cache_content_entry_t *pentry, cache_content_flush_behaviour_t flushhow, cache_content_client_t *pclient, fsal_op_context_t *pcontext, cache_content_status_t *pstatus)
cache_content_status_t cache_content_refresh (cache_content_entry_t *pentry, cache_content_client_t *pclient, fsal_op_context_t *pcontext, cache_content_refresh_how_t how, cache_content_status_t *pstatus)
cache_content_status_t cache_content_sync_all (cache_content_client_t *pclient, fsal_op_context_t *pcontext, cache_content_status_t *pstatus)
cache_content_status_t cache_content_read_conf_client_parameter (config_file_t in_config, cache_content_client_parameter_t *pparam)
void cache_content_print_conf_client_parameter (FILE *output, cache_content_client_parameter_t param)
off_t cache_content_fsal_seek_convert (fsal_seek_t seek, cache_content_status_t *pstatus)
size_t cache_content_fsal_size_convert (fsal_size_t size, cache_content_status_t *pstatus)
cache_content_status_t cache_content_crash_recover (unsigned short exportid, unsigned int index, unsigned int mod, cache_content_client_t *pclient_data, fsal_op_context_t *pcontext, cache_content_status_t *pstatus)
int cache_content_get_export_id (char *dirname)
u_int64_t cache_content_get_inum (char *filename)
int cache_content_get_datapath (char *basepath, u_int64_t inum, char *datapath)
off_t cache_content_recover_size (char *basepath, u_int64_t inum)
cache_inode_status_t cache_content_error_convert (cache_content_status_t status)
cache_content_status_t cache_content_read_conf_gc_policy (config_file_t in_config, cache_content_gc_policy_t *ppolicy)
void cache_content_print_conf_gc_policy (FILE *output, cache_content_gc_policy_t gcpolicy)
void cache_content_set_gc_policy (cache_content_gc_policy_t policy)
cache_content_gc_policy_t cache_content_get_gc_policy (void)
cache_content_status_t cache_content_gc (cache_content_client_t *pclient, cache_content_status_t *pstatus)
cache_content_status_t cache_content_emergency_flush (char *cachedir, cache_content_flush_behaviour_t flushhow, unsigned int lw_mark_trigger_flag, time_t grace_period, unsigned int index, unsigned int mod, unsigned int *p_nb_flushed, unsigned int *p_nb_too_young, unsigned int *p_nb_errors, unsigned int *p_nb_orphans, fsal_op_context_t *pcontext, cache_content_status_t *pstatus)
cache_content_status_t cache_content_check_threshold (char *datacache_path, unsigned int threshold_min, unsigned int threshold_max, int *p_bool_overflow, unsigned long *p_blocks_to_lwm)
int cache_content_local_cache_opendir (char *cache_dir, cache_content_dirinfo_t *pdirectory)
int cache_content_local_cache_dir_iter (cache_content_dirinfo_t *directory, struct dirent *dir_entry, unsigned int index, unsigned int mod)
void cache_content_local_cache_closedir (cache_content_dirinfo_t *directory)
int cache_content_invalidate_flushed (LRU_entry_t *plru_entry, void *addparam)
cache_content_status_t cache_content_test_cached (cache_entry_t *pentry_inode, cache_content_client_t *pclient, fsal_op_context_t *pcontext, cache_content_status_t *pstatus)
off_t cache_content_get_cached_size (cache_content_entry_t *pentry)

Detailed Description

Management of the cached content layer.

Author:
Author:
leibovic
Date:
Date:
2006/02/17 13:41:01
Version:
Revision:
1.29

cache_content.h : Management of the cached content layer

Definition in file cache_content.h.


Define Documentation

#define CACHE_CONTENT_BAD_CACHE_INODE_ENTRY   3

Definition at line 213 of file cache_content.h.

#define CACHE_CONTENT_DIR_INITIALIZER   NULL

Definition at line 205 of file cache_content.h.

#define CACHE_CONTENT_ENTRY_EXISTS   4

Definition at line 214 of file cache_content.h.

#define CACHE_CONTENT_FLAGS_READ   0x0000001

Definition at line 83 of file cache_content.h.

#define CACHE_CONTENT_FLAGS_READ_WRITE   0x0000003

Definition at line 85 of file cache_content.h.

#define CACHE_CONTENT_FLAGS_WRITE   0x0000002

Definition at line 84 of file cache_content.h.

#define CACHE_CONTENT_FLUSH   5

Definition at line 78 of file cache_content.h.

#define CACHE_CONTENT_FSAL_ERROR   5

Definition at line 215 of file cache_content.h.

#define CACHE_CONTENT_INVALID_ARGUMENT   1

Definition at line 211 of file cache_content.h.

#define CACHE_CONTENT_LOCAL_CACHE_ERROR   6

Definition at line 216 of file cache_content.h.

#define CACHE_CONTENT_LOCAL_CACHE_NOT_FOUND   10

Definition at line 220 of file cache_content.h.

#define CACHE_CONTENT_LRU_ERROR   8

Definition at line 218 of file cache_content.h.

#define CACHE_CONTENT_MALLOC_ERROR   7

Definition at line 217 of file cache_content.h.

#define CACHE_CONTENT_NB_COMMAND   7

Definition at line 81 of file cache_content.h.

#define CACHE_CONTENT_NEW_ENTRY   0

Definition at line 73 of file cache_content.h.

#define CACHE_CONTENT_NOT_FOUND   9

Definition at line 219 of file cache_content.h.

#define cache_content_read (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)    cache_content_rdwr( a, CACHE_CONTENT_READ, b, c, d, e, f, g, h, i )

Definition at line 295 of file cache_content.h.

#define CACHE_CONTENT_READ_ENTRY   2

Definition at line 75 of file cache_content.h.

#define CACHE_CONTENT_REFRESH   6

Definition at line 79 of file cache_content.h.

#define CACHE_CONTENT_RELEASE_ENTRY   1

Definition at line 74 of file cache_content.h.

#define CACHE_CONTENT_SPEC_DATA_SIZE   400

Definition at line 118 of file cache_content.h.

#define CACHE_CONTENT_SUCCESS   0

Definition at line 210 of file cache_content.h.

#define CACHE_CONTENT_TOO_LARGE_FOR_CACHE   11

Definition at line 221 of file cache_content.h.

#define CACHE_CONTENT_TRUNCATE   4

Definition at line 77 of file cache_content.h.

#define CACHE_CONTENT_UNAPPROPRIATED_KEY   2

Definition at line 212 of file cache_content.h.

#define cache_content_write (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)    cache_content_rdwr( a, CACHE_CONTENT_WRITE, b, c, d, e, f, g, h, i )

Definition at line 296 of file cache_content.h.

#define CACHE_CONTENT_WRITE_ENTRY   3

Definition at line 76 of file cache_content.h.

#define CONF_LABEL_CACHE_CONTENT_CLIENT   "FileContent_Client"

Definition at line 70 of file cache_content.h.

#define CONF_LABEL_CACHE_CONTENT_GCPOL   "FileContent_GC_Policy"

Definition at line 69 of file cache_content.h.

#define CONF_LABEL_CACHE_CONTENT_PARAM   "FileContent_Param"

Definition at line 71 of file cache_content.h.


Typedef Documentation

typedef char cache_content_spec_data_t[CACHE_CONTENT_SPEC_DATA_SIZE]

Definition at line 119 of file cache_content.h.

Definition at line 57 of file cache_content.h.


Enumeration Type Documentation

Enumerator:
ADD_ENTRY 
RECOVER_ENTRY 
RENEW_ENTRY 

Definition at line 230 of file cache_content.h.

Enumerator:
STATE_OK 
TO_BE_GARBAGGED 

Definition at line 100 of file cache_content.h.

Enumerator:
CACHE_CONTENT_FLUSH_AND_DELETE 
CACHE_CONTENT_FLUSH_SYNC_ONLY 

Definition at line 105 of file cache_content.h.

Enumerator:
CACHE_CONTENT_UNASSIGNED 
CACHE_CONTENT_DATA_FILE 
CACHE_CONTENT_INDEX_FILE 
CACHE_CONTENT_DIR 

Definition at line 223 of file cache_content.h.

Enumerator:
CACHE_CONTENT_OP_GET 
CACHE_CONTENT_OP_SET 
CACHE_CONTENT_OP_FLUSH 

Definition at line 178 of file cache_content.h.

Enumerator:
KEEP_LOCAL 
FORCE_FROM_FSAL 
DEFAULT_REFRESH 

Definition at line 236 of file cache_content.h.

Enumerator:
JUST_CREATED 
SYNC_OK 
FLUSH_NEEDED 
REFRESH_NEEDED 

Definition at line 93 of file cache_content.h.


Function Documentation

cache_content_status_t cache_content_check_threshold ( char *  datacache_path,
unsigned int  threshold_min,
unsigned int  threshold_max,
int *  p_bool_overflow,
unsigned long *  p_blocks_to_lwm 
)

cache_content_check_threshold: check datacache filesystem's threshold.

Parameters:
datacache_path[IN] the datacache filesystem's path.
threshold_min[IN] the low watermark for the filesystem (in percent).
threshold_max[IN] the high watermark for the filesystem (in percent).
p_bool_overflow[OUT] boolean that indicates whether the FS overcomes the high watermark.
p_blocks_to_lwm[OUT] if bool_overflow is set to true, this indicates the number of blocks to be purged in order to reach the low watermark.
Returns:
CACHE_CONTENT_SUCCESS if successful
CACHE_CONTENT_INVALID_ARGUMENT if some argument has an unexpected value
CACHE_CONTENT_LOCAL_CACHE_ERROR if an error occured while getting informations from datacache filesystem.

Definition at line 482 of file cache_content_misc.c.

int cache_content_client_init ( cache_content_client_t pclient,
cache_content_client_parameter_t  param,
char *  name 
)

cache_content_client_init: Init the ressource necessary for the cache content client.

Init the ressource necessary for the cache content client.

Parameters:
param[IN] the parameter for this client
pstatus[OUT] pointer to buffer used to store the status for the operation.
Returns:
0 if operation failed, -1 if failed.

Definition at line 127 of file cache_content_init.c.

cache_content_status_t cache_content_close ( cache_content_entry_t pentry,
cache_content_client_t pclient,
cache_content_status_t pstatus 
)

cache_content_close: closes the local fd on the cache.

Closes the local fd on the cache.

No lock management is done in this layer: the related pentry in the cache inode layer is locked and will prevent from concurent accesses.

Parameters:
pentry[IN] entry in file content layer whose content is to be accessed.
pclient[IN] ressource allocated by the client for the nfs management. [OUT] returned status.
Returns:
CACHE_CONTENT_SUCCESS is successful .

Definition at line 152 of file cache_content_rdwr.c.

cache_content_status_t cache_content_crash_recover ( unsigned short  exportid,
unsigned int  index,
unsigned int  mod,
cache_content_client_t pclient_data,
fsal_op_context_t pcontext,
cache_content_status_t pstatus 
)

cache_content_crash_recover: recovers the data cache and the associated inode after a crash.

[OUT] returned status.

Returns:
CACHE_CONTENT_SUCCESS is successful.

Definition at line 71 of file cache_content_crash_recover.c.

cache_content_status_t cache_content_create_name ( char *  path,
cache_content_nametype_t  type,
fsal_op_context_t pcontext,
cache_entry_t pentry_inode,
cache_content_client_t pclient 
)

cache_content_create_name: Creates a name in the local fs for a cached entry.

Creates a name in the local fs for a cached entry and creates the directories that whil contain this file.

Parameters:
path[OUT] buffer to be used for storing the name.
type[IN] type of pathname to be created.
pentry_inode[OUT] Entry in Cache inode layer related to the file content entry.
pclient[IN] resources allocated for the file content client.
Returns:
CACHE_CONTENT_SUCCESS if operation is a success, other values show an error.

Definition at line 111 of file cache_content_misc.c.

cache_content_status_t cache_content_emergency_flush ( char *  cachedir,
cache_content_flush_behaviour_t  flushhow,
unsigned int  lw_mark_trigger_flag,
time_t  grace_period,
unsigned int  index,
unsigned int  mod,
unsigned int *  p_nb_flushed,
unsigned int *  p_nb_too_young,
unsigned int *  p_nb_errors,
unsigned int *  p_nb_orphans,
fsal_op_context_t pcontext,
cache_content_status_t pstatus 
)

cache_content_emergency_flush: Flushes the content of a file in the local cache to the FSAL data.

Flushes the content of a file in the local cache to the FSAL data. This routine should be called only from the cache_inode layer.

No lock management is done in this layer: the related pentry in the cache inode layer is locked and will prevent from concurent accesses.

Parameters:
cachedir[IN] cachedir the filesystem where the cache resides
flushhow[IN] should we delete local files or not ?
lw_mark_trig[IN] shpuld we purge until low water mark is reached ?
grace_period[IN] grace_period The grace period for a file before being considered for deletion
p_nb_flushed[INOUT] current flushed count
p_nb_errors[INOUT] current flush errors
p_nb_orphans[INOUT] current orphan files detected
pcontext[INOUT] pcontext the FSAL context for this operation
pstatys[OUT] the status of the operation.
Returns:
CACHE_CONTENT_SUCCESS if successful, an error otherwise.

Definition at line 103 of file cache_content_emergency_flush.c.

cache_inode_status_t cache_content_error_convert ( cache_content_status_t  status)

cache_content_error_convert: Converts a cache_content_status to a cache_inode_status.

Converts a cache_content_status to a cache_inode_status.

Parameters:
status[IN] File content status to be converted.
Returns:
a cache_inode_status_t resulting from the conversion.

Definition at line 347 of file cache_content_misc.c.

cache_content_status_t cache_content_flush ( cache_content_entry_t pentry,
cache_content_flush_behaviour_t  flushhow,
cache_content_client_t pclient,
fsal_op_context_t pcontext,
cache_content_status_t pstatus 
)

cache_content_flush: Flushes the content of a file in the local cache to the FSAL data.

Flushes the content of a file in the local cache to the FSAL data. This routine should be called only from the cache_inode layer.

No lock management is done in this layer: the related pentry in the cache inode layer is locked and will prevent from concurent accesses.

Parameters:
pentry[IN] entry in file content layer whose content is to be flushed.
flushhow[IN] should we delete the cached entry in local or not ?
pclient[IN] ressource allocated by the client for the nfs management. [OUT] returned status.
Returns:
CACHE_CONTENT_SUCCESS is successful .

Definition at line 78 of file cache_content_flush.c.

off_t cache_content_fsal_seek_convert ( fsal_seek_t  seek,
cache_content_status_t pstatus 
)
size_t cache_content_fsal_size_convert ( fsal_size_t  size,
cache_content_status_t pstatus 
)

cache_content_fsal_size_convert: converts a fsal_size_t to unix size.

Converts a fsal_seek_t to unix size.

Parameters:
seek[IN] FSAL Seek descriptor.
pstatus[OUT] pointer to the status.
Returns:
the converted value.

Definition at line 405 of file cache_content_misc.c.

cache_content_status_t cache_content_gc ( cache_content_client_t pclient,
cache_content_status_t pstatus 
)
off_t cache_content_get_cached_size ( cache_content_entry_t pentry)

cache_content_get_cached_size: recovers the size of a data cached file.

Recovers the size of a data cached file.

Parameters:
pentry[IN] related pentry
Returns:
the recovered size (as a off_t) or -1 is failed.

Definition at line 317 of file cache_content_misc.c.

int cache_content_get_datapath ( char *  basepath,
u_int64_t  inum,
char *  datapath 
)

cache_content_get_datapath : recovers the path for a file of a specified inum.

Parameters:
basepath[IN] path to the root of the directory in the cache for the related export entry
inum[IN] inode number for the file whose size is to be recovered.
path[OUT] the absolute path of the file (must be at least a MAXPATHLEN length string).
Returns:
0 if OK, or -1 is failed.

Definition at line 254 of file cache_content_misc.c.

int cache_content_get_export_id ( char *  dirname)

cache_content_get_export_id: gets an export id from an export dirname.

Gets an export id from an export dirname.

Parameters:
dirname[IN] The dirname for the export_id dirname.
Returns:
-1 if failed, the export_id if successfull.

Definition at line 192 of file cache_content_misc.c.

cache_content_gc_policy_t cache_content_get_gc_policy ( void  )

cache_content_get_gc_policy: Set the cache_content garbagge collecting policy.

Returns:
the current policy.

Definition at line 91 of file cache_content_gc.c.

u_int64_t cache_content_get_inum ( char *  filename)

cache_content_get_inum: gets an inode number fronm a cache filename.

Gets an inode number fronm a cache filename.

Parameters:
filename[IN] The filename to be parsed.
Returns:
0 if failed, the inum if successfull.

Definition at line 216 of file cache_content_misc.c.

int cache_content_init ( cache_content_client_parameter_t  param,
cache_content_status_t pstatus 
)

cache_inode_init: Init the ressource necessary for the cache inode management.

Init the ressource necessary for the cache inode management.

Parameters:
param[IN] the parameter for this cache.
pstatus[OUT] pointer to buffer used to store the status for the operation.
Returns:
0 if operation failed, -1 if failed.

Definition at line 72 of file cache_content_init.c.

int cache_content_init_dir ( cache_content_client_parameter_t  param,
unsigned short  export_id 
)

cache_content_init_dir: Init the directory for caching entries from a given export id.

Parameters:
param[IN] the parameter for this cache.
export_id[IN] export id for the entries to be cached.
Returns:
0 if ok, -1 otherwise. Errno will be set with the error's value.

Definition at line 100 of file cache_content_init.c.

int cache_content_invalidate_flushed ( LRU_entry_t plru_entry,
void *  addparam 
)
void cache_content_local_cache_closedir ( cache_content_dirinfo_t directory)

cache_content_local_cache_closedir: Close a local cache directory associated to an export entry.

Parameters:
directory[IN]the handle to the directory to be closed
Returns:
nothing (void function)

Definition at line 868 of file cache_content_misc.c.

int cache_content_local_cache_dir_iter ( cache_content_dirinfo_t directory,
struct dirent *  pdir_entry,
unsigned int  index,
unsigned int  mod 
)

cache_content_local_cache_dir_iter: iterate on a local cache directory to get the entry one by one

Parameters:
directory[IN] the directory to be read
index[IN] thread index for multithreaded flushes (first has index 0)
mod[IN] modulus for multithreaded flushes (number of threads)
pdir_entry[OUT] found dir_entry
Returns:
TRUE if OK, FALSE if NOK.

Definition at line 664 of file cache_content_misc.c.

int cache_content_local_cache_opendir ( char *  cache_dir,
cache_content_dirinfo_t pdirectory 
)

cache_content_local_cache_opendir: Open a local cache directory associated to an export entry.

Parameters:
cache_dir[IN] the path to the directory associated with the export entry
pdirectory[OUT] pointer to trhe openend directory
Returns:
the handle to the directory or NULL is failed

Definition at line 569 of file cache_content_misc.c.

cache_content_entry_t* cache_content_new_entry ( cache_entry_t pentry_inode,
cache_content_spec_data_t pspecdata,
cache_content_client_t pclient,
cache_content_add_behaviour_t  how,
fsal_op_context_t pcontext,
cache_content_status_t pstatus 
)

cache_content_new_entry: adds an entry to the file content cache.

Adds an entry to the file content cache. This routine should be called only from the cache_inode layer.

No lock management is done in this layer: the related pentry in the cache inode layer is locked and will prevent from concurent accesses.

Parameters:
pentry_inode[IN] entry in cache_inode layer for this file.
pspecdata[IN] pointer to the entry's specific data
pclient[IN] ressource allocated by the client for the nfs management. [OUT] returned status.
Returns:
CACHE_CONTENT_SUCCESS is successful .

Definition at line 80 of file cache_content_add_entry.c.

cache_content_status_t cache_content_open ( cache_content_entry_t pentry,
cache_content_client_t pclient,
cache_content_status_t pstatus 
)

cache_content_open: opens the local fd on the cache.

Opens the local fd on the cache.

No lock management is done in this layer: the related pentry in the cache inode layer is locked and will prevent from concurent accesses.

Parameters:
pentry[IN] entry in file content layer whose content is to be accessed.
pclient[IN] ressource allocated by the client for the nfs management. [OUT] returned status.
Returns:
CACHE_CONTENT_SUCCESS is successful .

Definition at line 81 of file cache_content_rdwr.c.

void cache_content_print_conf_client_parameter ( FILE *  output,
cache_content_client_parameter_t  param 
)

cache_content_print_conf_client_parameter: prints the client parameter.

Prints the client parameters.

Parameters:
output[IN] a descriptor to the IO for printing the data.
param[IN] structure to be printed.
Returns:
nothing (void function).

Definition at line 201 of file cache_content_read_conf.c.

void cache_content_print_conf_gc_policy ( FILE *  output,
cache_content_gc_policy_t  gcpolicy 
)

cache_content_print_gc_pol: prints the garbage collection policy.

Prints the garbage collection policy.

Parameters:
output[IN] a descriptor to the IO for printing the data.
param[IN] structure to be printed.
Returns:
nothing (void function).

Definition at line 316 of file cache_content_read_conf.c.

cache_content_status_t cache_content_rdwr ( cache_content_entry_t pentry,
cache_inode_io_direction_t  read_or_write,
uint64_t  offset,
size_t *  pio_size_in,
size_t *  pio_size_out,
void *  buffer,
fsal_boolean_t p_fsal_eof,
struct stat *  pbuffstat,
cache_content_client_t pclient,
fsal_op_context_t pcontext,
cache_content_status_t pstatus 
)

cache_content_rdwr: Reads/Writes through the cache layer.

Reads/Writes through the cache layer. This routine should be called only from the cache_inode layer.

No lock management is done in this layer: the related pentry in the cache inode layer is locked and will prevent from concurent accesses.

Parameters:
pentry[IN] entry in file content layer whose content is to be accessed.
read_or_write[IN] a flag of type cache_content_io_direction_t to tell if a read or write is to be done.
offset[IN] absolute position (in the FSAL file) where the IO will be done.
pio_size_in[IN] requested io size
pio_size_out[OUT] the size of the io that was successfully made.
pbuffstat[OUT] the 'stat' of entry in the data cache after the operation
bufferwrite:[IN] read:[OUT] the buffer for the data.
pclient[IN] ressource allocated by the client for the nfs management.
pcontext[IN] fsal credentials for the operation. [OUT] returned status.
Returns:
CACHE_CONTENT_SUCCESS is successful .

Definition at line 203 of file cache_content_rdwr.c.

cache_content_status_t cache_content_read_conf_client_parameter ( config_file_t  in_config,
cache_content_client_parameter_t pparam 
)

Todo:
: BUGAZOMEU: to be removed

Definition at line 77 of file cache_content_read_conf.c.

cache_content_status_t cache_content_read_conf_gc_policy ( config_file_t  in_config,
cache_content_gc_policy_t ppolicy 
)

cache_content_read_conf_gc_policy: read the garbage collection policy in configuration file.

Reads the garbage collection policy in configuration file.

Parameters:
in_config[IN] configuration file handle
pparam[OUT] read parameters
Returns:
CACHE_CONTENT_SUCCESS if ok, CACHE_CONTENT_NOT_FOUND is stanza is not there, CACHE_CONTENT_INVALID_ARGUMENT otherwise.

Definition at line 224 of file cache_content_read_conf.c.

off_t cache_content_recover_size ( char *  basepath,
u_int64_t  inum 
)

cache_content_recover_size: recovers the size of a data cached file.

Recovers the size of a data cached file.

Parameters:
basepath[IN] path to the root of the directory in the cache for the related export entry
inum[IN] inode number for the file whose size is to be recovered.
Returns:
the recovered size (as a off_t) or -1 is failed.

Definition at line 284 of file cache_content_misc.c.

cache_content_status_t cache_content_refresh ( cache_content_entry_t pentry,
cache_content_client_t pclient,
fsal_op_context_t pcontext,
cache_content_refresh_how_t  how,
cache_content_status_t pstatus 
)

cache_content_refresh: Refreshes the whole content of a file in the local cache to the FSAL data.

Refreshes the whole content of a file in the local cache to the FSAL data. This routine should be called only from the cache_inode layer.

No lock management is done in this layer: the related pentry in the cache inode layer is locked and will prevent from concurent accesses.

Parameters:
pentry[IN] entry in file content layer whose content is to be flushed.
pclient[IN] ressource allocated by the client for the nfs management. [OUT] returned status.
Returns:
CACHE_CONTENT_SUCCESS is successful .
Todo:
: BUGAZOMEU: gestion de coherence de date a mettre en place

Definition at line 193 of file cache_content_flush.c.

cache_content_status_t cache_content_release_entry ( cache_content_entry_t pentry,
cache_content_client_t pclient,
cache_content_status_t pstatus 
)

cache_content_release_entry: removes an entry from the cache and free the associated resources.

Removes an entry from the cache and free the associated resources.

No lock management is done in this layer: the related pentry in the cache inode layer is locked and will prevent from concurent accesses.

Parameters:
pentry[IN] entry in file content layer for this file.
pclient[IN] ressource allocated by the client for the nfs management. [OUT] returned status.
Returns:
CACHE_CONTENT_SUCCESS is successful, other values show an error.

Definition at line 78 of file cache_content_release_entry.c.

void cache_content_set_gc_policy ( cache_content_gc_policy_t  policy)

cache_content_set_gc_policy: Set the cache_content garbagge collecting policy.

Parameters:
policy[IN] policy to be set.
Returns:
nothing (void function)

Definition at line 79 of file cache_content_gc.c.

cache_content_status_t cache_content_sync_all ( cache_content_client_t pclient,
fsal_op_context_t pcontext,
cache_content_status_t pstatus 
)

Definition at line 296 of file cache_content_flush.c.

cache_content_status_t cache_content_test_cached ( cache_entry_t pentry_inode,
cache_content_client_t pclient,
fsal_op_context_t pcontext,
cache_content_status_t pstatus 
)

cache_content_test_cached: Tests if a given pentry_inode has already an associated data cache

Tests if a given pentry_inode has already an associated data cache. This is useful to recover data from a data cache built by a former server instance.

Parameters:
pentry_inode[IN] entry in cache_inode layer for this file.
pclient[IN] ressource allocated by the client for the nfs management.
pcontext[IN] the related FSAL Context [OUT] returned status.
Returns:
CACHE_CONTENT_SUCCESS if entry is found, CACHE_CONTENT_NOT_FOUND if not found

Definition at line 613 of file cache_content_misc.c.

cache_content_status_t cache_content_truncate ( cache_content_entry_t pentry,
fsal_size_t  length,
cache_content_client_t pclient,
cache_content_status_t pstatus 
)

Definition at line 60 of file cache_content_truncate.c.