nfs-ganesha 1.4
|
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.
Management of the cached inode layer.
Management of the cached inode layer
Definition in file cache_inode.h.
#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 struct cache_entry_t cache_entry_t |
Definition at line 69 of file cache_inode.h.
typedef enum cache_inode_avl_which__ cache_inode_avl_which_t |
typedef union cache_inode_create_arg__ cache_inode_create_arg_t |
Type-specific data passed to cache_inode_new_entry
typedef struct cache_inode_dir_entry__ cache_inode_dir_entry_t |
typedef enum cache_inode_dirent_op__ cache_inode_dirent_op_t |
Passed to cache_inode_operate_cached_dirent to indicate the operation being requested.
typedef enum cache_inode_expire_type__ cache_inode_expire_type_t |
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.
typedef enum cache_inode_file_type__ cache_inode_file_type_t |
Enumeration of all cache_entry types known by cache_inode.
typedef struct cache_inode_fsal_data__ cache_inode_fsal_data_t |
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.
typedef struct cache_inode_gc_policy__ cache_inode_gc_policy_t |
Configuration parameters for garbage collection/LRU policy
typedef enum io_direction__ cache_inode_io_direction_t |
Indicate whether this is a read or write operation, for cache_inode_rdwr.
typedef struct cache_inode_lru__ cache_inode_lru_t |
Data for tracking a cache entry's position the LRU.
typedef struct cache_inode_opened_file__ cache_inode_opened_file_t |
Representation of an open file associated with a cache_entry.
typedef struct cache_inode_parameter__ cache_inode_parameter_t |
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.
typedef struct cache_inode_share__ cache_inode_share_t |
The reference counted share reservation state.
typedef enum cache_inode_stability__ cache_inode_stability_t |
Values to control the stability
typedef enum cache_inode_status_t cache_inode_status_t |
typedef struct cache_inode_symlink__ cache_inode_symlink_t |
Definition at line 408 of file cache_inode.h.
typedef struct cache_inode_unstable_data__ cache_inode_unstable_data_t |
Bookkeeping information for unstably written data held in Ganesha's write buffer.
Definition at line 206 of file cache_inode.h.
Passed to cache_inode_operate_cached_dirent to indicate the operation being requested.
Definition at line 199 of file cache_inode.h.
Constants to determine whether inode data, such as attributes, expire.
Definition at line 83 of file cache_inode.h.
Enumeration of all cache_entry types known by cache_inode.
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
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.
enum cache_inode_status_t |
Definition at line 539 of file cache_inode.h.
enum io_direction__ |
Indicate whether this is a read or write operation, for cache_inode_rdwr.
Definition at line 188 of file cache_inode.h.
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.
[in] | entry | The object to be checked |
[in] | access_type | The kind of access to be checked |
[in] | context | FSAL credentials |
[in] | status | Returned status |
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.
[in] | entry | entry pointer for the fs object to be checked. |
[in] | access_type | The kind of access to be checked |
[in] | context | FSAL credentials |
[out] | status | Returned status |
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.
[in,out] | parent | Cache entry of the directory being updated |
[in] | name | The name to add to the entry |
[in] | entry | The cache entry associated with name |
[out] | dir_entry | The directory entry newly added (optional) |
[out] | status | Same as return value |
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.
[in] | entry | The entry to refresh |
[in] | context | FSAL credentials |
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.
[in] | entry | The 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.
[in] | entry | Entry to be cleaned |
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.
[in] | entry | Cache entry to close |
[in] | flags | Flags for lock management |
[out] | status | Operation status |
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.
[in] | entry | File whose data should be committed |
[in] | offset | Start of region to commit |
[in] | count | Number of bytes to commit |
[in] | typeofcommit | What type of commit operation this is |
[in] | context | FSAL credentials |
[out] | status | Operation status |
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.
[in] | buff1 | First key |
[in] | buff2 | Second key |
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.
[in] | parent | Parent directory |
[in] | name | Name of the object to create |
[in] | type | Type of the object to create |
[in] | mode | Mode to be used at file creation |
[in] | create_arg | Additional argument for object creation |
[out] | attr | Attributes of the new object |
[in] | context | FSAL credentials |
[out] | status | Returned status |
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.
[in] | fsal_status | FSAL error to be converted |
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.
[in] | entry | Entry for the file on which to operate |
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.
[in] | entry | The file to be checked |
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.
hparam | [IN] hash table parameter. |
buffclef | [IN] key to be used for computing the 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.
hparam | [IN] hash table parameter. |
buffclef | [IN] key to be used for computing the hash 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.
[in] | type | The input FSAL 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.
[in] | fsdata | File system data |
[out] | attr | The attributes of the got entry |
[in] | context | FSAL credentials |
[in] | associated | Entry that may be equal to the got entry |
[out] | status | Returned status |
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.
[in] | entry | Entry to be managed. |
[out] | attr | Pointer to the results |
[in] | context | FSAL credentials |
[out] | status | Returned status |
CACHE_INODE_SUCCESS | if 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.
[in] | param | The parameters for this cache |
[out] | status | Operation status |
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.
[in] | handle | FSAL handle for the entry to be invalidated |
[out] | status | Returned status |
CACHE_INODE_SUCCESS | if operation is a success |
CACHE_INODE_INVALID_ARGUMENT | bad parameter(s) as input |
CACHE_INODE_NOT_FOUND | if entry is not cached |
CACHE_INODE_STATE_CONFLICT | if invalidating this entry would result is state conflict |
CACHE_INODE_INCONSISTENT_ENTRY | if entry is not consistent |
Other | errors 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.
[in,out] | entry | The directory to be managed |
[out] | status | Returned 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.
[in] | entry | Entry to be checked (should be of type DIRECTORY) |
CACHE_INODE_SUCCESS | is directory is empty |
CACHE_INODE_BAD_TYPE | is pentry is not of type DIRECTORY |
CACHE_INODE_DIR_NOT_EMPTY | if 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.
[in] | entry | Entry to be checked (should be of type DIRECTORY) |
CACHE_INODE_SUCCESS | is directory is empty |
CACHE_INODE_BAD_TYPE | is pentry is not of type DIRECTORY |
CACHE_INODE_DIR_NOT_EMPTY | if 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.
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.
[in] | entry | The 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.
[in] | entry | The file to which to add the new name. Must not be a directory. |
[in] | dest_dir | The directory in which to create the new name |
[in] | name | The new name to add to the file |
[out] | attr | The attributes on entry after the operation |
[in] | context | FSAL credentials |
[out] | status | returned status. |
CACHE_INODE_SUCCESS | if operation is a success |
CACHE_INODE_BAD_TYPE | either source or destination have incorrect type |
CACHE_INODE_ENTRY_EXISTS | entry 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.
[in] | parent | Entry for the parent directory to be managed. |
[in] | name | Name of the entry that we are looking up. |
[out] | attr | Attributes of the found entry. |
[in] | context | FSAL credentials |
[out] | pstatus | Returned status |
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.
[in] | parent | The directory to search |
[in] | name | The name to be looked up |
[in] | context | FSAL credentials |
[out] | status | Returned status |
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.
[in] | entry | Entry whose parent is to be obtained. |
[in] | context | FSAL credentials |
[out] | status | Returned status |
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.
[in] | entry | Entry whose parent is to be obtained |
[in] | context | FSAL operation context |
[out] | status | Returned status |
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.
[in] | fsdata | Handle for the root |
[in] | context | FSAL credentials. Unused here |
[out] | status | Returned status |
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.
[in] | fsdata | FSAL data for the entry to be created |
[in] | attr | Attributes to be stored in the cache entry (must not be NULL) |
[in] | type | Type of entry to create |
[in] | create_arg | Type specific creation data |
[out] | status | Returned status |
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.
[in] | entry | Cache entry representing the file to open |
[in] | openflags | The type of access for which to open |
[in] | context | FSAL operation context |
[in] | flags | Flags indicating lock status |
[out] | status | Operation status |
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.
[in] | directory | The directory to be operated upon |
[in] | name | The name of the relevant entry |
[in] | newname | The new name for renames |
[in] | dirent_op | The operation (LOOKUP, REMOVE, or RENAME) to perform |
CACHE_INODE_SUCCESS | on success or failure in an unpopulated directory. |
CACHE_INODE_BAD_TYPE | if the supplied cache entry is not a directory. |
CACHE_INODE_NOT_FOUND | on lookup failure in a populated directory. |
CACHE_INODE_ENTRY_EXISTS | on 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.
[in] | output | The stream to which to print the data |
[in] | param | Structure 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.
[in] | output | A stream to which to print |
[in] | param | The 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.
[in] | output | A stream to which to print the data |
[in] | param | structure 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.
[in] | entry | the 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.
[in] | entry | Cache entry being returned |
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.
[in] | entry | File to be read or written |
[in] | io_direction | Whether this is a read or a write |
[in] | offset | Absolute file position for I/O |
[in] | io_size | Amount of data to be read or written |
[out] | bytes_moved | The length of data successfuly read or written |
[in,out] | buffer | Where in memory to read or write data |
[out] | eof | Whether a READ encountered the end of file. May be NULL for writes. |
[in] | context | FSAL credentials |
[in] | stable | The stability of the write to perform |
[out] | status | Status of operation |
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.
[in] | config | Configuration file handle |
[out] | param | Read parameters |
CACHE_INODE_SUCCESS | on success. |
CACHE_INODE_NOT_FOUND | if stanza is not present. |
CACHE_INODE_INVALID_ARGUMENT | otherwise. |
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.
[in] | config | Configuration file handle |
[out] | param | Read parameters |
CACHE_INODE_SUCCESS | on success. |
CACHE_INODE_NOT_FOUND | if stanza is not present. |
CACHE_INODE_INVALID_ARGUMENT | otherwise. |
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.
[in] | config | Configuration file handle |
[out] | param | Read parameters |
CACHE_INODE_SUCCESS | on success. |
CACHE_INODE_NOT_FOUND | if stanza not present |
CACHE_INODE_INVALID_ARGUMENT | otherwise |
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.
[in] | directory | The directory to be read |
[in] | cookie | Starting cookie for the readdir operation |
[out] | nbfound | Number of entries returned. |
[out] | eod_met | Whether the end of directory was met |
[in] | context | FSAL credentials |
[in] | cb | The callback function to receive entries |
[in] | cb_opaque | A pointer passed as the first argument to cb |
[out] | status | Returned status |
CACHE_INODE_SUCCESS | if operation is a success |
CACHE_INODE_BAD_TYPE | if 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.
[in] | directory | Entry for the parent directory to be read |
[in] | context | FSAL credentials |
[out] | status | Returned 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.
[in] | entry | The link to read |
[out] | link_content | The location into which to write the target |
[in] | context | FSAL operation context |
[out] | status | Status of the operation |
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.
[in] | entry | Directory to have entries be released |
[in] | which | Caches 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.
[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.
[in] | entry | Entry for the parent directory to be managed |
[in] | name | Name to be removed |
[out] | attr | Attributes of the directory on success |
[in] | context | FSAL credentials |
[out] | status | Returned status |
CACHE_INODE_SUCCESS | if 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.
[in,out] | directory | The cache entry representing the directory |
[in] | name | The name indicating the entry to remove |
[out] | status | Returned status |
CACHE_INODE_SUCCESS | on success. |
CACHE_INODE_BAD_TYPE | if directory is not a directory. |
The | result 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.
[in] | entry | Entry for the parent directory to be managed. |
[in] | name | Name of the entry that we are looking for in the cache. |
[in] | context | FSAL credentials |
[in] | status | Returned status |
[in] | flags | Flags to control lock retention |
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.
[in] | dir_src | The source directory |
[in] | oldname | The current name of the file |
[in] | dir_dest | The destination directory |
[in] | newname | The name to be assigned to the object |
[out] | attr_src | Source directory attributes after operation |
[out] | pattr_dest | Destination directory attributes after operation |
[in] | context | FSAL credentials |
[out] | status | Returned status |
CACHE_INODE_SUCCESS | if operation is a success. |
CACHE_INODE_NOT_FOUND | if source object does not exist |
CACHE_INODE_ENTRY_EXISTS | on collision. |
CACHE_INODE_BAD_TYPE | if 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.
[in,out] | parent | The directory to be managed |
[in] | oldname | The name of the entry to rename |
[in] | newname | The new name for the entry |
[out] | status | returned 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.
[out] | time | Pointer to time to be set |
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.
[in] | entry | Entry whose attributes are to be set |
[in,out] | attr | Attributes to set/result of set |
[in] | context | FSAL credentials |
[out] | status | Returned status |
CACHE_INODE_SUCCESS | if 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.
[in] | entry | The file to be truncated |
[in] | length | New length for the file |
[out] | attr | Attrtibutes for the file after the operation |
[in] | context | FSAL credentials |
[out] | status | Returned status |
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.
[in] | entry | The file to be truncated |
[in] | length | New length for the file |
[out] | attr | Attrtibutes for the file after the operation. |
[in] | context | FSAL credentials |
[out] | status | Returned status |
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.
[in] | src | The source file |
[in] | dest | The destination file |
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.
[in] | entry | Entry for the file to check |
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.
[in] | entry | Entry for the file to check |
Definition at line 102 of file cache_inode_open_close.c.
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.