nfs-ganesha 1.4
Classes | Typedefs | Enumerations | Functions

nfs_dupreq.h File Reference

#include "ganesha_rpc.h"
#include "HashData.h"
#include "HashTable.h"
#include "nfs_core.h"
#include "nfs23.h"
#include "nfs4.h"
#include "fsal.h"
#include "nfs_tools.h"

Go to the source code of this file.

Classes

struct  dupreq_key__
struct  dupreq_entry__

Typedefs

typedef struct dupreq_key__ dupreq_key_t
typedef struct dupreq_entry__ dupreq_entry_t
typedef enum dupreq_status dupreq_status_t

Enumerations

enum  dupreq_status {
  DUPREQ_SUCCESS = 0, DUPREQ_INSERT_MALLOC_ERROR, DUPREQ_NOT_FOUND, DUPREQ_BEING_PROCESSED,
  DUPREQ_ALREADY_EXISTS
}

Functions

int compare_req (hash_buffer_t *buff1, hash_buffer_t *buff2)
int print_entry_dupreq (LRU_data_t data, char *str)
int clean_entry_dupreq (LRU_entry_t *pentry, void *addparam)
int nfs_dupreq_gc_function (LRU_entry_t *pentry, void *addparam)
nfs_res_t nfs_dupreq_get (struct svc_req *req, int *pstatus)
int nfs_dupreq_delete (struct svc_req *req)
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)
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)
void nfs_dupreq_get_stats (hash_stat_t *phstat_udp, hash_stat_t *phstat_tcp)

Detailed Description

Prototypes for duplicate requsts cache management.

Definition in file nfs_dupreq.h.


Typedef Documentation

typedef struct dupreq_key__ dupreq_key_t

Enumeration Type Documentation

Enumerator:
DUPREQ_SUCCESS 
DUPREQ_INSERT_MALLOC_ERROR 
DUPREQ_NOT_FOUND 
DUPREQ_BEING_PROCESSED 
DUPREQ_ALREADY_EXISTS 

Definition at line 107 of file nfs_dupreq.h.


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.

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.

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