nfs-ganesha 1.4
Functions

cache_inode_weakref.h File Reference

Generic weak reference package. More...

#include "log.h"
#include "cache_inode.h"
#include "generic_weakref.h"

Go to the source code of this file.

Functions

void cache_inode_weakref_init (void)
 Init package.
gweakref_t cache_inode_weakref_insert (struct cache_entry_t *entry)
 Install an entry in the weakref table.
cache_entry_tcache_inode_weakref_get (gweakref_t *ref, uint32_t flags)
 Get a reference from the weakref.
void cache_inode_weakref_delete (gweakref_t *ref)
 Delete a reference from the table.
void cache_inode_weakref_shutdown ()
 Clean up on shutdown.

Detailed Description

Generic weak reference package.

Author:
Matt Benjamin

DESCRIPTION

Manage weak references to cache inode objects (e.g., references from directory entries).

Definition in file cache_inode_weakref.h.


Function Documentation

void cache_inode_weakref_delete ( gweakref_t ref)

Delete a reference from the table.

This function deletes a weak reference and is expected to be used only by cache_inode_lru_unref, cache_inode_get, and cache_inode_kill_entry.

Parameters:
[in]refThe entry to delete

Definition at line 146 of file cache_inode_weakref.c.

cache_entry_t* cache_inode_weakref_get ( gweakref_t ref,
uint32_t  flags 
)

Get a reference from the weakref.

Attempt to get a reference on a weakref. In order to prevent a race condition, the function retains the read lock on the table (blocking any delete) and acquires the mutex on the lru entry before releasing it. If the entry has type RECYCLED or cache_inode_lru_ref fails (which it will if the refcount has dropped to 0) it will act as if the entry has not existed.

See also:
cache_inode_lru_unref for the other half of the story.
Parameters:
[in]refThe weakref from which to derive a reference
[in]flagsFlags passed in to cache_inode_lru_ref, for scan resistance
Returns:
A pointer to the cache_entry_t on success, or NULL on failure.

Definition at line 117 of file cache_inode_weakref.c.

void cache_inode_weakref_init ( void  )

Init package.

Create the global reference table.

Definition at line 75 of file cache_inode_weakref.c.

gweakref_t cache_inode_weakref_insert ( cache_entry_t entry)

Install an entry in the weakref table.

This function installs an entry in the weakref table. The caller must already hold a reference to it. It is expected this function will only be called by cache_inode_new_entry.

Parameters:
[in]entryThe entry to be installed
Returns:
The weak reference created

Definition at line 92 of file cache_inode_weakref.c.

void cache_inode_weakref_shutdown ( )

Clean up on shutdown.

Destroy the weakref table and free all resources associated with it.

Definition at line 157 of file cache_inode_weakref.c.