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

cache_inode.h File Reference

Management of the cached inode layer. More...

#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <time.h>
#include <pthread.h>
#include "abstract_mem.h"
#include "HashData.h"
#include "HashTable.h"
#include "avltree.h"
#include "generic_weakref.h"
#include "fsal.h"
#include "log.h"
#include "config_parsing.h"
#include "nfs23.h"
#include "nfs4.h"
#include "nlm_list.h"

Go to the source code of this file.

Classes

struct  cache_inode_lru__
struct  cache_inode_parameter__
struct  cache_inode_opened_file__
struct  cache_inode_symlink__
struct  cache_inode_unstable_data__
struct  cache_inode_share__
struct  cache_inode_dir_entry__
struct  cache_entry_t
 Represents a cached inode. More...
union  cache_entry_t::cache_inode_fsobj__
struct  cache_entry_t::cache_inode_fsobj__::cache_inode_file__
struct  cache_entry_t::cache_inode_fsobj__::cache_inode_dir__
struct  cache_inode_fsal_data__
struct  cache_inode_gc_policy__
union  cache_inode_create_arg__

Defines

#define DIR_ENTRY_FLAG_NONE   0x0000
 Represents a cached directory entry.
#define DIR_ENTRY_FLAG_DELETED   0x0001

Typedefs

typedef struct cache_entry_t cache_entry_t
typedef enum
cache_inode_expire_type__ 
cache_inode_expire_type_t
typedef enum
cache_inode_stability__ 
cache_inode_stability_t
typedef struct cache_inode_lru__ cache_inode_lru_t
typedef struct
cache_inode_parameter__ 
cache_inode_parameter_t
typedef struct
cache_inode_opened_file__ 
cache_inode_opened_file_t
typedef enum
cache_inode_file_type__ 
cache_inode_file_type_t
typedef enum io_direction__ cache_inode_io_direction_t
typedef enum
cache_inode_dirent_op__ 
cache_inode_dirent_op_t
typedef enum
cache_inode_avl_which__ 
cache_inode_avl_which_t
typedef struct
cache_inode_unstable_data__ 
cache_inode_unstable_data_t
typedef struct cache_inode_share__ cache_inode_share_t
typedef struct
cache_inode_dir_entry__ 
cache_inode_dir_entry_t
typedef struct cache_inode_file__ cache_inode_file_t
typedef struct
cache_inode_symlink__ 
cache_inode_symlink_t
typedef union cache_inode_fsobj__ cache_inode_fsobj_t
typedef struct
cache_inode_fsal_data__ 
cache_inode_fsal_data_t
typedef struct
cache_inode_gc_policy__ 
cache_inode_gc_policy_t
typedef union
cache_inode_create_arg__ 
cache_inode_create_arg_t
typedef enum cache_inode_status_t cache_inode_status_t
typedef bool_t(* cache_inode_readdir_cb_t )(void *opaque, char *name, fsal_handle_t *handle, fsal_attrib_list_t *attrs, uint64_t cookie)
 Type of callback for cache_inode_readdir.

Enumerations

enum  cache_inode_expire_type__ { CACHE_INODE_EXPIRE = 0, CACHE_INODE_EXPIRE_NEVER = 1, CACHE_INODE_EXPIRE_IMMEDIATE = 2 }
enum  cache_inode_stability__ { CACHE_INODE_UNSAFE_WRITE_TO_FS_BUFFER = 0, CACHE_INODE_SAFE_WRITE_TO_FS = 1, CACHE_INODE_UNSAFE_WRITE_TO_GANESHA_BUFFER = 2 }
enum  cache_inode_file_type__ {
  UNASSIGNED = 1, REGULAR_FILE = 2, CHARACTER_FILE = 3, BLOCK_FILE = 4,
  SYMBOLIC_LINK = 5, SOCKET_FILE = 6, FIFO_FILE = 7, DIRECTORY = 8,
  FS_JUNCTION = 9, RECYCLED = 10
}
enum  io_direction__ { CACHE_INODE_READ = 1, CACHE_INODE_WRITE = 2 }
enum  cache_inode_dirent_op__ { CACHE_INODE_DIRENT_OP_LOOKUP = 1, CACHE_INODE_DIRENT_OP_REMOVE = 2, CACHE_INODE_DIRENT_OP_RENAME = 3 }
enum  cache_inode_avl_which__ { CACHE_INODE_AVL_NAMES = 1, CACHE_INODE_AVL_COOKIES = 2, CACHE_INODE_AVL_BOTH = 3 }
enum  cache_inode_status_t {
  CACHE_INODE_SUCCESS = 0, CACHE_INODE_MALLOC_ERROR = 1, CACHE_INODE_POOL_MUTEX_INIT_ERROR = 2, CACHE_INODE_GET_NEW_LRU_ENTRY = 3,
  CACHE_INODE_UNAPPROPRIATED_KEY = 4, CACHE_INODE_INIT_ENTRY_FAILED = 5, CACHE_INODE_FSAL_ERROR = 6, CACHE_INODE_LRU_ERROR = 7,
  CACHE_INODE_HASH_SET_ERROR = 8, CACHE_INODE_NOT_A_DIRECTORY = 9, CACHE_INODE_INCONSISTENT_ENTRY = 10, CACHE_INODE_BAD_TYPE = 11,
  CACHE_INODE_ENTRY_EXISTS = 12, CACHE_INODE_DIR_NOT_EMPTY = 13, CACHE_INODE_NOT_FOUND = 14, CACHE_INODE_INVALID_ARGUMENT = 15,
  CACHE_INODE_INSERT_ERROR = 16, CACHE_INODE_HASH_TABLE_ERROR = 17, CACHE_INODE_FSAL_EACCESS = 18, CACHE_INODE_IS_A_DIRECTORY = 19,
  CACHE_INODE_FSAL_EPERM = 20, CACHE_INODE_NO_SPACE_LEFT = 21, CACHE_INODE_CACHE_CONTENT_ERROR = 22, CACHE_INODE_CACHE_CONTENT_EXISTS = 23,
  CACHE_INODE_CACHE_CONTENT_EMPTY = 24, CACHE_INODE_READ_ONLY_FS = 25, CACHE_INODE_IO_ERROR = 26, CACHE_INODE_FSAL_ESTALE = 27,
  CACHE_INODE_FSAL_ERR_SEC = 28, CACHE_INODE_STATE_CONFLICT = 29, CACHE_INODE_QUOTA_EXCEEDED = 30, CACHE_INODE_DEAD_ENTRY = 31,
  CACHE_INODE_ASYNC_POST_ERROR = 32, CACHE_INODE_NOT_SUPPORTED = 33, CACHE_INODE_STATE_ERROR = 34, CACHE_INODE_DELAY = 35,
  CACHE_INODE_NAME_TOO_LONG = 36, CACHE_INODE_BAD_COOKIE = 40, CACHE_INODE_FILE_BIG = 41, CACHE_INODE_KILLED = 42,
  CACHE_INODE_FILE_OPEN = 43
}

Functions

const char * cache_inode_err_str (cache_inode_status_t err)
void cache_inode_clean_entry (cache_entry_t *entry)
 Final cleaning of an entry.
int cache_inode_compare_key_fsal (hash_buffer_t *buff1, hash_buffer_t *buff2)
 Compares two keys used in cache inode.
void cache_inode_release_symlink (cache_entry_t *entry)
 Release symlink content.
hash_table_tcache_inode_init (cache_inode_parameter_t param, cache_inode_status_t *status)
 Initialize the caching layer.
cache_entry_tcache_inode_get (cache_inode_fsal_data_t *fsdata, fsal_attrib_list_t *attr, fsal_op_context_t *context, cache_entry_t *associated, cache_inode_status_t *status)
 Gets an entry by using its fsdata as a key and caches it if needed.
void cache_inode_put (cache_entry_t *entry)
cache_inode_status_t cache_inode_access_sw (cache_entry_t *entry, fsal_accessflags_t access_type, fsal_op_context_t *context, cache_inode_status_t *status, bool_t use_mutex)
cache_inode_status_t cache_inode_access_no_mutex (cache_entry_t *entry, fsal_accessflags_t access_type, fsal_op_context_t *context, cache_inode_status_t *status)
 Checks entry permissions without taking a lock.
cache_inode_status_t cache_inode_access (cache_entry_t *entry, fsal_accessflags_t access_type, fsal_op_context_t *context, cache_inode_status_t *status)
 Checks permissions on an entry.
fsal_file_tcache_inode_fd (cache_entry_t *entry)
 Returns a file descriptor, if open.
bool_t is_open_for_read (cache_entry_t *entry)
 Check if a file is available to read.
bool_t is_open_for_write (cache_entry_t *entry)
 Check if a file is available to write.
cache_inode_status_t cache_inode_open (cache_entry_t *entry, fsal_openflags_t openflags, fsal_op_context_t *context, uint32_t flags, cache_inode_status_t *status)
 Opens a file descriptor.
cache_inode_status_t cache_inode_close (cache_entry_t *entry, uint32_t flags, cache_inode_status_t *status)
 Close a file.
cache_entry_tcache_inode_create (cache_entry_t *entry_parent, fsal_name_t *name, cache_inode_file_type_t type, fsal_accessmode_t mode, cache_inode_create_arg_t *create_arg, fsal_attrib_list_t *attr, fsal_op_context_t *context, cache_inode_status_t *status)
 Creates an object in a directory.
cache_inode_status_t cache_inode_getattr (cache_entry_t *entry, fsal_attrib_list_t *attr, fsal_op_context_t *context, cache_inode_status_t *status)
 Gets the attributes for a cached entry.
cache_entry_tcache_inode_lookup_impl (cache_entry_t *entry_parent, fsal_name_t *name, fsal_op_context_t *context, cache_inode_status_t *status)
 Do the work of looking up a name in a directory.
cache_entry_tcache_inode_lookup (cache_entry_t *entry_parent, fsal_name_t *name, fsal_attrib_list_t *attr, fsal_op_context_t *context, cache_inode_status_t *status)
 Public function for looking up a name in a directory.
cache_entry_tcache_inode_lookupp_impl (cache_entry_t *entry, fsal_op_context_t *context, cache_inode_status_t *status)
 Implements parent lookup functionality.
cache_entry_tcache_inode_lookupp (cache_entry_t *entry, fsal_op_context_t *context, cache_inode_status_t *status)
 Public function to look up a directory's parent.
cache_inode_status_t cache_inode_readlink (cache_entry_t *entry, fsal_path_t *link_content, fsal_op_context_t *context, cache_inode_status_t *status)
 Read the target of a symlink.
cache_inode_status_t cache_inode_link (cache_entry_t *entry_src, cache_entry_t *entry_dir_dest, fsal_name_t *link_name, fsal_attrib_list_t *attr, fsal_op_context_t *context, cache_inode_status_t *status)
 Links a new name to a file.
cache_inode_status_t cache_inode_remove (cache_entry_t *entry, fsal_name_t *node_name, fsal_attrib_list_t *attr, fsal_op_context_t *context, cache_inode_status_t *status)
 Public function to remove a name from a directory.
cache_inode_status_t cache_inode_remove_impl (cache_entry_t *entry, fsal_name_t *name, fsal_op_context_t *context, cache_inode_status_t *status, uint32_t flags)
 Implement actual work of removing file.
cache_inode_status_t cache_inode_clean_internal (cache_entry_t *to_remove_entry)
 Clean resources associated with entry.
cache_inode_status_t cache_inode_operate_cached_dirent (cache_entry_t *entry_parent, fsal_name_t *name, fsal_name_t *newname, cache_inode_dirent_op_t dirent_op)
 Perform an operation on it on a cached entry.
cache_inode_status_t cache_inode_remove_cached_dirent (cache_entry_t *entry_parent, fsal_name_t *name, cache_inode_status_t *status)
 Removes an entry from a cached directory.
cache_inode_status_t cache_inode_rename_cached_dirent (cache_entry_t *entry_parent, fsal_name_t *oldname, fsal_name_t *newname, cache_inode_status_t *status)
 Renames an entry in the same directory.
cache_inode_status_t cache_inode_rename (cache_entry_t *entry, fsal_name_t *oldname, cache_entry_t *entry_dirdest, fsal_name_t *newname, fsal_attrib_list_t *attr_src, fsal_attrib_list_t *attr_dst, fsal_op_context_t *context, cache_inode_status_t *status)
 Renames an entry.
cache_inode_status_t cache_inode_setattr (cache_entry_t *entry, fsal_attrib_list_t *attr, fsal_op_context_t *context, cache_inode_status_t *status)
 Set the attributes for a file.
cache_inode_status_t cache_inode_truncate_impl (cache_entry_t *entry, fsal_size_t length, fsal_attrib_list_t *attr, fsal_op_context_t *context, cache_inode_status_t *status)
 truncates a regular file
cache_inode_status_t cache_inode_truncate (cache_entry_t *entry, fsal_size_t length, fsal_attrib_list_t *attr, fsal_op_context_t *context, cache_inode_status_t *status)
 Truncates a regular file specified by its cache entry.
cache_inode_status_t cache_inode_error_convert (fsal_status_t fsal_status)
 Converts an FSAL error to the corresponding cache_inode error.
cache_entry_tcache_inode_new_entry (cache_inode_fsal_data_t *fsdata, fsal_attrib_list_t *attr, cache_inode_file_type_t type, cache_inode_create_arg_t *create_arg, cache_inode_status_t *status)
 Adds a new entry to the cache.
cache_inode_status_t cache_inode_add_data_cache (cache_entry_t *entry, fsal_op_context_t *context, cache_inode_status_t *status)
cache_inode_status_t cache_inode_release_data_cache (cache_entry_t *entry, fsal_op_context_t *context, cache_inode_status_t *status)
cache_inode_status_t cache_inode_rdwr (cache_entry_t *entry, cache_inode_io_direction_t io_direction, uint64_t offset, size_t io_size, size_t *bytes_moved, void *buffer, bool_t *eof, fsal_op_context_t *context, cache_inode_stability_t stable, cache_inode_status_t *status)
 Reads/Writes through the cache layer.
cache_inode_status_t cache_inode_commit (cache_entry_t *entry, uint64_t offset, size_t count, cache_inode_stability_t stability, fsal_op_context_t *context, cache_inode_status_t *status)
 Commits a write operation to stable storage.
cache_inode_status_t cache_inode_readdir_populate (cache_entry_t *directory, fsal_op_context_t *context, cache_inode_status_t *status)
 Cache complete directory contents.
cache_inode_status_t cache_inode_readdir (cache_entry_t *directory, uint64_t cookie, unsigned int *nbfound, bool_t *eod_met, fsal_op_context_t *context, cache_inode_readdir_cb_t cb, void *cb_opaque, cache_inode_status_t *status)
 Reads a directory.
cache_inode_status_t cache_inode_add_cached_dirent (cache_entry_t *parent, fsal_name_t *name, cache_entry_t *entry, cache_inode_dir_entry_t **dir_entry, cache_inode_status_t *status)
 Adds a directory entry to a cached directory.
cache_entry_tcache_inode_make_root (cache_inode_fsal_data_t *fsdata, fsal_op_context_t *context, cache_inode_status_t *status)
 Inserts the root of a FS in the cache.
cache_inode_status_t cache_inode_check_trust (cache_entry_t *entry, fsal_op_context_t *context)
 Conditionally refresh attributes.
cache_inode_file_type_t cache_inode_fsal_type_convert (fsal_nodetype_t type)
 converts an FSAL type to the corresponding cache_inode type
int cache_inode_types_are_rename_compatible (cache_entry_t *src, cache_entry_t *dest)
 Test if an entry can be overwritten during a rename.
void cache_inode_print_dir (cache_entry_t *cache_entry_root)
 Prints the content of a directory.
cache_inode_status_t cache_inode_statfs (cache_entry_t *entry, fsal_dynamicfsinfo_t *dynamicinfo, fsal_op_context_t *context, cache_inode_status_t *status)
cache_inode_status_t cache_inode_is_dir_empty (cache_entry_t *entry)
 Checks if a directory is empty without a lock.
cache_inode_status_t cache_inode_is_dir_empty_WithLock (cache_entry_t *entry)
 Checks if a directory is empty, acquiring lock.
cache_inode_status_t cache_inode_invalidate_all_cached_dirent (cache_entry_t *entry, cache_inode_status_t *status)
 Invalidates all cached entries for a directory.
void cache_inode_release_dirents (cache_entry_t *entry, cache_inode_avl_which_t which)
 Release cached directory content.
void cache_inode_kill_entry (cache_entry_t *entry)
 Some routines for management of the cache_inode layer, shared by other calls.
cache_inode_status_t cache_inode_invalidate (cache_inode_fsal_data_t *fsal_data, cache_inode_status_t *status, uint32_t flags)
 invalidates an entry in the cache
cache_inode_status_t cache_inode_read_conf_hash_parameter (config_file_t in_config, cache_inode_parameter_t *pparam)
 Read the configuration for the Cache_inode hash table.
cache_inode_status_t cache_inode_read_conf_parameter (config_file_t in_config, cache_inode_parameter_t *pparam)
 Read the configuration for the Cache inode layer.
cache_inode_status_t cache_inode_read_conf_gc_policy (config_file_t in_config, cache_inode_gc_policy_t *ppolicy)
 Read the garbage collection policy.
void cache_inode_print_conf_hash_parameter (FILE *output, cache_inode_parameter_t *param)
 Prints the garbage collection policy.
void cache_inode_print_conf_parameter (FILE *output, cache_inode_parameter_t *param)
 Prints cache inode configuration.
void cache_inode_print_conf_gc_policy (FILE *output, cache_inode_gc_policy_t *gcpolicy)
 Prints the garbage collection policy.
void cache_inode_expire_to_str (cache_inode_expire_type_t type, time_t value, char *out)
bool_t cache_inode_file_holds_state (cache_entry_t *entry)
 Return true if a file holds state.
int cache_inode_set_time_current (fsal_time_t *ptime)
 Set the fsal_time in a pentry struct to the current time.
uint32_t cache_inode_fsal_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint64_t cache_inode_fsal_rbt_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
int cache_inode_fsal_rbt_both (hash_parameter_t *p_hparam, hash_buffer_t *buffclef, uint32_t *phashval, uint64_t *prbtval)
int display_key (hash_buffer_t *pbuff, char *str)
int display_not_implemented (hash_buffer_t *pbuff, char *str)
int display_value (hash_buffer_t *pbuff, char *str)

Variables

hash_table_tfh_to_cache_entry_ht
cache_inode_parameter_t cache_inode_params
pool_tcache_inode_entry_pool
pool_tcache_inode_symlink_pool
pool_tcache_inode_dir_entry_pool
cache_inode_gc_policy_t cache_inode_gc_policy

Detailed Description

Management of the cached inode layer.

Management of the cached inode layer

Definition in file cache_inode.h.


Define Documentation

#define DIR_ENTRY_FLAG_DELETED   0x0001

Definition at line 275 of file cache_inode.h.

#define DIR_ENTRY_FLAG_NONE   0x0000

Represents a cached directory entry.

This is a cached directory entry that associates a name and cookie with a cache entry.

Definition at line 274 of file cache_inode.h.


Typedef Documentation

typedef struct cache_entry_t cache_entry_t

Definition at line 69 of file cache_inode.h.

Type-specific data passed to cache_inode_new_entry

Passed to cache_inode_operate_cached_dirent to indicate the operation being requested.

Constants to determine whether inode data, such as attributes, expire.

typedef struct cache_inode_file__ cache_inode_file_t

Definition at line 407 of file cache_inode.h.

Enumeration of all cache_entry types known by cache_inode.

Data to be used as the key into the cache_entry hash table.

typedef union cache_inode_fsobj__ cache_inode_fsobj_t

Definition at line 409 of file cache_inode.h.

Configuration parameters for garbage collection/LRU policy

Indicate whether this is a read or write operation, for cache_inode_rdwr.

Data for tracking a cache entry's position the LRU.

Representation of an open file associated with a cache_entry.

Structure to hold cache_inode paramaters

typedef bool_t(* cache_inode_readdir_cb_t)(void *opaque, char *name, fsal_handle_t *handle, fsal_attrib_list_t *attrs, uint64_t cookie)

Type of callback for cache_inode_readdir.

This callback provides the upper level protocol handling function with one directory entry at a time. It may use the opaque to keep track of the structure it is filling, space used, and so forth.

This function should return TRUE if the entry has been added to the caller's responde, or FALSE if the structure is fulled and the structure has not been added.

Definition at line 596 of file cache_inode.h.

The reference counted share reservation state.

Values to control the stability

Definition at line 408 of file cache_inode.h.

Bookkeeping information for unstably written data held in Ganesha's write buffer.


Enumeration Type Documentation

Enumerator:
CACHE_INODE_AVL_NAMES 
CACHE_INODE_AVL_COOKIES 
CACHE_INODE_AVL_BOTH 

Definition at line 206 of file cache_inode.h.

Passed to cache_inode_operate_cached_dirent to indicate the operation being requested.

Enumerator:
CACHE_INODE_DIRENT_OP_LOOKUP 
CACHE_INODE_DIRENT_OP_REMOVE 
CACHE_INODE_DIRENT_OP_RENAME 

Definition at line 199 of file cache_inode.h.

Constants to determine whether inode data, such as attributes, expire.

Enumerator:
CACHE_INODE_EXPIRE 
CACHE_INODE_EXPIRE_NEVER 
CACHE_INODE_EXPIRE_IMMEDIATE 

Definition at line 83 of file cache_inode.h.

Enumeration of all cache_entry types known by cache_inode.

Enumerator:
UNASSIGNED 
REGULAR_FILE 
CHARACTER_FILE 
BLOCK_FILE 
SYMBOLIC_LINK 
SOCKET_FILE 
FIFO_FILE 
DIRECTORY 
FS_JUNCTION 
RECYCLED 

Definition at line 168 of file cache_inode.h.

Values to control the stability

Enumerator:
CACHE_INODE_UNSAFE_WRITE_TO_FS_BUFFER 
CACHE_INODE_SAFE_WRITE_TO_FS 
CACHE_INODE_UNSAFE_WRITE_TO_GANESHA_BUFFER 

Definition at line 97 of file cache_inode.h.

Enumerator:
CACHE_INODE_SUCCESS 
CACHE_INODE_MALLOC_ERROR 
CACHE_INODE_POOL_MUTEX_INIT_ERROR 
CACHE_INODE_GET_NEW_LRU_ENTRY 
CACHE_INODE_UNAPPROPRIATED_KEY 
CACHE_INODE_INIT_ENTRY_FAILED 
CACHE_INODE_FSAL_ERROR 
CACHE_INODE_LRU_ERROR 
CACHE_INODE_HASH_SET_ERROR 
CACHE_INODE_NOT_A_DIRECTORY 
CACHE_INODE_INCONSISTENT_ENTRY 
CACHE_INODE_BAD_TYPE 
CACHE_INODE_ENTRY_EXISTS 
CACHE_INODE_DIR_NOT_EMPTY 
CACHE_INODE_NOT_FOUND 
CACHE_INODE_INVALID_ARGUMENT 
CACHE_INODE_INSERT_ERROR 
CACHE_INODE_HASH_TABLE_ERROR 
CACHE_INODE_FSAL_EACCESS 
CACHE_INODE_IS_A_DIRECTORY 
CACHE_INODE_FSAL_EPERM 
CACHE_INODE_NO_SPACE_LEFT 
CACHE_INODE_CACHE_CONTENT_ERROR 
CACHE_INODE_CACHE_CONTENT_EXISTS 
CACHE_INODE_CACHE_CONTENT_EMPTY 
CACHE_INODE_READ_ONLY_FS 
CACHE_INODE_IO_ERROR 
CACHE_INODE_FSAL_ESTALE 
CACHE_INODE_FSAL_ERR_SEC 
CACHE_INODE_STATE_CONFLICT 
CACHE_INODE_QUOTA_EXCEEDED 
CACHE_INODE_DEAD_ENTRY 
CACHE_INODE_ASYNC_POST_ERROR 
CACHE_INODE_NOT_SUPPORTED 
CACHE_INODE_STATE_ERROR 
CACHE_INODE_DELAY 
CACHE_INODE_NAME_TOO_LONG 
CACHE_INODE_BAD_COOKIE 
CACHE_INODE_FILE_BIG 
CACHE_INODE_KILLED 
CACHE_INODE_FILE_OPEN 

Definition at line 539 of file cache_inode.h.

Indicate whether this is a read or write operation, for cache_inode_rdwr.

Enumerator:
CACHE_INODE_READ 
CACHE_INODE_WRITE 

Definition at line 188 of file cache_inode.h.


Function Documentation

cache_inode_status_t cache_inode_access ( cache_entry_t entry,
fsal_accessflags_t  access_type,
fsal_op_context_t context,
cache_inode_status_t status 
)

Checks permissions on an entry.

This function acquires the attribute lock on the supplied cach entry then checks if the supplied credentials are sufficient to gain the supplied access.

Parameters:
[in]entryThe object to be checked
[in]access_typeThe kind of access to be checked
[in]contextFSAL credentials
[in]statusReturned status
Returns:
CACHE_INODE_SUCCESS if operation is a success

Definition at line 191 of file cache_inode_access.c.

cache_inode_status_t cache_inode_access_no_mutex ( cache_entry_t entry,
fsal_accessflags_t  access_type,
fsal_op_context_t context,
cache_inode_status_t status 
)

Checks entry permissions without taking a lock.

This function checks whether the specified permissions are available on the object. This function may only be called if an attribute lock is held.

Parameters:
[in]entryentry pointer for the fs object to be checked.
[in]access_typeThe kind of access to be checked
[in]contextFSAL credentials
[out]statusReturned status
Returns:
CACHE_INODE_SUCCESS if operation is a success

Definition at line 166 of file cache_inode_access.c.

cache_inode_status_t cache_inode_access_sw ( cache_entry_t entry,
fsal_accessflags_t  access_type,
fsal_op_context_t context,
cache_inode_status_t status,
bool_t  use_mutex 
)
cache_inode_status_t cache_inode_add_cached_dirent ( cache_entry_t parent,
fsal_name_t name,
cache_entry_t entry,
cache_inode_dir_entry_t **  dir_entry,
cache_inode_status_t status 
)

Adds a directory entry to a cached directory.

This function adds a new directory entry to a directory. Directory entries have only weak references, so they do not prevent recycling or freeing the entry they locate. This function may be called either once (for handling creation) or iteratively in directory population.

Parameters:
[in,out]parentCache entry of the directory being updated
[in]nameThe name to add to the entry
[in]entryThe cache entry associated with name
[out]dir_entryThe directory entry newly added (optional)
[out]statusSame as return value
Returns:
CACHE_INODE_SUCCESS or errors on failure.

Definition at line 260 of file cache_inode_readdir.c.

cache_inode_status_t cache_inode_add_data_cache ( cache_entry_t entry,
fsal_op_context_t context,
cache_inode_status_t status 
)
cache_inode_status_t cache_inode_check_trust ( cache_entry_t entry,
fsal_op_context_t context 
)

Conditionally refresh attributes.

This function tests whether we should still trust the current attributes and, if not, refresh them.

Parameters:
[in]entryThe entry to refresh
[in]contextFSAL credentials
Returns:
CACHE_INODE_SUCCESS or other status codes.

Definition at line 929 of file cache_inode_misc.c.

void cache_inode_clean_entry ( cache_entry_t entry)

Final cleaning of an entry.

This function performs final cleanup of an entry before recycling or free.

Parameters:
[in]entryThe entry to be cleaned

Definition at line 547 of file cache_inode_misc.c.

cache_inode_status_t cache_inode_clean_internal ( cache_entry_t entry)

Clean resources associated with entry.

This function frees the various resources associated wiith a cache entry.

Parameters:
[in]entryEntry to be cleaned
Returns:
CACHE_INODE_SUCCESS or various errors

Definition at line 106 of file cache_inode_remove.c.

cache_inode_status_t cache_inode_close ( cache_entry_t entry,
uint32_t  flags,
cache_inode_status_t status 
)

Close a file.

This function calls down to the FSAL to close the file.

Parameters:
[in]entryCache entry to close
[in]flagsFlags for lock management
[out]statusOperation status
Returns:
CACHE_INODE_SUCCESS or errors on failure

Definition at line 261 of file cache_inode_open_close.c.

cache_inode_status_t cache_inode_commit ( cache_entry_t entry,
uint64_t  offset,
size_t  count,
cache_inode_stability_t  stability,
fsal_op_context_t context,
cache_inode_status_t status 
)

Commits a write operation to stable storage.

This function commits writes from unstable to stable storage.

Parameters:
[in]entryFile whose data should be committed
[in]offsetStart of region to commit
[in]countNumber of bytes to commit
[in]typeofcommitWhat type of commit operation this is
[in]contextFSAL credentials
[out]statusOperation status
Returns:
CACHE_INODE_SUCCESS or various errors

Definition at line 77 of file cache_inode_commit.c.

int cache_inode_compare_key_fsal ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

Compares two keys used in cache inode.

Compare two keys used in cache inode. These keys are basically made from FSAL related information.

Parameters:
[in]buff1First key
[in]buff2Second key
Returns:
0 if keys are the same, 1 otherwise
See also:
FSAL_handlecmp

Definition at line 171 of file cache_inode_misc.c.

cache_entry_t* cache_inode_create ( cache_entry_t parent,
fsal_name_t name,
cache_inode_file_type_t  type,
fsal_accessmode_t  mode,
cache_inode_create_arg_t create_arg,
fsal_attrib_list_t attr,
fsal_op_context_t context,
cache_inode_status_t status 
)

Creates an object in a directory.

This function creates an entry in the cache and underlying filesystem. If an entry is returned, its refcount charged to the call path is +1.

Parameters:
[in]parentParent directory
[in]nameName of the object to create
[in]typeType of the object to create
[in]modeMode to be used at file creation
[in]create_argAdditional argument for object creation
[out]attrAttributes of the new object
[in]contextFSAL credentials
[out]statusReturned status
Returns:
Cache entry for the file created

Definition at line 80 of file cache_inode_create.c.

const char* cache_inode_err_str ( cache_inode_status_t  err)

Definition at line 67 of file cache_inode_misc.c.

cache_inode_status_t cache_inode_error_convert ( fsal_status_t  fsal_status)

Converts an FSAL error to the corresponding cache_inode error.

This function converts an FSAL error to the corresponding cache_inode error.

Parameters:
[in]fsal_statusFSAL error to be converted
Returns:
the result of the conversion.

Definition at line 567 of file cache_inode_misc.c.

void cache_inode_expire_to_str ( cache_inode_expire_type_t  type,
time_t  value,
char *  out 
)

Definition at line 179 of file cache_inode_read_conf.c.

fsal_file_t* cache_inode_fd ( cache_entry_t entry)

Returns a file descriptor, if open.

This function returns the file descriptor stored in a cache entry, if the cached file is open.

Parameters:
[in]entryEntry for the file on which to operate
Returns:
A pointer to a file descriptor or NULL if the entry is closed.

Definition at line 73 of file cache_inode_open_close.c.

bool_t cache_inode_file_holds_state ( cache_entry_t entry) [inline]

Return true if a file holds state.

This function returns true if state is held on the file. The state lock must be held for read when calling this function.

Parameters:
[in]entryThe file to be checked
Returns:
TRUE if state is held, FALSE otherwise.

Definition at line 908 of file cache_inode_misc.c.

uint32_t cache_inode_fsal_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

cache_inode_fsal_hash_func: Compute the hash value for the cache_inode hash table.

Computes the hash value for the cache_inode hash table. This function is specific to use with HPSS/FSAL.

Parameters:
hparam[IN] hash table parameter.
buffclef[IN] key to be used for computing the hash value.
Returns:
the computed hash value.

Definition at line 65 of file cache_inode_fsal_hash.c.

int cache_inode_fsal_rbt_both ( hash_parameter_t p_hparam,
hash_buffer_t buffclef,
uint32_t phashval,
uint64_t prbtval 
)

Definition at line 237 of file cache_inode_fsal_hash.c.

uint64_t cache_inode_fsal_rbt_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

cache_inode_fsal_rbt_func: Compute the rbt value for the cache_inode hash table.

Computes the rbt value for the cache_inode hash table. This function is specific to use with HPSS/FSAL.

Parameters:
hparam[IN] hash table parameter.
buffclef[IN] key to be used for computing the hash value.
Returns:
the computed rbt value.

Definition at line 99 of file cache_inode_fsal_hash.c.

cache_inode_file_type_t cache_inode_fsal_type_convert ( fsal_nodetype_t  type)

converts an FSAL type to the corresponding cache_inode type

This function converts an FSAL type to the corresponding cache_inode type.

Parameters:
[in]typeThe input FSAL type
Returns:
the cache_inode type

Definition at line 689 of file cache_inode_misc.c.

cache_entry_t* cache_inode_get ( cache_inode_fsal_data_t fsdata,
fsal_attrib_list_t attr,
fsal_op_context_t context,
cache_entry_t associated,
cache_inode_status_t status 
)

Gets an entry by using its fsdata as a key and caches it if needed.

Gets an entry by using its fsdata as a key and caches it if needed.

If a cache entry is returned, its refcount is incremented by one.

It turns out we do need cache_inode_get_located functionality for cases like lookupp on an entry returning itself when it isn't a root. Therefore, if the 'associated' parameter is equal to the got cache entry, a reference count is incremented but the structure pointed to by attr is NOT filled in.

Parameters:
[in]fsdataFile system data
[out]attrThe attributes of the got entry
[in]contextFSAL credentials
[in]associatedEntry that may be equal to the got entry
[out]statusReturned status
Returns:
If successful, the pointer to the entry; NULL otherwise

Definition at line 84 of file cache_inode_get.c.

cache_inode_status_t cache_inode_getattr ( cache_entry_t entry,
fsal_attrib_list_t attr,
fsal_op_context_t context,
cache_inode_status_t status 
)

Gets the attributes for a cached entry.

Gets the attributes for a cached entry. The FSAL attributes are kept in a structure when the entry is added to the cache. Currently this structure is copied out to the caller after possibly being reloaded from the FSAL.

Parameters:
[in]entryEntry to be managed.
[out]attrPointer to the results
[in]contextFSAL credentials
[out]statusReturned status
Return values:
CACHE_INODE_SUCCESSif operation is a success

Definition at line 76 of file cache_inode_getattr.c.

hash_table_t* cache_inode_init ( cache_inode_parameter_t  param,
cache_inode_status_t status 
)

Initialize the caching layer.

This function initializes the memory pools, hash table, and weakref table used for cache management.

Parameters:
[in]paramThe parameters for this cache
[out]statusOperation status
Returns:
NULL if operation failed, other value is a pointer to the hash table used for the cache.

Definition at line 73 of file cache_inode_init.c.

cache_inode_status_t cache_inode_invalidate ( cache_inode_fsal_data_t fsal_data,
cache_inode_status_t status,
uint32_t  flags 
)

invalidates an entry in the cache

This function invalidates the related cache entry correponding to a FSAL handle. It is designed to be called when an FSAL upcall is triggered.

Parameters:
[in]handleFSAL handle for the entry to be invalidated
[out]statusReturned status
Return values:
CACHE_INODE_SUCCESSif operation is a success
CACHE_INODE_INVALID_ARGUMENTbad parameter(s) as input
CACHE_INODE_NOT_FOUNDif entry is not cached
CACHE_INODE_STATE_CONFLICTif invalidating this entry would result is state conflict
CACHE_INODE_INCONSISTENT_ENTRYif entry is not consistent
Othererrors shows a FSAL error.

Definition at line 75 of file cache_inode_invalidate.c.

cache_inode_status_t cache_inode_invalidate_all_cached_dirent ( cache_entry_t entry,
cache_inode_status_t status 
)

Invalidates all cached entries for a directory.

Invalidates all the entries for a cached directory. The content lock must be held when this function is called.

Parameters:
[in,out]entryThe directory to be managed
[out]statusReturned status.
Returns:
the same as *status

Definition at line 76 of file cache_inode_readdir.c.

cache_inode_status_t cache_inode_is_dir_empty ( cache_entry_t entry)

Checks if a directory is empty without a lock.

This function checks if the supplied directory is empty. The caller must hold the content lock.

Parameters:
[in]entryEntry to be checked (should be of type DIRECTORY)
Return values:
CACHE_INODE_SUCCESSis directory is empty
CACHE_INODE_BAD_TYPEis pentry is not of type DIRECTORY
CACHE_INODE_DIR_NOT_EMPTYif pentry is not empty

Definition at line 51 of file cache_inode_remove.c.

cache_inode_status_t cache_inode_is_dir_empty_WithLock ( cache_entry_t entry)

Checks if a directory is empty, acquiring lock.

This function checks if the supplied cache entry represents an empty directory. This function acquires the content lock, which must not be held by the caller.

Parameters:
[in]entryEntry to be checked (should be of type DIRECTORY)
Return values:
CACHE_INODE_SUCCESSis directory is empty
CACHE_INODE_BAD_TYPEis pentry is not of type DIRECTORY
CACHE_INODE_DIR_NOT_EMPTYif pentry is not empty

Definition at line 84 of file cache_inode_remove.c.

void cache_inode_kill_entry ( cache_entry_t entry)

Some routines for management of the cache_inode layer, shared by other calls.

cache_inode_kill_entry.c

Author:
Author:
deniel
Date:
Date:
2006/01/05 15:14:51
Version:
Revision:
1.63

Some routines for management of the cache_inode layer, shared by other calls.

Forcibly remove an entry from the cache

This function removes an entry from the cache immediately when it has become unusable (for example, when the FSAL declares it to be stale.) This function removes only one reference. The caller must also un-reference any reference it holds above the sentinel. This function does not touch locks. Since the entry isn't actually removed until the refcount falls to 0, we just let the caller remove locks as for any error.

Parameters:
[in]entryThe entry to be killed

Definition at line 82 of file cache_inode_kill_entry.c.

cache_inode_status_t cache_inode_link ( cache_entry_t entry,
cache_entry_t dest_dir,
fsal_name_t name,
fsal_attrib_list_t attr,
fsal_op_context_t context,
cache_inode_status_t status 
)

Links a new name to a file.

This function hard links a new name to an existing file.

Parameters:
[in]entryThe file to which to add the new name. Must not be a directory.
[in]dest_dirThe directory in which to create the new name
[in]nameThe new name to add to the file
[out]attrThe attributes on entry after the operation
[in]contextFSAL credentials
[out]statusreturned status.
Return values:
CACHE_INODE_SUCCESSif operation is a success
CACHE_INODE_BAD_TYPEeither source or destination have incorrect type
CACHE_INODE_ENTRY_EXISTSentry of that name already exists in destination.

Definition at line 80 of file cache_inode_link.c.

cache_entry_t* cache_inode_lookup ( cache_entry_t parent,
fsal_name_t name,
fsal_attrib_list_t attr,
fsal_op_context_t context,
cache_inode_status_t status 
)

Public function for looking up a name in a directory.

Looks up for a name in a directory indicated by a cached entry. The directory should have been cached before.

If a cache entry is returned, the refcount on entry is +1.

Parameters:
[in]parentEntry for the parent directory to be managed.
[in]nameName of the entry that we are looking up.
[out]attrAttributes of the found entry.
[in]contextFSAL credentials
[out]pstatusReturned status
Returns:
The found entry or NUL.

Definition at line 281 of file cache_inode_lookup.c.

cache_entry_t* cache_inode_lookup_impl ( cache_entry_t parent,
fsal_name_t name,
fsal_op_context_t context,
cache_inode_status_t status 
)

Do the work of looking up a name in a directory.

This function looks up a filename in the given directory. It implements the functionality of cache_inode_lookup and expects the directory to be read-locked when it is called. If a lookup from cache fails, it will drop the read lock and acquire a write lock before proceeding. The caller is responsible for freeing the lock on the directory in any case.

If a cache entry is returned, its refcount is incremented by 1.

Parameters:
[in]parentThe directory to search
[in]nameThe name to be looked up
[in]contextFSAL credentials
[out]statusReturned status
Returns:
The cache entry corresponding to name or NULL on error.

Definition at line 86 of file cache_inode_lookup.c.

cache_entry_t* cache_inode_lookupp ( cache_entry_t entry,
fsal_op_context_t context,
cache_inode_status_t status 
)

Public function to look up a directory's parent.

This function looks up (and potentially caches) the parent of a directory.

If a cache entry is returned, its refcount is +1.

Parameters:
[in]entryEntry whose parent is to be obtained.
[in]contextFSAL credentials
[out]statusReturned status
Returns:
the found entry or NULL on error.

Definition at line 183 of file cache_inode_lookupp.c.

cache_entry_t* cache_inode_lookupp_impl ( cache_entry_t entry,
fsal_op_context_t context,
cache_inode_status_t status 
)

Implements parent lookup functionality.

Looks up (and caches) the parent directory for a directory. If an entry is returned, that entry's refcount is incremented by one. The caller must hold a reference on the entry. It is expected that the caller holds the directory lock on entry. It is also expected that the caller will relinquish the directory lock after return. If result was not cached, the function will drop the read lock and acquire a write lock so it can add the result to the cache.

Parameters:
[in]entryEntry whose parent is to be obtained
[in]contextFSAL operation context
[out]statusReturned status
Returns:
the found entry or NULL on error.

Definition at line 81 of file cache_inode_lookupp.c.

cache_entry_t* cache_inode_make_root ( cache_inode_fsal_data_t fsdata,
fsal_op_context_t context,
cache_inode_status_t status 
)

Inserts the root of a FS in the cache.

This ensures that the directory specified by fsdata is in the cache and marks it as an export root.

Parameters:
[in]fsdataHandle for the root
[in]contextFSAL credentials. Unused here
[out]statusReturned status
Returns:
the newly created cache entry.

Definition at line 72 of file cache_inode_make_root.c.

cache_entry_t* cache_inode_new_entry ( cache_inode_fsal_data_t fsdata,
fsal_attrib_list_t attr,
cache_inode_file_type_t  type,
cache_inode_create_arg_t create_arg,
cache_inode_status_t status 
)

Adds a new entry to the cache.

This funcion adds a new entry to the cache. It will allocate entries of any kind.

Parameters:
[in]fsdataFSAL data for the entry to be created
[in]attrAttributes to be stored in the cache entry (must not be NULL)
[in]typeType of entry to create
[in]create_argType specific creation data
[out]statusReturned status
Returns:
the new entry or NULL on error.

Definition at line 246 of file cache_inode_misc.c.

cache_inode_status_t cache_inode_open ( cache_entry_t entry,
fsal_openflags_t  openflags,
fsal_op_context_t context,
uint32_t  flags,
cache_inode_status_t status 
)

Opens a file descriptor.

This function opens a file descriptor on a given cache entry.

Parameters:
[in]entryCache entry representing the file to open
[in]openflagsThe type of access for which to open
[in]contextFSAL operation context
[in]flagsFlags indicating lock status
[out]statusOperation status
Returns:
CACHE_INODE_SUCCESS if successful, errors otherwise

Definition at line 148 of file cache_inode_open_close.c.

cache_inode_status_t cache_inode_operate_cached_dirent ( cache_entry_t directory,
fsal_name_t name,
fsal_name_t newname,
cache_inode_dirent_op_t  dirent_op 
)

Perform an operation on it on a cached entry.

This function looks up an entry in the drectory cache and performs the indicated operation. If the directory has not been populated, it will not return not found errors.

The caller must hold the content lock on the directory.

Parameters:
[in]directoryThe directory to be operated upon
[in]nameThe name of the relevant entry
[in]newnameThe new name for renames
[in]dirent_opThe operation (LOOKUP, REMOVE, or RENAME) to perform
Return values:
CACHE_INODE_SUCCESSon success or failure in an unpopulated directory.
CACHE_INODE_BAD_TYPEif the supplied cache entry is not a directory.
CACHE_INODE_NOT_FOUNDon lookup failure in a populated directory.
CACHE_INODE_ENTRY_EXISTSon rename collission in a populated directory.

Definition at line 126 of file cache_inode_readdir.c.

void cache_inode_print_conf_gc_policy ( FILE *  output,
cache_inode_gc_policy_t gcpolicy 
)

Prints the garbage collection policy.

Prints the garbage collection policy.

Parameters:
[in]outputThe stream to which to print the data
[in]paramStructure to be printed

Definition at line 504 of file cache_inode_read_conf.c.

void cache_inode_print_conf_hash_parameter ( FILE *  output,
cache_inode_parameter_t param 
)

Prints the garbage collection policy.

This function prints the garbage collection policy to the supplied stream descriptor.

Parameters:
[in]outputA stream to which to print
[in]paramThe structure to be printed

Definition at line 463 of file cache_inode_read_conf.c.

void cache_inode_print_conf_parameter ( FILE *  output,
cache_inode_parameter_t param 
)

Prints cache inode configuration.

Prints the cache inode configuration to the supplied stream.

Parameters:
[in]outputA stream to which to print the data
[in]paramstructure to be printed

Definition at line 481 of file cache_inode_read_conf.c.

void cache_inode_print_dir ( cache_entry_t entry)

Prints the content of a directory.

This debugging function prints the contents of a directory.

Parameters:
[in]entrythe input pentry.

Definition at line 783 of file cache_inode_misc.c.

void cache_inode_put ( cache_entry_t entry)

cache_inode_put: release logical reference to a cache entry conferred by a previous call to cache_inode_get (cache_inode_get_located).

The result is typically to decrement the reference count on entry, but additional side effects include LRU adjustment, movement to/from the protected LRU partition, or recyling if the caller has raced an operation which made entry unreachable (and this current caller has the last reference). Caller MUST NOT make further accesses to the memory pointed to by entry.

Parameters:
[in]entryCache entry being returned
Returns:
CACHE_INDOE_STATUS or error codes

Definition at line 269 of file cache_inode_get.c.

cache_inode_status_t cache_inode_rdwr ( cache_entry_t entry,
cache_inode_io_direction_t  io_direction,
uint64_t  offset,
size_t  io_size,
size_t *  bytes_moved,
void *  buffer,
bool_t *  eof,
fsal_op_context_t context,
cache_inode_stability_t  stable,
cache_inode_status_t status 
)

Reads/Writes through the cache layer.

This function performs I/O, either using the Ganesha in-memory or disk cache or through the FSAL directly. The caller MUST NOT hold either the content or attribute locks when calling this function.

Parameters:
[in]entryFile to be read or written
[in]io_directionWhether this is a read or a write
[in]offsetAbsolute file position for I/O
[in]io_sizeAmount of data to be read or written
[out]bytes_movedThe length of data successfuly read or written
[in,out]bufferWhere in memory to read or write data
[out]eofWhether a READ encountered the end of file. May be NULL for writes.
[in]contextFSAL credentials
[in]stableThe stability of the write to perform
[out]statusStatus of operation
Returns:
CACHE_INODE_SUCCESS or various errors

Definition at line 86 of file cache_inode_rdwr.c.

cache_inode_status_t cache_inode_read_conf_gc_policy ( config_file_t  config,
cache_inode_gc_policy_t policy 
)

Read the garbage collection policy.

This function reads the garbage collection policy from the configuration file.

Parameters:
[in]configConfiguration file handle
[out]paramRead parameters
Return values:
CACHE_INODE_SUCCESSon success.
CACHE_INODE_NOT_FOUNDif stanza is not present.
CACHE_INODE_INVALID_ARGUMENTotherwise.

Definition at line 347 of file cache_inode_read_conf.c.

cache_inode_status_t cache_inode_read_conf_hash_parameter ( config_file_t  config,
cache_inode_parameter_t param 
)

Read the configuration for the Cache_inode hash table.

This funcion reads the configuration for the hash table used by the Cache_inode layer.

Parameters:
[in]configConfiguration file handle
[out]paramRead parameters
Return values:
CACHE_INODE_SUCCESSon success.
CACHE_INODE_NOT_FOUNDif stanza is not present.
CACHE_INODE_INVALID_ARGUMENTotherwise.

Definition at line 80 of file cache_inode_read_conf.c.

cache_inode_status_t cache_inode_read_conf_parameter ( config_file_t  config,
cache_inode_parameter_t param 
)

Read the configuration for the Cache inode layer.

Parameters:
[in]configConfiguration file handle
[out]paramRead parameters
Return values:
CACHE_INODE_SUCCESSon success.
CACHE_INODE_NOT_FOUNDif stanza not present
CACHE_INODE_INVALID_ARGUMENTotherwise

Definition at line 206 of file cache_inode_read_conf.c.

cache_inode_status_t cache_inode_readdir ( cache_entry_t directory,
uint64_t  cookie,
unsigned int *  nbfound,
bool_t *  eod_met,
fsal_op_context_t context,
cache_inode_readdir_cb_t  cb,
void *  cb_opaque,
cache_inode_status_t status 
)

Reads a directory.

This function iterates over the cached directory entries (possibly after populating the cache) and invokes a supplied callback function for each one.

The caller must not hold the attribute or content locks on directory.

Parameters:
[in]directoryThe directory to be read
[in]cookieStarting cookie for the readdir operation
[out]nbfoundNumber of entries returned.
[out]eod_metWhether the end of directory was met
[in]contextFSAL credentials
[in]cbThe callback function to receive entries
[in]cb_opaqueA pointer passed as the first argument to cb
[out]statusReturned status
Return values:
CACHE_INODE_SUCCESSif operation is a success
CACHE_INODE_BAD_TYPEif entry is not related to a directory

Definition at line 601 of file cache_inode_readdir.c.

cache_inode_status_t cache_inode_readdir_populate ( cache_entry_t directory,
fsal_op_context_t context,
cache_inode_status_t status 
)

Cache complete directory contents.

This function reads a complete directory from the FSAL and caches both the names and filess. The content lock must be held on the directory being read.

Parameters:
[in]directoryEntry for the parent directory to be read
[in]contextFSAL credentials
[out]statusReturned status

Definition at line 374 of file cache_inode_readdir.c.

cache_inode_status_t cache_inode_readlink ( cache_entry_t entry,
fsal_path_t link_content,
fsal_op_context_t context,
cache_inode_status_t status 
)

Read the target of a symlink.

Copy the content of a symbolic link into the address pointed to by link_content.

Parameters:
[in]entryThe link to read
[out]link_contentThe location into which to write the target
[in]contextFSAL operation context
[out]statusStatus of the operation
Returns:
CACHE_INODE_SUCCESS on success, other things on failure.

Definition at line 75 of file cache_inode_readlink.c.

cache_inode_status_t cache_inode_release_data_cache ( cache_entry_t entry,
fsal_op_context_t context,
cache_inode_status_t status 
)
void cache_inode_release_dirents ( cache_entry_t entry,
cache_inode_avl_which_t  which 
)

Release cached directory content.

This function releases the cached directory entries on a directory cache entry.

Parameters:
[in]entryDirectory to have entries be released
[in]whichCaches to clear (dense, sparse, or both)

Definition at line 840 of file cache_inode_misc.c.

void cache_inode_release_symlink ( cache_entry_t entry)

Release symlink content.

This function releases an entry's symlink content, if present.

Parameters:
[in]entry

Definition at line 819 of file cache_inode_misc.c.

cache_inode_status_t cache_inode_remove ( cache_entry_t entry,
fsal_name_t name,
fsal_attrib_list_t attr,
fsal_op_context_t context,
cache_inode_status_t status 
)

Public function to remove a name from a directory.

Removes a name from the supplied directory. The caller should hold no locks on the directory.

Parameters:
[in]entryEntry for the parent directory to be managed
[in]nameName to be removed
[out]attrAttributes of the directory on success
[in]contextFSAL credentials
[out]statusReturned status
Return values:
CACHE_INODE_SUCCESSif operation is a success

Definition at line 164 of file cache_inode_remove.c.

cache_inode_status_t cache_inode_remove_cached_dirent ( cache_entry_t directory,
fsal_name_t name,
cache_inode_status_t status 
)

Removes an entry from a cached directory.

This function removes the named entry from a cached directory. The caller must hold the content lock.

Parameters:
[in,out]directoryThe cache entry representing the directory
[in]nameThe name indicating the entry to remove
[out]statusReturned status
Return values:
CACHE_INODE_SUCCESSon success.
CACHE_INODE_BAD_TYPEif directory is not a directory.
Theresult of cache_inode_operate_cached_dirent

Definition at line 337 of file cache_inode_readdir.c.

cache_inode_status_t cache_inode_remove_impl ( cache_entry_t entry,
fsal_name_t name,
fsal_op_context_t context,
cache_inode_status_t status,
uint32_t  flags 
)

Implement actual work of removing file.

Actually remove an entry from the directory. Assume that the directory contents and attributes are locked for writes. The attribute lock is released unless keep_md_lock is TRUE.

Parameters:
[in]entryEntry for the parent directory to be managed.
[in]nameName of the entry that we are looking for in the cache.
[in]contextFSAL credentials
[in]statusReturned status
[in]flagsFlags to control lock retention
Returns:
CACHE_INODE_SUCCESS if operation is a success

Definition at line 231 of file cache_inode_remove.c.

cache_inode_status_t cache_inode_rename ( cache_entry_t dir_src,
fsal_name_t oldname,
cache_entry_t dir_dest,
fsal_name_t newname,
fsal_attrib_list_t attr_src,
fsal_attrib_list_t attr_dest,
fsal_op_context_t context,
cache_inode_status_t status 
)

Renames an entry.

This function calls the FSAL to rename a file, then mirrors the operation in the cache.

Parameters:
[in]dir_srcThe source directory
[in]oldnameThe current name of the file
[in]dir_destThe destination directory
[in]newnameThe name to be assigned to the object
[out]attr_srcSource directory attributes after operation
[out]pattr_destDestination directory attributes after operation
[in]contextFSAL credentials
[out]statusReturned status
Return values:
CACHE_INODE_SUCCESSif operation is a success.
CACHE_INODE_NOT_FOUNDif source object does not exist
CACHE_INODE_ENTRY_EXISTSon collision.
CACHE_INODE_BAD_TYPEif dir_src or dir_dest is not a directory.

Definition at line 185 of file cache_inode_rename.c.

cache_inode_status_t cache_inode_rename_cached_dirent ( cache_entry_t parent,
fsal_name_t oldname,
fsal_name_t newname,
cache_inode_status_t status 
)

Renames an entry in the same directory.

Renames an entry in the same directory.

Parameters:
[in,out]parentThe directory to be managed
[in]oldnameThe name of the entry to rename
[in]newnameThe new name for the entry
[out]statusreturned status.
Returns:
the same as *status

Definition at line 74 of file cache_inode_rename.c.

int cache_inode_set_time_current ( fsal_time_t time) [inline]

Set the fsal_time in a pentry struct to the current time.

Sets the fsal_time in a pentry struct to the current time. This function is using gettimeofday.

Parameters:
[out]timePointer to time to be set
Returns:
0 if keys if successfully build, -1 otherwise

Definition at line 212 of file cache_inode_misc.c.

cache_inode_status_t cache_inode_setattr ( cache_entry_t entry,
fsal_attrib_list_t attr,
fsal_op_context_t context,
cache_inode_status_t status 
)

Set the attributes for a file.

This function sets the attributes of a file, both in the cache and in the underlying filesystem.

Parameters:
[in]entryEntry whose attributes are to be set
[in,out]attrAttributes to set/result of set
[in]contextFSAL credentials
[out]statusReturned status
Return values:
CACHE_INODE_SUCCESSif operation is a success

Definition at line 75 of file cache_inode_setattr.c.

cache_inode_status_t cache_inode_statfs ( cache_entry_t entry,
fsal_dynamicfsinfo_t dynamicinfo,
fsal_op_context_t context,
cache_inode_status_t status 
)

Definition at line 65 of file cache_inode_statfs.c.

cache_inode_status_t cache_inode_truncate ( cache_entry_t entry,
fsal_size_t  length,
fsal_attrib_list_t attr,
fsal_op_context_t context,
cache_inode_status_t status 
)

Truncates a regular file specified by its cache entry.

Truncates a regular file specified by its cache entry.

Parameters:
[in]entryThe file to be truncated
[in]lengthNew length for the file
[out]attrAttrtibutes for the file after the operation
[in]contextFSAL credentials
[out]statusReturned status
Returns:
CACHE_INODE_SUCCESS if operation is a success

Definition at line 133 of file cache_inode_truncate.c.

cache_inode_status_t cache_inode_truncate_impl ( cache_entry_t entry,
fsal_size_t  length,
fsal_attrib_list_t attr,
fsal_op_context_t context,
cache_inode_status_t status 
)

truncates a regular file

This function truncates a regular file to the length specified.

Parameters:
[in]entryThe file to be truncated
[in]lengthNew length for the file
[out]attrAttrtibutes for the file after the operation.
[in]contextFSAL credentials
[out]statusReturned status
Returns:
CACHE_INODE_SUCCESS if operation is a success

Definition at line 73 of file cache_inode_truncate.c.

int cache_inode_types_are_rename_compatible ( cache_entry_t src,
cache_entry_t dest 
)

Test if an entry can be overwritten during a rename.

This function checks if an existing entry can be overwritten by a rename operation.

Parameters:
[in]srcThe source file
[in]destThe destination file
Returns:
TRUE if the rename is allowed, FALSE if not.

Definition at line 747 of file cache_inode_misc.c.

int display_key ( hash_buffer_t pbuff,
char *  str 
)

Definition at line 249 of file cache_inode_fsal_hash.c.

int display_not_implemented ( hash_buffer_t pbuff,
char *  str 
)

Definition at line 259 of file cache_inode_fsal_hash.c.

int display_value ( hash_buffer_t pbuff,
char *  str 
)

Definition at line 266 of file cache_inode_fsal_hash.c.

bool_t is_open_for_read ( cache_entry_t entry)

Check if a file is available to read.

This function checks whether the given file is currently open in a mode supporting read operations.

Parameters:
[in]entryEntry for the file to check
Returns:
TRUE if the file is opened for reads

Definition at line 123 of file cache_inode_open_close.c.

bool_t is_open_for_write ( cache_entry_t entry)

Check if a file is available to write.

This function checks whether the given file is currently open in a mode supporting write operations.

Parameters:
[in]entryEntry for the file to check
Returns:
TRUE if the file is open for writes

Definition at line 102 of file cache_inode_open_close.c.


Variable Documentation

Definition at line 65 of file cache_inode_misc.c.

Global memory pools for cached data

Definition at line 63 of file cache_inode_misc.c.

Definition at line 60 of file cache_inode_misc.c.

Definition at line 61 of file cache_inode_misc.c.

Definition at line 64 of file cache_inode_misc.c.

Definition at line 94 of file nfs_init.c.