nfs-ganesha 1.4
Functions | Variables

nfs_dupreq.c File Reference

#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#include <stdlib.h>
#include <dirent.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/file.h>
#include <pwd.h>
#include <grp.h>
#include "rpcal.h"
#include "LRU_List.h"
#include "HashData.h"
#include "HashTable.h"
#include "log.h"
#include "nfs_core.h"
#include "nfs23.h"
#include "nfs4.h"
#include "fsal.h"
#include "nfs_tools.h"
#include "nfs_exports.h"
#include "nfs_file_handle.h"
#include "nfs_dupreq.h"

Go to the source code of this file.

Functions

void LogDupReq (const char *label, sockaddr_t *addr, long xid, u_long rq_prog)
int print_entry_dupreq (LRU_data_t data, char *str)
int nfs_dupreq_delete (struct svc_req *req)
int clean_entry_dupreq (LRU_entry_t *pentry, void *addparam)
uint32_t dupreq_value_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint64_t dupreq_rbt_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
int compare_req (hash_buffer_t *buff1, hash_buffer_t *buff2)
int display_req_key (hash_buffer_t *pbuff, char *str)
int display_req_val (hash_buffer_t *pbuff, char *str)
int nfs_Init_dupreq (nfs_rpc_dupreq_parameter_t param)
int nfs_dupreq_add_not_finished (struct svc_req *req, nfs_res_t *res_nfs)
int nfs_dupreq_finish (struct svc_req *req, nfs_res_t *p_res_nfs, LRU_list_t *lru_dupreq)
nfs_res_t nfs_dupreq_get (struct svc_req *req, int *pstatus)
int nfs_dupreq_gc_function (LRU_entry_t *pentry, void *addparam)
void nfs_dupreq_get_stats (hash_stat_t *phstat_udp, hash_stat_t *phstat_tcp)

Variables

nfs_function_desc_t nfs2_func_desc []
nfs_function_desc_t nfs3_func_desc []
nfs_function_desc_t nfs4_func_desc []
nfs_function_desc_t mnt1_func_desc []
nfs_function_desc_t mnt3_func_desc []
hash_table_tht_dupreq_udp
hash_table_tht_dupreq_tcp

Function Documentation

int clean_entry_dupreq ( LRU_entry_t pentry,
void *  addparam 
)

clean_entry_dupreq: cleans an entry in the dupreq cache.

cleans an entry in the dupreq cache.

Parameters:
pentry[INOUT] entry to be cleaned.
addparam[IN] additional parameter used for cleaning.
Returns:
0 if ok, other values mean an error.

Definition at line 295 of file nfs_dupreq.c.

int compare_req ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

compare_req: compares the xid, ip, and port stored in the key buffers. may also compare the checksum if the relevant option was enabled during compile.

compare the xid, ip, and port stored in the key buffers. This function is to be used as 'compare_key' field in the hashtable storing the nfs duplicated requests.

Parameters:
buff1[IN] first key
buff2[IN] second key
Returns:
0 if keys are identifical, 1 if they are different.

Definition at line 390 of file nfs_dupreq.c.

int display_req_key ( hash_buffer_t pbuff,
char *  str 
)

display_req_key: displays the key stored in the buffer.

displays the key stored in the buffer. This function is to be used as 'key_to_str' field in the hashtable storing the nfs duplicated requests.

Parameters:
buff1[IN] buffer to display
buff2[OUT] output string
Returns:
number of character written.

Definition at line 417 of file nfs_dupreq.c.

int display_req_val ( hash_buffer_t pbuff,
char *  str 
)

display_req_val: displays the value stored in the buffer.

displays the value stored in the buffer. This function is to be used as 'val_to_str' field in the hashtable storing the nfs duplicated requests.

Parameters:
buff1[IN] buffer to display
buff2[OUT] output string
Returns:
number of character written.

Definition at line 442 of file nfs_dupreq.c.

uint64_t dupreq_rbt_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

dupreq_rbt_hash_func: computes the rbt value for the entry in dupreq cache.

Computes the rbt value for the entry in dupreq cache. In fact, it just use the Xid itself (which is an unsigned integer) as the rbt value. This function is called internal in the HasTable_* function

Parameters:
hparam[IN] hash table parameter.
buffcleff[in]pointer to the hash key buffer
Returns:
the computed rbt value.
See also:
HashTable_Init

Definition at line 365 of file nfs_dupreq.c.

uint32_t dupreq_value_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

dupreq_rbt_hash_func: computes the hash value for the entry in dupreq cache.

Computes the hash value for the entry in dupreq cache. In fact, it just uses the xid modulo the hash array size.

This function is called internal in the HasTable_* function

Parameters:
hparam[IN] hash table parameter.
buffcleff[in]pointer to the hash key buffer
Returns:
the computed hash value.
See also:
HashTable_Init

Definition at line 340 of file nfs_dupreq.c.

void LogDupReq ( const char *  label,
sockaddr_t addr,
long  xid,
u_long  rq_prog 
)

Definition at line 87 of file nfs_dupreq.c.

int nfs_dupreq_add_not_finished ( struct svc_req *  req,
nfs_res_t res_nfs 
)

nfs_dupreq_add_not_finished: adds an entry in the duplicate requests cache.

Adds an entry in the duplicate requests cache.

Parameters:
xid[IN] the transfer id to be used as key
pnfsreq[IN] the request pointer to cache
Returns:
DUPREQ_SUCCESS if successfull
.
DUPREQ_INSERT_MALLOC_ERROR if an error occured during the insertion process.

Definition at line 499 of file nfs_dupreq.c.

int nfs_dupreq_delete ( struct svc_req *  req)

Definition at line 239 of file nfs_dupreq.c.

int nfs_dupreq_finish ( struct svc_req *  req,
nfs_res_t p_res_nfs,
LRU_list_t lru_dupreq 
)

nfs_dupreq_finish: Changes the being_processed flag in a dupreq to 0 and adds the reply info to the buffval.

Changes the being_processed flag in a dupreq to 0 and adds the reply info to the buffval. Used after the duplicate request has already been added to the dupreq cache but has not been fully processed yet.

Parameters:
xid[IN] the transfer id to be used as key
pnfsreq[IN] the request pointer to cache
Returns:
DUPREQ_SUCCESS if successfull
.
DUPREQ_INSERT_MALLOC_ERROR if an error occured during the insertion process.

Definition at line 612 of file nfs_dupreq.c.

int nfs_dupreq_gc_function ( LRU_entry_t pentry,
void *  addparam 
)

nfs_dupreq_gc_function: Tests is an entry in dupreq cache is to be set invalid (has expired).

Tests is an entry in dupreq cache is to be set invalid (has expired).

Parameters:
pentry[IN] pointer to the entry to test
Returns:
1 if entry must be set invalid, 0 if not.
See also:
LRU_invalidate_by_function
LRU_gc_invalid

Definition at line 736 of file nfs_dupreq.c.

nfs_res_t nfs_dupreq_get ( struct svc_req *  req,
int *  pstatus 
)

nfs_dupreq_get: Tries to get a duplicated requests for dupreq cache

Tries to get a duplicated requests for dupreq cache.

Parameters:
req[IN] svc_req whose xid we are looking for
xprt[IN] xprt the related xprt (but we could use req->rq_xprt) XXX
pstatus[OUT] the pointer to the status for the operation
Returns:
the result previously set if *pstatus == DUPREQ_SUCCESS

Definition at line 675 of file nfs_dupreq.c.

void nfs_dupreq_get_stats ( hash_stat_t phstat_udp,
hash_stat_t phstat_tcp 
)

nfs_dupreq_get_stats: gets the hash table statistics for the duplicate requests.

Gets the hash table statistics for the duplicate requests.

Parameters:
phstat[OUT] pointer to the resulting stats.
Returns:
nothing (void function)
See also:
HashTable_GetStats

Definition at line 762 of file nfs_dupreq.c.

int nfs_Init_dupreq ( nfs_rpc_dupreq_parameter_t  param)

nfs_Init_dupreq: Init the hashtable and LRU for duplicate request cache

Perform all the required initialization for hashtable and LRU for duplicate request cache

Parameters:
param[IN] parameter used to init the duplicate request cache
Returns:
0 if successful, -1 otherwise

Definition at line 465 of file nfs_dupreq.c.

int print_entry_dupreq ( LRU_data_t  data,
char *  str 
)

print_entry_dupreq: prints an entry in the LRU list.

prints an entry in the LRU list.

Parameters:
data[IN] data stored in a LRU entry to be printed.
str[OUT] string used to store the result.
Returns:
0 if ok, other values mean an error.

Definition at line 127 of file nfs_dupreq.c.


Variable Documentation

Definition at line 85 of file nfs_dupreq.c.

Definition at line 84 of file nfs_dupreq.c.

Definition at line 229 of file nfs_worker_thread.c.

Definition at line 250 of file nfs_worker_thread.c.

Definition at line 93 of file nfs_worker_thread.c.

Definition at line 150 of file nfs_worker_thread.c.

Definition at line 221 of file nfs_worker_thread.c.