Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
dcache.h File Reference
#include <linux/atomic.h>
#include <linux/list.h>
#include <linux/rculist.h>
#include <linux/rculist_bl.h>
#include <linux/spinlock.h>
#include <linux/seqlock.h>
#include <linux/cache.h>
#include <linux/rcupdate.h>

Go to the source code of this file.

Data Structures

struct  qstr
 
struct  dentry_stat_t
 
struct  dentry
 
struct  dentry_operations
 

Macros

#define IS_ROOT(x)   ((x) == (x)->d_parent)
 
#define HASH_LEN_DECLARE   u32 len; u32 hash;
 
#define QSTR_INIT(n, l)   { { { .len = l } }, .name = n }
 
#define hashlen_hash(hashlen)   ((u32) (hashlen))
 
#define hashlen_len(hashlen)   ((u32)((hashlen) >> 32))
 
#define init_name_hash()   0
 
#define DNAME_INLINE_LEN   40 /* 128 bytes */
 
#define DCACHE_OP_HASH   0x0001
 
#define DCACHE_OP_COMPARE   0x0002
 
#define DCACHE_OP_REVALIDATE   0x0004
 
#define DCACHE_OP_DELETE   0x0008
 
#define DCACHE_OP_PRUNE   0x0010
 
#define DCACHE_DISCONNECTED   0x0020
 
#define DCACHE_REFERENCED   0x0040 /* Recently used, don't discard. */
 
#define DCACHE_RCUACCESS   0x0080 /* Entry has ever been RCU-visible */
 
#define DCACHE_CANT_MOUNT   0x0100
 
#define DCACHE_GENOCIDE   0x0200
 
#define DCACHE_SHRINK_LIST   0x0400
 
#define DCACHE_NFSFS_RENAMED   0x1000
 
#define DCACHE_COOKIE   0x2000 /* For use by dcookie subsystem */
 
#define DCACHE_FSNOTIFY_PARENT_WATCHED   0x4000
 
#define DCACHE_MOUNTED   0x10000 /* is a mountpoint */
 
#define DCACHE_NEED_AUTOMOUNT   0x20000 /* handle automount on this dir */
 
#define DCACHE_MANAGE_TRANSIT   0x40000 /* manage transit from this dirent */
 
#define DCACHE_NEED_LOOKUP   0x80000 /* dentry requires i_op->lookup */
 
#define DCACHE_MANAGED_DENTRY   (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
 
#define DCACHE_DENTRY_KILLED   0x100000
 

Enumerations

enum  dentry_d_lock_class { DENTRY_D_LOCK_NORMAL, DENTRY_D_LOCK_NESTED }
 

Functions

unsigned int full_name_hash (const unsigned char *, unsigned int)
 
void d_instantiate (struct dentry *, struct inode *)
 
struct dentryd_instantiate_unique (struct dentry *, struct inode *)
 
struct dentryd_materialise_unique (struct dentry *, struct inode *)
 
void __d_drop (struct dentry *dentry)
 
void d_drop (struct dentry *dentry)
 
void d_delete (struct dentry *)
 
void d_set_d_op (struct dentry *dentry, const struct dentry_operations *op)
 
struct dentryd_alloc (struct dentry *, const struct qstr *)
 
struct dentryd_alloc_pseudo (struct super_block *, const struct qstr *)
 
struct dentryd_splice_alias (struct inode *, struct dentry *)
 
struct dentryd_add_ci (struct dentry *, struct inode *, struct qstr *)
 
struct dentryd_find_any_alias (struct inode *inode)
 
struct dentryd_obtain_alias (struct inode *)
 
void shrink_dcache_sb (struct super_block *)
 
void shrink_dcache_parent (struct dentry *)
 
void shrink_dcache_for_umount (struct super_block *)
 
int d_invalidate (struct dentry *)
 
struct dentryd_make_root (struct inode *)
 
void d_genocide (struct dentry *)
 
struct dentryd_find_alias (struct inode *)
 
void d_prune_aliases (struct inode *)
 
int have_submounts (struct dentry *)
 
void d_rehash (struct dentry *)
 
void dentry_update_name_case (struct dentry *, struct qstr *)
 
void d_move (struct dentry *, struct dentry *)
 
struct dentryd_ancestor (struct dentry *, struct dentry *)
 
struct dentryd_lookup (struct dentry *, struct qstr *)
 
struct dentryd_hash_and_lookup (struct dentry *, struct qstr *)
 
struct dentry__d_lookup (struct dentry *, struct qstr *)
 
struct dentry__d_lookup_rcu (const struct dentry *parent, const struct qstr *name, unsigned *seq, struct inode *inode)
 
int d_validate (struct dentry *, struct dentry *)
 
chardynamic_dname (struct dentry *, char *, int, const char *,...)
 
char__d_path (const struct path *, const struct path *, char *, int)
 
chard_absolute_path (const struct path *, char *, int)
 
chard_path (const struct path *, char *, int)
 
chard_path_with_unreachable (const struct path *, char *, int)
 
chardentry_path_raw (struct dentry *, char *, int)
 
chardentry_path (struct dentry *, char *, int)
 
struct dentrydget_parent (struct dentry *dentry)
 
void dput (struct dentry *)
 
void d_clear_need_lookup (struct dentry *dentry)
 

Variables

struct dentry_stat_t dentry_stat
 
struct dentry_operations ____cacheline_aligned
 
seqlock_t rename_lock
 
int sysctl_vfs_cache_pressure
 

Macro Definition Documentation

#define DCACHE_CANT_MOUNT   0x0100

Definition at line 191 of file dcache.h.

#define DCACHE_COOKIE   0x2000 /* For use by dcookie subsystem */

Definition at line 198 of file dcache.h.

#define DCACHE_DENTRY_KILLED   0x100000

Definition at line 209 of file dcache.h.

#define DCACHE_DISCONNECTED   0x0020

Definition at line 177 of file dcache.h.

#define DCACHE_FSNOTIFY_PARENT_WATCHED   0x4000

Definition at line 199 of file dcache.h.

#define DCACHE_GENOCIDE   0x0200

Definition at line 192 of file dcache.h.

#define DCACHE_MANAGE_TRANSIT   0x40000 /* manage transit from this dirent */

Definition at line 204 of file dcache.h.

#define DCACHE_MANAGED_DENTRY   (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)

Definition at line 206 of file dcache.h.

#define DCACHE_MOUNTED   0x10000 /* is a mountpoint */

Definition at line 202 of file dcache.h.

#define DCACHE_NEED_AUTOMOUNT   0x20000 /* handle automount on this dir */

Definition at line 203 of file dcache.h.

#define DCACHE_NEED_LOOKUP   0x80000 /* dentry requires i_op->lookup */

Definition at line 205 of file dcache.h.

#define DCACHE_NFSFS_RENAMED   0x1000

Definition at line 195 of file dcache.h.

#define DCACHE_OP_COMPARE   0x0002

Definition at line 172 of file dcache.h.

#define DCACHE_OP_DELETE   0x0008

Definition at line 174 of file dcache.h.

#define DCACHE_OP_HASH   0x0001

Definition at line 171 of file dcache.h.

#define DCACHE_OP_PRUNE   0x0010

Definition at line 175 of file dcache.h.

#define DCACHE_OP_REVALIDATE   0x0004

Definition at line 173 of file dcache.h.

#define DCACHE_RCUACCESS   0x0080 /* Entry has ever been RCU-visible */

Definition at line 189 of file dcache.h.

#define DCACHE_REFERENCED   0x0040 /* Recently used, don't discard. */

Definition at line 188 of file dcache.h.

#define DCACHE_SHRINK_LIST   0x0400

Definition at line 193 of file dcache.h.

#define DNAME_INLINE_LEN   40 /* 128 bytes */

Definition at line 99 of file dcache.h.

#define HASH_LEN_DECLARE   u32 len; u32 hash;

Definition at line 32 of file dcache.h.

#define hashlen_hash (   hashlen)    ((u32) (hashlen))

Definition at line 53 of file dcache.h.

#define hashlen_len (   hashlen)    ((u32)((hashlen) >> 32))

Definition at line 54 of file dcache.h.

#define init_name_hash ( )    0

Definition at line 67 of file dcache.h.

#define IS_ROOT (   x)    ((x) == (x)->d_parent)

Definition at line 26 of file dcache.h.

#define QSTR_INIT (   n,
  l 
)    { { { .len = l } }, .name = n }

Definition at line 52 of file dcache.h.

Enumeration Type Documentation

Enumerator:
DENTRY_D_LOCK_NORMAL 
DENTRY_D_LOCK_NESTED 

Definition at line 140 of file dcache.h.

Function Documentation

void __d_drop ( struct dentry dentry)

d_drop - drop a dentry : dentry to drop

d_drop() unhashes the entry from the parent dentry hashes, so that it won't be found through a VFS lookup any more. Note that this is different from deleting the dentry - d_delete will try to mark the dentry negative if possible, giving a successful negative lookup, while d_drop will just make the cache lookup fail.

d_drop() is used mainly for stuff that wants to invalidate a dentry for some reason (NFS timeouts or autofs deletes).

__d_drop requires dentry->d_lock.

Definition at line 440 of file dcache.c.

struct dentry* __d_lookup ( struct dentry ,
struct qstr  
)
read

Definition at line 1953 of file dcache.c.

struct dentry* __d_lookup_rcu ( const struct dentry parent,
const struct qstr name,
unsigned *  seq,
struct inode inode 
)
read

Definition at line 1835 of file dcache.c.

char* __d_path ( const struct path path,
const struct path root,
char buf,
int  buflen 
)

__d_path - return the path of a dentry : the dentry/vfsmount to report : root vfsmnt/dentry : buffer to return value in : buffer length

Convert a dentry into an ASCII path name.

Returns a pointer into the buffer or an error code if the path was too long.

"buflen" should be positive.

If the path is not reachable from the supplied root, return NULL.

Definition at line 2653 of file dcache.c.

char* d_absolute_path ( const struct path ,
char ,
int   
)

Definition at line 2672 of file dcache.c.

struct dentry* d_add_ci ( struct dentry ,
struct inode ,
struct qstr  
)
read

Definition at line 1696 of file dcache.c.

struct dentry* d_alloc ( struct dentry ,
const struct qstr  
)
read

Definition at line 1339 of file dcache.c.

struct dentry* d_alloc_pseudo ( struct super_block ,
const struct qstr  
)
read

Definition at line 1359 of file dcache.c.

struct dentry* d_ancestor ( struct dentry p1,
struct dentry p2 
)
read

d_ancestor - search for an ancestor : ancestor dentry : child dentry

Returns the ancestor dentry of p2 which is a child of p1, if p1 is an ancestor of p2, else NULL.

Definition at line 2370 of file dcache.c.

void d_clear_need_lookup ( struct dentry dentry)

Definition at line 466 of file dcache.c.

void d_delete ( struct dentry dentry)

d_delete - delete a dentry : The dentry to delete

Turn the dentry into a negative dentry if possible, otherwise remove it from the hash queues so it can be deleted later

Definition at line 2104 of file dcache.c.

void d_drop ( struct dentry dentry)

Definition at line 449 of file dcache.c.

struct dentry* d_find_alias ( struct inode )
read

Definition at line 737 of file dcache.c.

struct dentry* d_find_any_alias ( struct inode inode)
read

d_find_any_alias - find any alias for a given inode : inode to find an alias for

If any aliases exist for the given inode, take and return a reference for one of them. If no aliases exist, return NULL.

Definition at line 1555 of file dcache.c.

void d_genocide ( struct dentry )

Definition at line 2985 of file dcache.c.

struct dentry* d_hash_and_lookup ( struct dentry ,
struct qstr  
)
read

Definition at line 2033 of file dcache.c.

void d_instantiate ( struct dentry entry,
struct inode inode 
)

d_instantiate - fill in inode information for a dentry : dentry to complete : inode to attach to this dentry

Fill in inode information in the entry.

This turns negative dentries into productive full members of society.

NOTE! This assumes that the inode count has been incremented (or otherwise set) by the caller to indicate that it is now in use by the dcache.

Definition at line 1432 of file dcache.c.

struct dentry* d_instantiate_unique ( struct dentry ,
struct inode  
)
read

Definition at line 1496 of file dcache.c.

int d_invalidate ( struct dentry dentry)

d_invalidate - invalidate a dentry : dentry to invalidate

Try to invalidate the dentry if it turns out to be possible. If there are other dentries that can be reached through this one we can't delete it and we return -EBUSY. On success we return 0.

no dcache lock.

Definition at line 600 of file dcache.c.

struct dentry* d_lookup ( struct dentry ,
struct qstr  
)
read

Definition at line 1923 of file dcache.c.

struct dentry* d_make_root ( struct inode )
read

Definition at line 1520 of file dcache.c.

struct dentry* d_materialise_unique ( struct dentry dentry,
struct inode inode 
)
read

d_materialise_unique - introduce an inode into the tree : candidate dentry : inode to bind to the dentry, to which aliases may be attached

Introduces an dentry into the tree, substituting an extant disconnected root directory alias in its place if there is one. Caller must hold the i_mutex of the parent directory.

Definition at line 2474 of file dcache.c.

void d_move ( struct dentry ,
struct dentry  
)

Definition at line 2354 of file dcache.c.

struct dentry* d_obtain_alias ( struct inode inode)
read

d_obtain_alias - find or allocate a dentry for a given inode : inode to allocate the dentry for

Obtain a dentry for an inode resulting from NFS filehandle conversion or similar open by handle operations. The returned dentry may be anonymous, or may have a full name (if the inode was already in the cache).

When called on a directory inode, we must ensure that the inode only ever has one dentry. If a dentry is found, that is returned instead of allocating a new one.

On successful return, the reference to the inode has been transferred to the dentry. In case of an error the reference on the inode is released. To make it easier to use in export operations a NULL or IS_ERR inode may be passed in and will be the error will be propagate to the return value, with a NULL replaced by ERR_PTR(-ESTALE).

Definition at line 1584 of file dcache.c.

char* d_path ( const struct path path,
char buf,
int  buflen 
)

d_path - return the path of a dentry : path to report : buffer to return value in : buffer length

Convert a dentry into an ASCII path name. If the entry has been deleted the string " (deleted)" is appended. Note that this is ambiguous.

Returns a pointer into the buffer or an error code if the path was too long. Note: Callers should use the returned pointer, not the passed in buffer, to use the name! The implementation often starts at an offset into the buffer, and may leave 0 bytes at the start.

"buflen" should be positive.

Definition at line 2729 of file dcache.c.

char* d_path_with_unreachable ( const struct path path,
char buf,
int  buflen 
)

d_path_with_unreachable - return the path of a dentry : path to report : buffer to return value in : buffer length

The difference from d_path() is that this prepends "(unreachable)" to paths which are unreachable from the current process' root.

Definition at line 2765 of file dcache.c.

void d_prune_aliases ( struct inode )

Definition at line 754 of file dcache.c.

void d_rehash ( struct dentry entry)

d_rehash - add an entry back to the hash : dentry to add to the hash

Adds a dentry to the hash according to its name.

Definition at line 2157 of file dcache.c.

void d_set_d_op ( struct dentry dentry,
const struct dentry_operations op 
)

Definition at line 1379 of file dcache.c.

struct dentry* d_splice_alias ( struct inode inode,
struct dentry dentry 
)
read

d_splice_alias - splice a disconnected dentry into the tree if one exists : the inode which may have a disconnected dentry : a negative dentry which we want to point to the inode.

If inode is a directory and has a 'disconnected' dentry (i.e. IS_ROOT and DCACHE_DISCONNECTED), then d_move that in place of the given dentry and return it, else simply d_add the inode to the dentry and return NULL.

This is needed in the lookup routine of any filesystem that is exportable (via knfsd) so that we can build dcache paths to directories effectively.

If a dentry was found and moved, then it is returned. Otherwise NULL is returned. This matches the expected return value of ->lookup.

Definition at line 1651 of file dcache.c.

int d_validate ( struct dentry dentry,
struct dentry dparent 
)

d_validate - verify dentry provided from insecure source (deprecated) : The dentry alleged to be valid child of : The parent dentry (known to be valid)

An insecure source has sent us a dentry, here we verify it and dget() it. This is used by ncpfs in its readdir implementation. Zero is returned in the dentry is invalid.

This function is slow for big directories, and deprecated, do not use it.

Definition at line 2063 of file dcache.c.

char* dentry_path ( struct dentry ,
char ,
int   
)

Definition at line 2854 of file dcache.c.

char* dentry_path_raw ( struct dentry ,
char ,
int   
)

Definition at line 2842 of file dcache.c.

void dentry_update_name_case ( struct dentry ,
struct qstr  
)

Definition at line 2179 of file dcache.c.

struct dentry* dget_parent ( struct dentry dentry)
read

Definition at line 658 of file dcache.c.

void dput ( struct dentry )

Definition at line 543 of file dcache.c.

char* dynamic_dname ( struct dentry ,
char ,
int  ,
const char ,
  ... 
)

Definition at line 2790 of file dcache.c.

unsigned int full_name_hash ( const unsigned char ,
unsigned  int 
)

Definition at line 1730 of file namei.c.

int have_submounts ( struct dentry parent)

have_submounts - check for mounts over a dentry : dentry to check.

Return true if the parent or its subdirectories contain a mount point

Definition at line 1074 of file dcache.c.

void shrink_dcache_for_umount ( struct super_block )

Definition at line 1014 of file dcache.c.

void shrink_dcache_parent ( struct dentry parent)

shrink_dcache_parent - prune dcache : parent of entries to prune

Prune the dcache to remove unused children of the parent dentry.

Definition at line 1254 of file dcache.c.

void shrink_dcache_sb ( struct super_block sb)

shrink_dcache_sb - shrink dcache for a superblock : superblock

Shrink the dcache for the specified super block. This is used to free the dcache before unmounting a file system.

Definition at line 910 of file dcache.c.

Variable Documentation

struct dentry_stat_t dentry_stat

Definition at line 116 of file dcache.c.

seqlock_t rename_lock
int sysctl_vfs_cache_pressure