|
nfs-ganesha 1.4
|
Management of the file content cache: miscellaneous functions. More...
#include "fsal.h"#include "LRU_List.h"#include "log.h"#include "HashData.h"#include "HashTable.h"#include "cache_inode.h"#include "cache_content.h"#include "nfs_exports.h"#include <unistd.h>#include <sys/types.h>#include <sys/param.h>#include <time.h>#include <pthread.h>#include <string.h>#include <libgen.h>Go to the source code of this file.
Management of the file content cache: miscellaneous functions.
cache_content_misc.c : Management of the file content cache, miscellaneous functions.
Definition in file cache_content_misc.c.
| #define ALPHABET_LEN 16 |
| #define PRIME_16BITS 65521 |
| cache_content_status_t cache_content_check_threshold | ( | char * | datacache_path, |
| unsigned int | threshold_min, | ||
| unsigned int | threshold_max, | ||
| int * | p_bool_overflow, | ||
| unsigned long * | p_blocks_to_lwm | ||
| ) |
cache_content_check_threshold: check datacache filesystem's threshold.
| datacache_path | [IN] the datacache filesystem's path. |
| threshold_min | [IN] the low watermark for the filesystem (in percent). |
| threshold_max | [IN] the high watermark for the filesystem (in percent). |
| p_bool_overflow | [OUT] boolean that indicates whether the FS overcomes the high watermark. |
| p_blocks_to_lwm | [OUT] if bool_overflow is set to true, this indicates the number of blocks to be purged in order to reach the low watermark. |
Definition at line 482 of file cache_content_misc.c.
| cache_content_status_t cache_content_create_name | ( | char * | path, |
| cache_content_nametype_t | type, | ||
| fsal_op_context_t * | pcontext, | ||
| cache_entry_t * | pentry_inode, | ||
| cache_content_client_t * | pclient | ||
| ) |
cache_content_create_name: Creates a name in the local fs for a cached entry.
Creates a name in the local fs for a cached entry and creates the directories that whil contain this file.
| path | [OUT] buffer to be used for storing the name. |
| type | [IN] type of pathname to be created. |
| pentry_inode | [OUT] Entry in Cache inode layer related to the file content entry. |
| pclient | [IN] resources allocated for the file content client. |
Definition at line 111 of file cache_content_misc.c.
| cache_inode_status_t cache_content_error_convert | ( | cache_content_status_t | status | ) |
cache_content_error_convert: Converts a cache_content_status to a cache_inode_status.
Converts a cache_content_status to a cache_inode_status.
| status | [IN] File content status to be converted. |
Definition at line 347 of file cache_content_misc.c.
| size_t cache_content_fsal_size_convert | ( | fsal_size_t | size, |
| cache_content_status_t * | pstatus | ||
| ) |
cache_content_fsal_size_convert: converts a fsal_size_t to unix size.
Converts a fsal_seek_t to unix size.
| seek | [IN] FSAL Seek descriptor. |
| pstatus | [OUT] pointer to the status. |
Definition at line 405 of file cache_content_misc.c.
| off_t cache_content_get_cached_size | ( | cache_content_entry_t * | pentry | ) |
cache_content_get_cached_size: recovers the size of a data cached file.
Recovers the size of a data cached file.
| pentry | [IN] related pentry |
Definition at line 317 of file cache_content_misc.c.
| int cache_content_get_datapath | ( | char * | basepath, |
| u_int64_t | inum, | ||
| char * | datapath | ||
| ) |
cache_content_get_datapath : recovers the path for a file of a specified inum.
| basepath | [IN] path to the root of the directory in the cache for the related export entry |
| inum | [IN] inode number for the file whose size is to be recovered. |
| path | [OUT] the absolute path of the file (must be at least a MAXPATHLEN length string). |
Definition at line 254 of file cache_content_misc.c.
| int cache_content_get_export_id | ( | char * | dirname | ) |
cache_content_get_export_id: gets an export id from an export dirname.
Gets an export id from an export dirname.
| dirname | [IN] The dirname for the export_id dirname. |
Definition at line 192 of file cache_content_misc.c.
| u_int64_t cache_content_get_inum | ( | char * | filename | ) |
cache_content_get_inum: gets an inode number fronm a cache filename.
Gets an inode number fronm a cache filename.
| filename | [IN] The filename to be parsed. |
Definition at line 216 of file cache_content_misc.c.
| void cache_content_local_cache_closedir | ( | cache_content_dirinfo_t * | directory | ) |
cache_content_local_cache_closedir: Close a local cache directory associated to an export entry.
| directory[IN] | the handle to the directory to be closed |
Definition at line 868 of file cache_content_misc.c.
| int cache_content_local_cache_dir_iter | ( | cache_content_dirinfo_t * | directory, |
| struct dirent * | pdir_entry, | ||
| unsigned int | index, | ||
| unsigned int | mod | ||
| ) |
cache_content_local_cache_dir_iter: iterate on a local cache directory to get the entry one by one
| directory | [IN] the directory to be read |
| index | [IN] thread index for multithreaded flushes (first has index 0) |
| mod | [IN] modulus for multithreaded flushes (number of threads) |
| pdir_entry | [OUT] found dir_entry |
Definition at line 664 of file cache_content_misc.c.
| int cache_content_local_cache_opendir | ( | char * | cache_dir, |
| cache_content_dirinfo_t * | pdirectory | ||
| ) |
cache_content_local_cache_opendir: Open a local cache directory associated to an export entry.
| cache_dir | [IN] the path to the directory associated with the export entry |
| pdirectory | [OUT] pointer to trhe openend directory |
Definition at line 569 of file cache_content_misc.c.
| cache_content_status_t cache_content_prepare_directories | ( | exportlist_t * | pexportlist, |
| char * | cache_dir, | ||
| cache_content_status_t * | pstatus | ||
| ) |
cache_content_prepare_directories: do the mkdir to set the data cache directories
do the mkdir to set the data cache directories.
| pexportlist | [IN] export list |
| pstatus | [OUT] pointer to the status. |
Definition at line 427 of file cache_content_misc.c.
| off_t cache_content_recover_size | ( | char * | basepath, |
| u_int64_t | inum | ||
| ) |
cache_content_recover_size: recovers the size of a data cached file.
Recovers the size of a data cached file.
| basepath | [IN] path to the root of the directory in the cache for the related export entry |
| inum | [IN] inode number for the file whose size is to be recovered. |
Definition at line 284 of file cache_content_misc.c.
| cache_content_status_t cache_content_test_cached | ( | cache_entry_t * | pentry_inode, |
| cache_content_client_t * | pclient, | ||
| fsal_op_context_t * | pcontext, | ||
| cache_content_status_t * | pstatus | ||
| ) |
cache_content_test_cached: Tests if a given pentry_inode has already an associated data cache
Tests if a given pentry_inode has already an associated data cache. This is useful to recover data from a data cache built by a former server instance.
| pentry_inode | [IN] entry in cache_inode layer for this file. |
| pclient | [IN] ressource allocated by the client for the nfs management. |
| pcontext | [IN] the related FSAL Context [OUT] returned status. |
Definition at line 613 of file cache_content_misc.c.
| short HashFileID4 | ( | u_int64_t | fileid4 | ) |
Definition at line 80 of file cache_content_misc.c.
| unsigned int cache_content_dir_errno |
Definition at line 74 of file cache_content_misc.c.
1.7.3