Linux Kernel
3.7.1
|
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/seq_file.h>
#include <linux/lru_cache.h>
Go to the source code of this file.
Macros | |
#define | PARANOIA_ENTRY() |
#define | RETURN(x...) |
#define | PARANOIA_LC_ELEMENT(lc, e) |
#define PARANOIA_ENTRY | ( | ) |
Definition at line 40 of file lru_cache.c.
#define RETURN | ( | x... | ) |
Definition at line 46 of file lru_cache.c.
EXPORT_SYMBOL | ( | lc_create | ) |
EXPORT_SYMBOL | ( | lc_reset | ) |
EXPORT_SYMBOL | ( | lc_destroy | ) |
EXPORT_SYMBOL | ( | lc_set | ) |
EXPORT_SYMBOL | ( | lc_del | ) |
EXPORT_SYMBOL | ( | lc_try_get | ) |
EXPORT_SYMBOL | ( | lc_find | ) |
EXPORT_SYMBOL | ( | lc_get | ) |
EXPORT_SYMBOL | ( | lc_put | ) |
EXPORT_SYMBOL | ( | lc_changed | ) |
EXPORT_SYMBOL | ( | lc_element_by_index | ) |
EXPORT_SYMBOL | ( | lc_index_of | ) |
EXPORT_SYMBOL | ( | lc_seq_printf_stats | ) |
EXPORT_SYMBOL | ( | lc_seq_dump_details | ) |
void lc_changed | ( | struct lru_cache * | lc, |
struct lc_element * | e | ||
) |
lc_changed - tell that the change has been recorded : the lru cache to operate on : the element pending label change
Definition at line 430 of file lru_cache.c.
|
read |
Definition at line 68 of file lru_cache.c.
void lc_del | ( | struct lru_cache * | lc, |
struct lc_element * | e | ||
) |
lc_destroy - frees memory allocated by lc_create() : the lru cache to destroy
Definition at line 152 of file lru_cache.c.
|
read |
lc_element_by_index : the lru cache to operate on : the index of the element to return
Definition at line 477 of file lru_cache.c.
|
read |
lc_find - find element by label, if present in the hash table : The lru_cache object : element number
Returns the pointer to an element, if the element with the requested "label" or element number is present in the hash table, or NULL if not found. Does not change the refcnt.
Definition at line 236 of file lru_cache.c.
Definition at line 138 of file lru_cache.c.
|
read |
lc_get - get element by label, maybe change the active set : the lru cache to operate on : the label to look up
Finds an element in the cache, increases its usage count, "touches" and returns it.
In case the requested number is not present, it needs to be added to the cache. Therefore it is possible that an other element becomes evicted from the cache. In either case, the user is notified so he is able to e.g. keep a persistent log of the cache changes, and therefore the objects in use.
Return values: NULL The cache was marked LC_STARVING, or the requested label was not in the active set and a changing transaction is still pending ( was marked LC_DIRTY). Or no unused or free element could be recycled ( will be marked as LC_STARVING, blocking further lc_get() operations).
pointer to the element with the REQUESTED element number. In this case, it can be used right away
pointer to an UNUSED element with some different element number, where that different number may also be LC_FREE.
In this case, the cache is marked LC_DIRTY (blocking further changes), and the returned element pointer is removed from the lru list and hash collision chains. The user now should do whatever housekeeping is necessary. Then he must call lc_changed(lc,element_pointer), to finish the change.
NOTE: The user needs to check the lc_number on EACH use, so he recognizes any cache set change.
Definition at line 349 of file lru_cache.c.
unsigned int lc_index_of | ( | struct lru_cache * | lc, |
struct lc_element * | e | ||
) |
lc_index_of : the lru cache to operate on : the element to query for its index position in lc->element
Definition at line 490 of file lru_cache.c.
unsigned int lc_put | ( | struct lru_cache * | lc, |
struct lc_element * | e | ||
) |
void lc_seq_dump_details | ( | struct seq_file * | seq, |
struct lru_cache * | lc, | ||
char * | utext, | ||
void(*)(struct seq_file *, struct lc_element *) | detail | ||
) |
lc_dump - Dump a complete LRU cache to seq in textual form. : the lru cache to operate on : the &struct seq_file pointer to seq_printf into : user supplied "heading" or other info : function pointer the user may provide to dump further details of the object the lc_element is embedded in.
Definition at line 527 of file lru_cache.c.
lc_seq_printf_stats - print stats about into : the seq_file to print into : the lru cache to print statistics of
Definition at line 206 of file lru_cache.c.
|
read |
Definition at line 405 of file lru_cache.c.
MODULE_AUTHOR | ( | "Philipp Reisner <[email protected]> | , |
""Lars Ellenberg< lars @linbit.com >" | |||
) |
MODULE_DESCRIPTION | ( | "lru_cache - Track sets of hot objects" | ) |
MODULE_LICENSE | ( | "GPL" | ) |