nfs-ganesha 1.4
Functions | Variables

cache_inode_misc.c File Reference

routines for management of the cache_inode layer, More...

#include "abstract_atomic.h"
#include "log.h"
#include "HashData.h"
#include "HashTable.h"
#include "fsal.h"
#include "cache_inode.h"
#include "cache_inode_avl.h"
#include "cache_inode_lru.h"
#include "cache_inode_weakref.h"
#include "nfs4_acls.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <time.h>
#include <pthread.h>
#include <string.h>
#include <assert.h>

Go to the source code of this file.

Functions

const char * cache_inode_err_str (cache_inode_status_t err)
int cache_inode_compare_key_fsal (hash_buffer_t *buff1, hash_buffer_t *buff2)
 Compares two keys used in cache inode.
int cache_inode_set_time_current (fsal_time_t *time)
 Set the fsal_time in a pentry struct to the current time.
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.
void cache_inode_clean_entry (cache_entry_t *entry)
 Final cleaning of an 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_inode_file_type_t cache_inode_fsal_type_convert (fsal_nodetype_t type)
 converts an FSAL type to the corresponding cache_inode type
bool_t 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 *entry)
 Prints the content of a directory.
void cache_inode_release_symlink (cache_entry_t *entry)
 Release symlink content.
void cache_inode_release_dirents (cache_entry_t *entry, cache_inode_avl_which_t which)
 Release cached directory content.
bool_t cache_inode_file_holds_state (cache_entry_t *entry)
 Return true if a file holds state.
cache_inode_status_t cache_inode_check_trust (cache_entry_t *entry, fsal_op_context_t *context)
 Conditionally refresh attributes.

Variables

cache_inode_gc_policy_t cache_inode_gc_policy
cache_inode_parameter_t cache_inode_params
pool_tcache_inode_entry_pool
pool_tcache_inode_symlink_pool
pool_tcache_inode_dir_entry_pool

Detailed Description

routines for management of the cache_inode layer,

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

Definition in file cache_inode_misc.c.


Function Documentation

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.

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.

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.

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.

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_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.

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_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.

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.

bool_t 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.


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.