4 * Complete reimplementation
5 * (C) 1997 Thomas Schoebel-Theuer,
6 * with heavy changes by Linus Torvalds
10 * Notes on the allocation strategy:
12 * The dcache is a master of the icache - whenever a dcache entry
13 * exists, the inode will always exist. "iput()" is done either when
14 * the dcache entry is deleted or garbage collected.
17 #include <linux/config.h>
18 #include <linux/syscalls.h>
19 #include <linux/string.h>
22 #include <linux/fsnotify.h>
23 #include <linux/slab.h>
24 #include <linux/init.h>
25 #include <linux/smp_lock.h>
26 #include <linux/hash.h>
27 #include <linux/cache.h>
28 #include <linux/module.h>
29 #include <linux/mount.h>
30 #include <linux/file.h>
31 #include <asm/uaccess.h>
32 #include <linux/security.h>
33 #include <linux/seqlock.h>
34 #include <linux/swap.h>
35 #include <linux/bootmem.h>
37 /* #define DCACHE_DEBUG 1 */
39 int sysctl_vfs_cache_pressure __read_mostly
= 100;
40 EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure
);
42 __cacheline_aligned_in_smp
DEFINE_SPINLOCK(dcache_lock
);
43 static seqlock_t rename_lock __cacheline_aligned_in_smp
= SEQLOCK_UNLOCKED
;
45 EXPORT_SYMBOL(dcache_lock
);
47 static kmem_cache_t
*dentry_cache __read_mostly
;
49 #define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname))
52 * This is the single most critical data structure when it comes
53 * to the dcache: the hashtable for lookups. Somebody should try
54 * to make this good - I've just made it work.
56 * This hash-function tries to avoid losing too many bits of hash
57 * information, yet avoid using a prime hash-size or similar.
59 #define D_HASHBITS d_hash_shift
60 #define D_HASHMASK d_hash_mask
62 static unsigned int d_hash_mask __read_mostly
;
63 static unsigned int d_hash_shift __read_mostly
;
64 static struct hlist_head
*dentry_hashtable __read_mostly
;
65 static LIST_HEAD(dentry_unused
);
67 /* Statistics gathering. */
68 struct dentry_stat_t dentry_stat
= {
72 static void d_callback(struct rcu_head
*head
)
74 struct dentry
* dentry
= container_of(head
, struct dentry
, d_u
.d_rcu
);
76 if (dname_external(dentry
))
77 kfree(dentry
->d_name
.name
);
78 kmem_cache_free(dentry_cache
, dentry
);
82 * no dcache_lock, please. The caller must decrement dentry_stat.nr_dentry
85 static void d_free(struct dentry
*dentry
)
87 if (dentry
->d_op
&& dentry
->d_op
->d_release
)
88 dentry
->d_op
->d_release(dentry
);
89 call_rcu(&dentry
->d_u
.d_rcu
, d_callback
);
93 * Release the dentry's inode, using the filesystem
94 * d_iput() operation if defined.
95 * Called with dcache_lock and per dentry lock held, drops both.
97 static void dentry_iput(struct dentry
* dentry
)
99 struct inode
*inode
= dentry
->d_inode
;
101 dentry
->d_inode
= NULL
;
102 list_del_init(&dentry
->d_alias
);
103 spin_unlock(&dentry
->d_lock
);
104 spin_unlock(&dcache_lock
);
106 fsnotify_inoderemove(inode
);
107 if (dentry
->d_op
&& dentry
->d_op
->d_iput
)
108 dentry
->d_op
->d_iput(dentry
, inode
);
112 spin_unlock(&dentry
->d_lock
);
113 spin_unlock(&dcache_lock
);
120 * This is complicated by the fact that we do not want to put
121 * dentries that are no longer on any hash chain on the unused
122 * list: we'd much rather just get rid of them immediately.
124 * However, that implies that we have to traverse the dentry
125 * tree upwards to the parents which might _also_ now be
126 * scheduled for deletion (it may have been only waiting for
127 * its last child to go away).
129 * This tail recursion is done by hand as we don't want to depend
130 * on the compiler to always get this right (gcc generally doesn't).
131 * Real recursion would eat up our stack space.
135 * dput - release a dentry
136 * @dentry: dentry to release
138 * Release a dentry. This will drop the usage count and if appropriate
139 * call the dentry unlink method as well as removing it from the queues and
140 * releasing its resources. If the parent dentries were scheduled for release
141 * they too may now get deleted.
143 * no dcache lock, please.
146 void dput(struct dentry
*dentry
)
152 if (atomic_read(&dentry
->d_count
) == 1)
154 if (!atomic_dec_and_lock(&dentry
->d_count
, &dcache_lock
))
157 spin_lock(&dentry
->d_lock
);
158 if (atomic_read(&dentry
->d_count
)) {
159 spin_unlock(&dentry
->d_lock
);
160 spin_unlock(&dcache_lock
);
165 * AV: ->d_delete() is _NOT_ allowed to block now.
167 if (dentry
->d_op
&& dentry
->d_op
->d_delete
) {
168 if (dentry
->d_op
->d_delete(dentry
))
171 /* Unreachable? Get rid of it */
172 if (d_unhashed(dentry
))
174 if (list_empty(&dentry
->d_lru
)) {
175 dentry
->d_flags
|= DCACHE_REFERENCED
;
176 list_add(&dentry
->d_lru
, &dentry_unused
);
177 dentry_stat
.nr_unused
++;
179 spin_unlock(&dentry
->d_lock
);
180 spin_unlock(&dcache_lock
);
187 struct dentry
*parent
;
189 /* If dentry was on d_lru list
190 * delete it from there
192 if (!list_empty(&dentry
->d_lru
)) {
193 list_del(&dentry
->d_lru
);
194 dentry_stat
.nr_unused
--;
196 list_del(&dentry
->d_u
.d_child
);
197 dentry_stat
.nr_dentry
--; /* For d_free, below */
198 /*drops the locks, at that point nobody can reach this dentry */
200 parent
= dentry
->d_parent
;
202 if (dentry
== parent
)
210 * d_invalidate - invalidate a dentry
211 * @dentry: dentry to invalidate
213 * Try to invalidate the dentry if it turns out to be
214 * possible. If there are other dentries that can be
215 * reached through this one we can't delete it and we
216 * return -EBUSY. On success we return 0.
221 int d_invalidate(struct dentry
* dentry
)
224 * If it's already been dropped, return OK.
226 spin_lock(&dcache_lock
);
227 if (d_unhashed(dentry
)) {
228 spin_unlock(&dcache_lock
);
232 * Check whether to do a partial shrink_dcache
233 * to get rid of unused child entries.
235 if (!list_empty(&dentry
->d_subdirs
)) {
236 spin_unlock(&dcache_lock
);
237 shrink_dcache_parent(dentry
);
238 spin_lock(&dcache_lock
);
242 * Somebody else still using it?
244 * If it's a directory, we can't drop it
245 * for fear of somebody re-populating it
246 * with children (even though dropping it
247 * would make it unreachable from the root,
248 * we might still populate it if it was a
249 * working directory or similar).
251 spin_lock(&dentry
->d_lock
);
252 if (atomic_read(&dentry
->d_count
) > 1) {
253 if (dentry
->d_inode
&& S_ISDIR(dentry
->d_inode
->i_mode
)) {
254 spin_unlock(&dentry
->d_lock
);
255 spin_unlock(&dcache_lock
);
261 spin_unlock(&dentry
->d_lock
);
262 spin_unlock(&dcache_lock
);
266 /* This should be called _only_ with dcache_lock held */
268 static inline struct dentry
* __dget_locked(struct dentry
*dentry
)
270 atomic_inc(&dentry
->d_count
);
271 if (!list_empty(&dentry
->d_lru
)) {
272 dentry_stat
.nr_unused
--;
273 list_del_init(&dentry
->d_lru
);
278 struct dentry
* dget_locked(struct dentry
*dentry
)
280 return __dget_locked(dentry
);
284 * d_find_alias - grab a hashed alias of inode
285 * @inode: inode in question
286 * @want_discon: flag, used by d_splice_alias, to request
287 * that only a DISCONNECTED alias be returned.
289 * If inode has a hashed alias, or is a directory and has any alias,
290 * acquire the reference to alias and return it. Otherwise return NULL.
291 * Notice that if inode is a directory there can be only one alias and
292 * it can be unhashed only if it has no children, or if it is the root
295 * If the inode has a DCACHE_DISCONNECTED alias, then prefer
296 * any other hashed alias over that one unless @want_discon is set,
297 * in which case only return a DCACHE_DISCONNECTED alias.
300 static struct dentry
* __d_find_alias(struct inode
*inode
, int want_discon
)
302 struct list_head
*head
, *next
, *tmp
;
303 struct dentry
*alias
, *discon_alias
=NULL
;
305 head
= &inode
->i_dentry
;
306 next
= inode
->i_dentry
.next
;
307 while (next
!= head
) {
311 alias
= list_entry(tmp
, struct dentry
, d_alias
);
312 if (S_ISDIR(inode
->i_mode
) || !d_unhashed(alias
)) {
313 if (alias
->d_flags
& DCACHE_DISCONNECTED
)
314 discon_alias
= alias
;
315 else if (!want_discon
) {
316 __dget_locked(alias
);
322 __dget_locked(discon_alias
);
326 struct dentry
* d_find_alias(struct inode
*inode
)
328 struct dentry
*de
= NULL
;
330 if (!list_empty(&inode
->i_dentry
)) {
331 spin_lock(&dcache_lock
);
332 de
= __d_find_alias(inode
, 0);
333 spin_unlock(&dcache_lock
);
339 * Try to kill dentries associated with this inode.
340 * WARNING: you must own a reference to inode.
342 void d_prune_aliases(struct inode
*inode
)
344 struct dentry
*dentry
;
346 spin_lock(&dcache_lock
);
347 list_for_each_entry(dentry
, &inode
->i_dentry
, d_alias
) {
348 spin_lock(&dentry
->d_lock
);
349 if (!atomic_read(&dentry
->d_count
)) {
350 __dget_locked(dentry
);
352 spin_unlock(&dentry
->d_lock
);
353 spin_unlock(&dcache_lock
);
357 spin_unlock(&dentry
->d_lock
);
359 spin_unlock(&dcache_lock
);
363 * Throw away a dentry - free the inode, dput the parent.
364 * This requires that the LRU list has already been
366 * Called with dcache_lock, drops it and then regains.
368 static inline void prune_one_dentry(struct dentry
* dentry
)
370 struct dentry
* parent
;
373 list_del(&dentry
->d_u
.d_child
);
374 dentry_stat
.nr_dentry
--; /* For d_free, below */
376 parent
= dentry
->d_parent
;
378 if (parent
!= dentry
)
380 spin_lock(&dcache_lock
);
384 * prune_dcache - shrink the dcache
385 * @count: number of entries to try and free
387 * Shrink the dcache. This is done when we need
388 * more memory, or simply when we need to unmount
389 * something (at which point we need to unuse
392 * This function may fail to free any resources if
393 * all the dentries are in use.
396 static void prune_dcache(int count
)
398 spin_lock(&dcache_lock
);
399 for (; count
; count
--) {
400 struct dentry
*dentry
;
401 struct list_head
*tmp
;
403 cond_resched_lock(&dcache_lock
);
405 tmp
= dentry_unused
.prev
;
406 if (tmp
== &dentry_unused
)
409 prefetch(dentry_unused
.prev
);
410 dentry_stat
.nr_unused
--;
411 dentry
= list_entry(tmp
, struct dentry
, d_lru
);
413 spin_lock(&dentry
->d_lock
);
415 * We found an inuse dentry which was not removed from
416 * dentry_unused because of laziness during lookup. Do not free
417 * it - just keep it off the dentry_unused list.
419 if (atomic_read(&dentry
->d_count
)) {
420 spin_unlock(&dentry
->d_lock
);
423 /* If the dentry was recently referenced, don't free it. */
424 if (dentry
->d_flags
& DCACHE_REFERENCED
) {
425 dentry
->d_flags
&= ~DCACHE_REFERENCED
;
426 list_add(&dentry
->d_lru
, &dentry_unused
);
427 dentry_stat
.nr_unused
++;
428 spin_unlock(&dentry
->d_lock
);
431 prune_one_dentry(dentry
);
433 spin_unlock(&dcache_lock
);
437 * Shrink the dcache for the specified super block.
438 * This allows us to unmount a device without disturbing
439 * the dcache for the other devices.
441 * This implementation makes just two traversals of the
442 * unused list. On the first pass we move the selected
443 * dentries to the most recent end, and on the second
444 * pass we free them. The second pass must restart after
445 * each dput(), but since the target dentries are all at
446 * the end, it's really just a single traversal.
450 * shrink_dcache_sb - shrink dcache for a superblock
453 * Shrink the dcache for the specified super block. This
454 * is used to free the dcache before unmounting a file
458 void shrink_dcache_sb(struct super_block
* sb
)
460 struct list_head
*tmp
, *next
;
461 struct dentry
*dentry
;
464 * Pass one ... move the dentries for the specified
465 * superblock to the most recent end of the unused list.
467 spin_lock(&dcache_lock
);
468 list_for_each_safe(tmp
, next
, &dentry_unused
) {
469 dentry
= list_entry(tmp
, struct dentry
, d_lru
);
470 if (dentry
->d_sb
!= sb
)
473 list_add(tmp
, &dentry_unused
);
477 * Pass two ... free the dentries for this superblock.
480 list_for_each_safe(tmp
, next
, &dentry_unused
) {
481 dentry
= list_entry(tmp
, struct dentry
, d_lru
);
482 if (dentry
->d_sb
!= sb
)
484 dentry_stat
.nr_unused
--;
486 spin_lock(&dentry
->d_lock
);
487 if (atomic_read(&dentry
->d_count
)) {
488 spin_unlock(&dentry
->d_lock
);
491 prune_one_dentry(dentry
);
492 cond_resched_lock(&dcache_lock
);
495 spin_unlock(&dcache_lock
);
499 * Search for at least 1 mount point in the dentry's subdirs.
500 * We descend to the next level whenever the d_subdirs
501 * list is non-empty and continue searching.
505 * have_submounts - check for mounts over a dentry
506 * @parent: dentry to check.
508 * Return true if the parent or its subdirectories contain
512 int have_submounts(struct dentry
*parent
)
514 struct dentry
*this_parent
= parent
;
515 struct list_head
*next
;
517 spin_lock(&dcache_lock
);
518 if (d_mountpoint(parent
))
521 next
= this_parent
->d_subdirs
.next
;
523 while (next
!= &this_parent
->d_subdirs
) {
524 struct list_head
*tmp
= next
;
525 struct dentry
*dentry
= list_entry(tmp
, struct dentry
, d_u
.d_child
);
527 /* Have we found a mount point ? */
528 if (d_mountpoint(dentry
))
530 if (!list_empty(&dentry
->d_subdirs
)) {
531 this_parent
= dentry
;
536 * All done at this level ... ascend and resume the search.
538 if (this_parent
!= parent
) {
539 next
= this_parent
->d_u
.d_child
.next
;
540 this_parent
= this_parent
->d_parent
;
543 spin_unlock(&dcache_lock
);
544 return 0; /* No mount points found in tree */
546 spin_unlock(&dcache_lock
);
551 * Search the dentry child list for the specified parent,
552 * and move any unused dentries to the end of the unused
553 * list for prune_dcache(). We descend to the next level
554 * whenever the d_subdirs list is non-empty and continue
557 * It returns zero iff there are no unused children,
558 * otherwise it returns the number of children moved to
559 * the end of the unused list. This may not be the total
560 * number of unused children, because select_parent can
561 * drop the lock and return early due to latency
564 static int select_parent(struct dentry
* parent
)
566 struct dentry
*this_parent
= parent
;
567 struct list_head
*next
;
570 spin_lock(&dcache_lock
);
572 next
= this_parent
->d_subdirs
.next
;
574 while (next
!= &this_parent
->d_subdirs
) {
575 struct list_head
*tmp
= next
;
576 struct dentry
*dentry
= list_entry(tmp
, struct dentry
, d_u
.d_child
);
579 if (!list_empty(&dentry
->d_lru
)) {
580 dentry_stat
.nr_unused
--;
581 list_del_init(&dentry
->d_lru
);
584 * move only zero ref count dentries to the end
585 * of the unused list for prune_dcache
587 if (!atomic_read(&dentry
->d_count
)) {
588 list_add(&dentry
->d_lru
, dentry_unused
.prev
);
589 dentry_stat
.nr_unused
++;
594 * We can return to the caller if we have found some (this
595 * ensures forward progress). We'll be coming back to find
598 if (found
&& need_resched())
602 * Descend a level if the d_subdirs list is non-empty.
604 if (!list_empty(&dentry
->d_subdirs
)) {
605 this_parent
= dentry
;
607 printk(KERN_DEBUG
"select_parent: descending to %s/%s, found=%d\n",
608 dentry
->d_parent
->d_name
.name
, dentry
->d_name
.name
, found
);
614 * All done at this level ... ascend and resume the search.
616 if (this_parent
!= parent
) {
617 next
= this_parent
->d_u
.d_child
.next
;
618 this_parent
= this_parent
->d_parent
;
620 printk(KERN_DEBUG
"select_parent: ascending to %s/%s, found=%d\n",
621 this_parent
->d_parent
->d_name
.name
, this_parent
->d_name
.name
, found
);
626 spin_unlock(&dcache_lock
);
631 * shrink_dcache_parent - prune dcache
632 * @parent: parent of entries to prune
634 * Prune the dcache to remove unused children of the parent dentry.
637 void shrink_dcache_parent(struct dentry
* parent
)
641 while ((found
= select_parent(parent
)) != 0)
646 * shrink_dcache_anon - further prune the cache
647 * @head: head of d_hash list of dentries to prune
649 * Prune the dentries that are anonymous
651 * parsing d_hash list does not hlist_for_each_entry_rcu() as it
652 * done under dcache_lock.
655 void shrink_dcache_anon(struct hlist_head
*head
)
657 struct hlist_node
*lp
;
661 spin_lock(&dcache_lock
);
662 hlist_for_each(lp
, head
) {
663 struct dentry
*this = hlist_entry(lp
, struct dentry
, d_hash
);
664 if (!list_empty(&this->d_lru
)) {
665 dentry_stat
.nr_unused
--;
666 list_del_init(&this->d_lru
);
670 * move only zero ref count dentries to the end
671 * of the unused list for prune_dcache
673 if (!atomic_read(&this->d_count
)) {
674 list_add_tail(&this->d_lru
, &dentry_unused
);
675 dentry_stat
.nr_unused
++;
679 spin_unlock(&dcache_lock
);
685 * Scan `nr' dentries and return the number which remain.
687 * We need to avoid reentering the filesystem if the caller is performing a
688 * GFP_NOFS allocation attempt. One example deadlock is:
690 * ext2_new_block->getblk->GFP->shrink_dcache_memory->prune_dcache->
691 * prune_one_dentry->dput->dentry_iput->iput->inode->i_sb->s_op->put_inode->
692 * ext2_discard_prealloc->ext2_free_blocks->lock_super->DEADLOCK.
694 * In this case we return -1 to tell the caller that we baled.
696 static int shrink_dcache_memory(int nr
, gfp_t gfp_mask
)
699 if (!(gfp_mask
& __GFP_FS
))
703 return (dentry_stat
.nr_unused
/ 100) * sysctl_vfs_cache_pressure
;
707 * d_alloc - allocate a dcache entry
708 * @parent: parent of entry to allocate
709 * @name: qstr of the name
711 * Allocates a dentry. It returns %NULL if there is insufficient memory
712 * available. On a success the dentry is returned. The name passed in is
713 * copied and the copy passed in may be reused after this call.
716 struct dentry
*d_alloc(struct dentry
* parent
, const struct qstr
*name
)
718 struct dentry
*dentry
;
721 dentry
= kmem_cache_alloc(dentry_cache
, GFP_KERNEL
);
725 if (name
->len
> DNAME_INLINE_LEN
-1) {
726 dname
= kmalloc(name
->len
+ 1, GFP_KERNEL
);
728 kmem_cache_free(dentry_cache
, dentry
);
732 dname
= dentry
->d_iname
;
734 dentry
->d_name
.name
= dname
;
736 dentry
->d_name
.len
= name
->len
;
737 dentry
->d_name
.hash
= name
->hash
;
738 memcpy(dname
, name
->name
, name
->len
);
739 dname
[name
->len
] = 0;
741 atomic_set(&dentry
->d_count
, 1);
742 dentry
->d_flags
= DCACHE_UNHASHED
;
743 spin_lock_init(&dentry
->d_lock
);
744 dentry
->d_inode
= NULL
;
745 dentry
->d_parent
= NULL
;
748 dentry
->d_fsdata
= NULL
;
749 dentry
->d_mounted
= 0;
750 #ifdef CONFIG_PROFILING
751 dentry
->d_cookie
= NULL
;
753 INIT_HLIST_NODE(&dentry
->d_hash
);
754 INIT_LIST_HEAD(&dentry
->d_lru
);
755 INIT_LIST_HEAD(&dentry
->d_subdirs
);
756 INIT_LIST_HEAD(&dentry
->d_alias
);
759 dentry
->d_parent
= dget(parent
);
760 dentry
->d_sb
= parent
->d_sb
;
762 INIT_LIST_HEAD(&dentry
->d_u
.d_child
);
765 spin_lock(&dcache_lock
);
767 list_add(&dentry
->d_u
.d_child
, &parent
->d_subdirs
);
768 dentry_stat
.nr_dentry
++;
769 spin_unlock(&dcache_lock
);
774 struct dentry
*d_alloc_name(struct dentry
*parent
, const char *name
)
779 q
.len
= strlen(name
);
780 q
.hash
= full_name_hash(q
.name
, q
.len
);
781 return d_alloc(parent
, &q
);
785 * d_instantiate - fill in inode information for a dentry
786 * @entry: dentry to complete
787 * @inode: inode to attach to this dentry
789 * Fill in inode information in the entry.
791 * This turns negative dentries into productive full members
794 * NOTE! This assumes that the inode count has been incremented
795 * (or otherwise set) by the caller to indicate that it is now
796 * in use by the dcache.
799 void d_instantiate(struct dentry
*entry
, struct inode
* inode
)
801 if (!list_empty(&entry
->d_alias
)) BUG();
802 spin_lock(&dcache_lock
);
804 list_add(&entry
->d_alias
, &inode
->i_dentry
);
805 entry
->d_inode
= inode
;
806 fsnotify_d_instantiate(entry
, inode
);
807 spin_unlock(&dcache_lock
);
808 security_d_instantiate(entry
, inode
);
812 * d_instantiate_unique - instantiate a non-aliased dentry
813 * @entry: dentry to instantiate
814 * @inode: inode to attach to this dentry
816 * Fill in inode information in the entry. On success, it returns NULL.
817 * If an unhashed alias of "entry" already exists, then we return the
818 * aliased dentry instead and drop one reference to inode.
820 * Note that in order to avoid conflicts with rename() etc, the caller
821 * had better be holding the parent directory semaphore.
823 * This also assumes that the inode count has been incremented
824 * (or otherwise set) by the caller to indicate that it is now
825 * in use by the dcache.
827 struct dentry
*d_instantiate_unique(struct dentry
*entry
, struct inode
*inode
)
829 struct dentry
*alias
;
830 int len
= entry
->d_name
.len
;
831 const char *name
= entry
->d_name
.name
;
832 unsigned int hash
= entry
->d_name
.hash
;
834 BUG_ON(!list_empty(&entry
->d_alias
));
835 spin_lock(&dcache_lock
);
838 list_for_each_entry(alias
, &inode
->i_dentry
, d_alias
) {
839 struct qstr
*qstr
= &alias
->d_name
;
841 if (qstr
->hash
!= hash
)
843 if (alias
->d_parent
!= entry
->d_parent
)
845 if (qstr
->len
!= len
)
847 if (memcmp(qstr
->name
, name
, len
))
850 spin_unlock(&dcache_lock
);
851 BUG_ON(!d_unhashed(alias
));
855 list_add(&entry
->d_alias
, &inode
->i_dentry
);
857 entry
->d_inode
= inode
;
858 fsnotify_d_instantiate(entry
, inode
);
859 spin_unlock(&dcache_lock
);
860 security_d_instantiate(entry
, inode
);
863 EXPORT_SYMBOL(d_instantiate_unique
);
866 * d_alloc_root - allocate root dentry
867 * @root_inode: inode to allocate the root for
869 * Allocate a root ("/") dentry for the inode given. The inode is
870 * instantiated and returned. %NULL is returned if there is insufficient
871 * memory or the inode passed is %NULL.
874 struct dentry
* d_alloc_root(struct inode
* root_inode
)
876 struct dentry
*res
= NULL
;
879 static const struct qstr name
= { .name
= "/", .len
= 1 };
881 res
= d_alloc(NULL
, &name
);
883 res
->d_sb
= root_inode
->i_sb
;
885 d_instantiate(res
, root_inode
);
891 static inline struct hlist_head
*d_hash(struct dentry
*parent
,
894 hash
+= ((unsigned long) parent
^ GOLDEN_RATIO_PRIME
) / L1_CACHE_BYTES
;
895 hash
= hash
^ ((hash
^ GOLDEN_RATIO_PRIME
) >> D_HASHBITS
);
896 return dentry_hashtable
+ (hash
& D_HASHMASK
);
900 * d_alloc_anon - allocate an anonymous dentry
901 * @inode: inode to allocate the dentry for
903 * This is similar to d_alloc_root. It is used by filesystems when
904 * creating a dentry for a given inode, often in the process of
905 * mapping a filehandle to a dentry. The returned dentry may be
906 * anonymous, or may have a full name (if the inode was already
907 * in the cache). The file system may need to make further
908 * efforts to connect this dentry into the dcache properly.
910 * When called on a directory inode, we must ensure that
911 * the inode only ever has one dentry. If a dentry is
912 * found, that is returned instead of allocating a new one.
914 * On successful return, the reference to the inode has been transferred
915 * to the dentry. If %NULL is returned (indicating kmalloc failure),
916 * the reference on the inode has not been released.
919 struct dentry
* d_alloc_anon(struct inode
*inode
)
921 static const struct qstr anonstring
= { .name
= "" };
925 if ((res
= d_find_alias(inode
))) {
930 tmp
= d_alloc(NULL
, &anonstring
);
934 tmp
->d_parent
= tmp
; /* make sure dput doesn't croak */
936 spin_lock(&dcache_lock
);
937 res
= __d_find_alias(inode
, 0);
939 /* attach a disconnected dentry */
942 spin_lock(&res
->d_lock
);
943 res
->d_sb
= inode
->i_sb
;
945 res
->d_inode
= inode
;
946 res
->d_flags
|= DCACHE_DISCONNECTED
;
947 res
->d_flags
&= ~DCACHE_UNHASHED
;
948 list_add(&res
->d_alias
, &inode
->i_dentry
);
949 hlist_add_head(&res
->d_hash
, &inode
->i_sb
->s_anon
);
950 spin_unlock(&res
->d_lock
);
952 inode
= NULL
; /* don't drop reference */
954 spin_unlock(&dcache_lock
);
965 * d_splice_alias - splice a disconnected dentry into the tree if one exists
966 * @inode: the inode which may have a disconnected dentry
967 * @dentry: a negative dentry which we want to point to the inode.
969 * If inode is a directory and has a 'disconnected' dentry (i.e. IS_ROOT and
970 * DCACHE_DISCONNECTED), then d_move that in place of the given dentry
971 * and return it, else simply d_add the inode to the dentry and return NULL.
973 * This is needed in the lookup routine of any filesystem that is exportable
974 * (via knfsd) so that we can build dcache paths to directories effectively.
976 * If a dentry was found and moved, then it is returned. Otherwise NULL
977 * is returned. This matches the expected return value of ->lookup.
980 struct dentry
*d_splice_alias(struct inode
*inode
, struct dentry
*dentry
)
982 struct dentry
*new = NULL
;
985 spin_lock(&dcache_lock
);
986 new = __d_find_alias(inode
, 1);
988 BUG_ON(!(new->d_flags
& DCACHE_DISCONNECTED
));
989 fsnotify_d_instantiate(new, inode
);
990 spin_unlock(&dcache_lock
);
991 security_d_instantiate(new, inode
);
996 /* d_instantiate takes dcache_lock, so we do it by hand */
997 list_add(&dentry
->d_alias
, &inode
->i_dentry
);
998 dentry
->d_inode
= inode
;
999 fsnotify_d_instantiate(dentry
, inode
);
1000 spin_unlock(&dcache_lock
);
1001 security_d_instantiate(dentry
, inode
);
1005 d_add(dentry
, inode
);
1011 * d_lookup - search for a dentry
1012 * @parent: parent dentry
1013 * @name: qstr of name we wish to find
1015 * Searches the children of the parent dentry for the name in question. If
1016 * the dentry is found its reference count is incremented and the dentry
1017 * is returned. The caller must use d_put to free the entry when it has
1018 * finished using it. %NULL is returned on failure.
1020 * __d_lookup is dcache_lock free. The hash list is protected using RCU.
1021 * Memory barriers are used while updating and doing lockless traversal.
1022 * To avoid races with d_move while rename is happening, d_lock is used.
1024 * Overflows in memcmp(), while d_move, are avoided by keeping the length
1025 * and name pointer in one structure pointed by d_qstr.
1027 * rcu_read_lock() and rcu_read_unlock() are used to disable preemption while
1028 * lookup is going on.
1030 * dentry_unused list is not updated even if lookup finds the required dentry
1031 * in there. It is updated in places such as prune_dcache, shrink_dcache_sb,
1032 * select_parent and __dget_locked. This laziness saves lookup from dcache_lock
1035 * d_lookup() is protected against the concurrent renames in some unrelated
1036 * directory using the seqlockt_t rename_lock.
1039 struct dentry
* d_lookup(struct dentry
* parent
, struct qstr
* name
)
1041 struct dentry
* dentry
= NULL
;
1045 seq
= read_seqbegin(&rename_lock
);
1046 dentry
= __d_lookup(parent
, name
);
1049 } while (read_seqretry(&rename_lock
, seq
));
1053 struct dentry
* __d_lookup(struct dentry
* parent
, struct qstr
* name
)
1055 unsigned int len
= name
->len
;
1056 unsigned int hash
= name
->hash
;
1057 const unsigned char *str
= name
->name
;
1058 struct hlist_head
*head
= d_hash(parent
,hash
);
1059 struct dentry
*found
= NULL
;
1060 struct hlist_node
*node
;
1061 struct dentry
*dentry
;
1065 hlist_for_each_entry_rcu(dentry
, node
, head
, d_hash
) {
1068 if (dentry
->d_name
.hash
!= hash
)
1070 if (dentry
->d_parent
!= parent
)
1073 spin_lock(&dentry
->d_lock
);
1076 * Recheck the dentry after taking the lock - d_move may have
1077 * changed things. Don't bother checking the hash because we're
1078 * about to compare the whole name anyway.
1080 if (dentry
->d_parent
!= parent
)
1084 * It is safe to compare names since d_move() cannot
1085 * change the qstr (protected by d_lock).
1087 qstr
= &dentry
->d_name
;
1088 if (parent
->d_op
&& parent
->d_op
->d_compare
) {
1089 if (parent
->d_op
->d_compare(parent
, qstr
, name
))
1092 if (qstr
->len
!= len
)
1094 if (memcmp(qstr
->name
, str
, len
))
1098 if (!d_unhashed(dentry
)) {
1099 atomic_inc(&dentry
->d_count
);
1102 spin_unlock(&dentry
->d_lock
);
1105 spin_unlock(&dentry
->d_lock
);
1113 * d_validate - verify dentry provided from insecure source
1114 * @dentry: The dentry alleged to be valid child of @dparent
1115 * @dparent: The parent dentry (known to be valid)
1116 * @hash: Hash of the dentry
1117 * @len: Length of the name
1119 * An insecure source has sent us a dentry, here we verify it and dget() it.
1120 * This is used by ncpfs in its readdir implementation.
1121 * Zero is returned in the dentry is invalid.
1124 int d_validate(struct dentry
*dentry
, struct dentry
*dparent
)
1126 struct hlist_head
*base
;
1127 struct hlist_node
*lhp
;
1129 /* Check whether the ptr might be valid at all.. */
1130 if (!kmem_ptr_validate(dentry_cache
, dentry
))
1133 if (dentry
->d_parent
!= dparent
)
1136 spin_lock(&dcache_lock
);
1137 base
= d_hash(dparent
, dentry
->d_name
.hash
);
1138 hlist_for_each(lhp
,base
) {
1139 /* hlist_for_each_entry_rcu() not required for d_hash list
1140 * as it is parsed under dcache_lock
1142 if (dentry
== hlist_entry(lhp
, struct dentry
, d_hash
)) {
1143 __dget_locked(dentry
);
1144 spin_unlock(&dcache_lock
);
1148 spin_unlock(&dcache_lock
);
1154 * When a file is deleted, we have two options:
1155 * - turn this dentry into a negative dentry
1156 * - unhash this dentry and free it.
1158 * Usually, we want to just turn this into
1159 * a negative dentry, but if anybody else is
1160 * currently using the dentry or the inode
1161 * we can't do that and we fall back on removing
1162 * it from the hash queues and waiting for
1163 * it to be deleted later when it has no users
1167 * d_delete - delete a dentry
1168 * @dentry: The dentry to delete
1170 * Turn the dentry into a negative dentry if possible, otherwise
1171 * remove it from the hash queues so it can be deleted later
1174 void d_delete(struct dentry
* dentry
)
1178 * Are we the only user?
1180 spin_lock(&dcache_lock
);
1181 spin_lock(&dentry
->d_lock
);
1182 isdir
= S_ISDIR(dentry
->d_inode
->i_mode
);
1183 if (atomic_read(&dentry
->d_count
) == 1) {
1184 /* remove this and other inotify debug checks after 2.6.18 */
1185 dentry
->d_flags
&= ~DCACHE_INOTIFY_PARENT_WATCHED
;
1187 dentry_iput(dentry
);
1188 fsnotify_nameremove(dentry
, isdir
);
1192 if (!d_unhashed(dentry
))
1195 spin_unlock(&dentry
->d_lock
);
1196 spin_unlock(&dcache_lock
);
1198 fsnotify_nameremove(dentry
, isdir
);
1201 static void __d_rehash(struct dentry
* entry
, struct hlist_head
*list
)
1204 entry
->d_flags
&= ~DCACHE_UNHASHED
;
1205 hlist_add_head_rcu(&entry
->d_hash
, list
);
1209 * d_rehash - add an entry back to the hash
1210 * @entry: dentry to add to the hash
1212 * Adds a dentry to the hash according to its name.
1215 void d_rehash(struct dentry
* entry
)
1217 struct hlist_head
*list
= d_hash(entry
->d_parent
, entry
->d_name
.hash
);
1219 spin_lock(&dcache_lock
);
1220 spin_lock(&entry
->d_lock
);
1221 __d_rehash(entry
, list
);
1222 spin_unlock(&entry
->d_lock
);
1223 spin_unlock(&dcache_lock
);
1226 #define do_switch(x,y) do { \
1227 __typeof__ (x) __tmp = x; \
1228 x = y; y = __tmp; } while (0)
1231 * When switching names, the actual string doesn't strictly have to
1232 * be preserved in the target - because we're dropping the target
1233 * anyway. As such, we can just do a simple memcpy() to copy over
1234 * the new name before we switch.
1236 * Note that we have to be a lot more careful about getting the hash
1237 * switched - we have to switch the hash value properly even if it
1238 * then no longer matches the actual (corrupted) string of the target.
1239 * The hash value has to match the hash queue that the dentry is on..
1241 static void switch_names(struct dentry
*dentry
, struct dentry
*target
)
1243 if (dname_external(target
)) {
1244 if (dname_external(dentry
)) {
1246 * Both external: swap the pointers
1248 do_switch(target
->d_name
.name
, dentry
->d_name
.name
);
1251 * dentry:internal, target:external. Steal target's
1252 * storage and make target internal.
1254 dentry
->d_name
.name
= target
->d_name
.name
;
1255 target
->d_name
.name
= target
->d_iname
;
1258 if (dname_external(dentry
)) {
1260 * dentry:external, target:internal. Give dentry's
1261 * storage to target and make dentry internal
1263 memcpy(dentry
->d_iname
, target
->d_name
.name
,
1264 target
->d_name
.len
+ 1);
1265 target
->d_name
.name
= dentry
->d_name
.name
;
1266 dentry
->d_name
.name
= dentry
->d_iname
;
1269 * Both are internal. Just copy target to dentry
1271 memcpy(dentry
->d_iname
, target
->d_name
.name
,
1272 target
->d_name
.len
+ 1);
1278 * We cannibalize "target" when moving dentry on top of it,
1279 * because it's going to be thrown away anyway. We could be more
1280 * polite about it, though.
1282 * This forceful removal will result in ugly /proc output if
1283 * somebody holds a file open that got deleted due to a rename.
1284 * We could be nicer about the deleted file, and let it show
1285 * up under the name it got deleted rather than the name that
1290 * d_move - move a dentry
1291 * @dentry: entry to move
1292 * @target: new dentry
1294 * Update the dcache to reflect the move of a file name. Negative
1295 * dcache entries should not be moved in this way.
1298 void d_move(struct dentry
* dentry
, struct dentry
* target
)
1300 struct hlist_head
*list
;
1302 if (!dentry
->d_inode
)
1303 printk(KERN_WARNING
"VFS: moving negative dcache entry\n");
1305 spin_lock(&dcache_lock
);
1306 write_seqlock(&rename_lock
);
1308 * XXXX: do we really need to take target->d_lock?
1310 if (target
< dentry
) {
1311 spin_lock(&target
->d_lock
);
1312 spin_lock(&dentry
->d_lock
);
1314 spin_lock(&dentry
->d_lock
);
1315 spin_lock(&target
->d_lock
);
1318 /* Move the dentry to the target hash queue, if on different bucket */
1319 if (dentry
->d_flags
& DCACHE_UNHASHED
)
1320 goto already_unhashed
;
1322 hlist_del_rcu(&dentry
->d_hash
);
1325 list
= d_hash(target
->d_parent
, target
->d_name
.hash
);
1326 __d_rehash(dentry
, list
);
1328 /* Unhash the target: dput() will then get rid of it */
1331 list_del(&dentry
->d_u
.d_child
);
1332 list_del(&target
->d_u
.d_child
);
1334 /* Switch the names.. */
1335 switch_names(dentry
, target
);
1336 do_switch(dentry
->d_name
.len
, target
->d_name
.len
);
1337 do_switch(dentry
->d_name
.hash
, target
->d_name
.hash
);
1339 /* ... and switch the parents */
1340 if (IS_ROOT(dentry
)) {
1341 dentry
->d_parent
= target
->d_parent
;
1342 target
->d_parent
= target
;
1343 INIT_LIST_HEAD(&target
->d_u
.d_child
);
1345 do_switch(dentry
->d_parent
, target
->d_parent
);
1347 /* And add them back to the (new) parent lists */
1348 list_add(&target
->d_u
.d_child
, &target
->d_parent
->d_subdirs
);
1351 list_add(&dentry
->d_u
.d_child
, &dentry
->d_parent
->d_subdirs
);
1352 spin_unlock(&target
->d_lock
);
1353 fsnotify_d_move(dentry
);
1354 spin_unlock(&dentry
->d_lock
);
1355 write_sequnlock(&rename_lock
);
1356 spin_unlock(&dcache_lock
);
1360 * d_path - return the path of a dentry
1361 * @dentry: dentry to report
1362 * @vfsmnt: vfsmnt to which the dentry belongs
1363 * @root: root dentry
1364 * @rootmnt: vfsmnt to which the root dentry belongs
1365 * @buffer: buffer to return value in
1366 * @buflen: buffer length
1368 * Convert a dentry into an ASCII path name. If the entry has been deleted
1369 * the string " (deleted)" is appended. Note that this is ambiguous.
1371 * Returns the buffer or an error code if the path was too long.
1373 * "buflen" should be positive. Caller holds the dcache_lock.
1375 static char * __d_path( struct dentry
*dentry
, struct vfsmount
*vfsmnt
,
1376 struct dentry
*root
, struct vfsmount
*rootmnt
,
1377 char *buffer
, int buflen
)
1379 char * end
= buffer
+buflen
;
1385 if (!IS_ROOT(dentry
) && d_unhashed(dentry
)) {
1390 memcpy(end
, " (deleted)", 10);
1400 struct dentry
* parent
;
1402 if (dentry
== root
&& vfsmnt
== rootmnt
)
1404 if (dentry
== vfsmnt
->mnt_root
|| IS_ROOT(dentry
)) {
1406 spin_lock(&vfsmount_lock
);
1407 if (vfsmnt
->mnt_parent
== vfsmnt
) {
1408 spin_unlock(&vfsmount_lock
);
1411 dentry
= vfsmnt
->mnt_mountpoint
;
1412 vfsmnt
= vfsmnt
->mnt_parent
;
1413 spin_unlock(&vfsmount_lock
);
1416 parent
= dentry
->d_parent
;
1418 namelen
= dentry
->d_name
.len
;
1419 buflen
-= namelen
+ 1;
1423 memcpy(end
, dentry
->d_name
.name
, namelen
);
1432 namelen
= dentry
->d_name
.len
;
1436 retval
-= namelen
-1; /* hit the slash */
1437 memcpy(retval
, dentry
->d_name
.name
, namelen
);
1440 return ERR_PTR(-ENAMETOOLONG
);
1443 /* write full pathname into buffer and return start of pathname */
1444 char * d_path(struct dentry
*dentry
, struct vfsmount
*vfsmnt
,
1445 char *buf
, int buflen
)
1448 struct vfsmount
*rootmnt
;
1449 struct dentry
*root
;
1451 read_lock(¤t
->fs
->lock
);
1452 rootmnt
= mntget(current
->fs
->rootmnt
);
1453 root
= dget(current
->fs
->root
);
1454 read_unlock(¤t
->fs
->lock
);
1455 spin_lock(&dcache_lock
);
1456 res
= __d_path(dentry
, vfsmnt
, root
, rootmnt
, buf
, buflen
);
1457 spin_unlock(&dcache_lock
);
1464 * NOTE! The user-level library version returns a
1465 * character pointer. The kernel system call just
1466 * returns the length of the buffer filled (which
1467 * includes the ending '\0' character), or a negative
1468 * error value. So libc would do something like
1470 * char *getcwd(char * buf, size_t size)
1474 * retval = sys_getcwd(buf, size);
1481 asmlinkage
long sys_getcwd(char __user
*buf
, unsigned long size
)
1484 struct vfsmount
*pwdmnt
, *rootmnt
;
1485 struct dentry
*pwd
, *root
;
1486 char *page
= (char *) __get_free_page(GFP_USER
);
1491 read_lock(¤t
->fs
->lock
);
1492 pwdmnt
= mntget(current
->fs
->pwdmnt
);
1493 pwd
= dget(current
->fs
->pwd
);
1494 rootmnt
= mntget(current
->fs
->rootmnt
);
1495 root
= dget(current
->fs
->root
);
1496 read_unlock(¤t
->fs
->lock
);
1499 /* Has the current directory has been unlinked? */
1500 spin_lock(&dcache_lock
);
1501 if (pwd
->d_parent
== pwd
|| !d_unhashed(pwd
)) {
1505 cwd
= __d_path(pwd
, pwdmnt
, root
, rootmnt
, page
, PAGE_SIZE
);
1506 spin_unlock(&dcache_lock
);
1508 error
= PTR_ERR(cwd
);
1513 len
= PAGE_SIZE
+ page
- cwd
;
1516 if (copy_to_user(buf
, cwd
, len
))
1520 spin_unlock(&dcache_lock
);
1527 free_page((unsigned long) page
);
1532 * Test whether new_dentry is a subdirectory of old_dentry.
1534 * Trivially implemented using the dcache structure
1538 * is_subdir - is new dentry a subdirectory of old_dentry
1539 * @new_dentry: new dentry
1540 * @old_dentry: old dentry
1542 * Returns 1 if new_dentry is a subdirectory of the parent (at any depth).
1543 * Returns 0 otherwise.
1544 * Caller must ensure that "new_dentry" is pinned before calling is_subdir()
1547 int is_subdir(struct dentry
* new_dentry
, struct dentry
* old_dentry
)
1550 struct dentry
* saved
= new_dentry
;
1553 /* need rcu_readlock to protect against the d_parent trashing due to
1558 /* for restarting inner loop in case of seq retry */
1561 seq
= read_seqbegin(&rename_lock
);
1563 if (new_dentry
!= old_dentry
) {
1564 struct dentry
* parent
= new_dentry
->d_parent
;
1565 if (parent
== new_dentry
)
1567 new_dentry
= parent
;
1573 } while (read_seqretry(&rename_lock
, seq
));
1579 void d_genocide(struct dentry
*root
)
1581 struct dentry
*this_parent
= root
;
1582 struct list_head
*next
;
1584 spin_lock(&dcache_lock
);
1586 next
= this_parent
->d_subdirs
.next
;
1588 while (next
!= &this_parent
->d_subdirs
) {
1589 struct list_head
*tmp
= next
;
1590 struct dentry
*dentry
= list_entry(tmp
, struct dentry
, d_u
.d_child
);
1592 if (d_unhashed(dentry
)||!dentry
->d_inode
)
1594 if (!list_empty(&dentry
->d_subdirs
)) {
1595 this_parent
= dentry
;
1598 atomic_dec(&dentry
->d_count
);
1600 if (this_parent
!= root
) {
1601 next
= this_parent
->d_u
.d_child
.next
;
1602 atomic_dec(&this_parent
->d_count
);
1603 this_parent
= this_parent
->d_parent
;
1606 spin_unlock(&dcache_lock
);
1610 * find_inode_number - check for dentry with name
1611 * @dir: directory to check
1612 * @name: Name to find.
1614 * Check whether a dentry already exists for the given name,
1615 * and return the inode number if it has an inode. Otherwise
1618 * This routine is used to post-process directory listings for
1619 * filesystems using synthetic inode numbers, and is necessary
1620 * to keep getcwd() working.
1623 ino_t
find_inode_number(struct dentry
*dir
, struct qstr
*name
)
1625 struct dentry
* dentry
;
1629 * Check for a fs-specific hash function. Note that we must
1630 * calculate the standard hash first, as the d_op->d_hash()
1631 * routine may choose to leave the hash value unchanged.
1633 name
->hash
= full_name_hash(name
->name
, name
->len
);
1634 if (dir
->d_op
&& dir
->d_op
->d_hash
)
1636 if (dir
->d_op
->d_hash(dir
, name
) != 0)
1640 dentry
= d_lookup(dir
, name
);
1643 if (dentry
->d_inode
)
1644 ino
= dentry
->d_inode
->i_ino
;
1651 static __initdata
unsigned long dhash_entries
;
1652 static int __init
set_dhash_entries(char *str
)
1656 dhash_entries
= simple_strtoul(str
, &str
, 0);
1659 __setup("dhash_entries=", set_dhash_entries
);
1661 static void __init
dcache_init_early(void)
1665 /* If hashes are distributed across NUMA nodes, defer
1666 * hash allocation until vmalloc space is available.
1672 alloc_large_system_hash("Dentry cache",
1673 sizeof(struct hlist_head
),
1681 for (loop
= 0; loop
< (1 << d_hash_shift
); loop
++)
1682 INIT_HLIST_HEAD(&dentry_hashtable
[loop
]);
1685 static void __init
dcache_init(unsigned long mempages
)
1690 * A constructor could be added for stable state like the lists,
1691 * but it is probably not worth it because of the cache nature
1694 dentry_cache
= kmem_cache_create("dentry_cache",
1695 sizeof(struct dentry
),
1697 (SLAB_RECLAIM_ACCOUNT
|SLAB_PANIC
|
1701 set_shrinker(DEFAULT_SEEKS
, shrink_dcache_memory
);
1703 /* Hash may have been set up in dcache_init_early */
1708 alloc_large_system_hash("Dentry cache",
1709 sizeof(struct hlist_head
),
1717 for (loop
= 0; loop
< (1 << d_hash_shift
); loop
++)
1718 INIT_HLIST_HEAD(&dentry_hashtable
[loop
]);
1721 /* SLAB cache for __getname() consumers */
1722 kmem_cache_t
*names_cachep __read_mostly
;
1724 /* SLAB cache for file structures */
1725 kmem_cache_t
*filp_cachep __read_mostly
;
1727 EXPORT_SYMBOL(d_genocide
);
1729 extern void bdev_cache_init(void);
1730 extern void chrdev_init(void);
1732 void __init
vfs_caches_init_early(void)
1734 dcache_init_early();
1738 void __init
vfs_caches_init(unsigned long mempages
)
1740 unsigned long reserve
;
1742 /* Base hash sizes on available memory, with a reserve equal to
1743 150% of current kernel size */
1745 reserve
= min((mempages
- nr_free_pages()) * 3/2, mempages
- 1);
1746 mempages
-= reserve
;
1748 names_cachep
= kmem_cache_create("names_cache", PATH_MAX
, 0,
1749 SLAB_HWCACHE_ALIGN
|SLAB_PANIC
, NULL
, NULL
);
1751 filp_cachep
= kmem_cache_create("filp", sizeof(struct file
), 0,
1752 SLAB_HWCACHE_ALIGN
|SLAB_PANIC
, NULL
, NULL
);
1754 dcache_init(mempages
);
1755 inode_init(mempages
);
1756 files_init(mempages
);
1762 EXPORT_SYMBOL(d_alloc
);
1763 EXPORT_SYMBOL(d_alloc_anon
);
1764 EXPORT_SYMBOL(d_alloc_root
);
1765 EXPORT_SYMBOL(d_delete
);
1766 EXPORT_SYMBOL(d_find_alias
);
1767 EXPORT_SYMBOL(d_instantiate
);
1768 EXPORT_SYMBOL(d_invalidate
);
1769 EXPORT_SYMBOL(d_lookup
);
1770 EXPORT_SYMBOL(d_move
);
1771 EXPORT_SYMBOL(d_path
);
1772 EXPORT_SYMBOL(d_prune_aliases
);
1773 EXPORT_SYMBOL(d_rehash
);
1774 EXPORT_SYMBOL(d_splice_alias
);
1775 EXPORT_SYMBOL(d_validate
);
1776 EXPORT_SYMBOL(dget_locked
);
1777 EXPORT_SYMBOL(dput
);
1778 EXPORT_SYMBOL(find_inode_number
);
1779 EXPORT_SYMBOL(have_submounts
);
1780 EXPORT_SYMBOL(names_cachep
);
1781 EXPORT_SYMBOL(shrink_dcache_parent
);
1782 EXPORT_SYMBOL(shrink_dcache_sb
);