-#ifdef HAVE_EXPORT___IGET
-static void prune_dir_dentries(struct inode *inode)
-{
- struct dentry *dentry, *prev = NULL;
-
- /* due to lustre specific logic, a directory
- * can have few dentries - a bug from VFS POV */
-restart:
- spin_lock(&dcache_lock);
- if (!list_empty(&inode->i_dentry)) {
- dentry = list_entry(inode->i_dentry.prev,
- struct dentry, d_alias);
- /* in order to prevent infinite loops we
- * break if previous dentry is busy */
- if (dentry != prev) {
- prev = dentry;
- dget_locked(dentry);
- spin_unlock(&dcache_lock);
-
- /* try to kill all child dentries */
- shrink_dcache_parent(dentry);
- dput(dentry);
-
- /* now try to get rid of current dentry */
- d_prune_aliases(inode);
- goto restart;
- }
- }
- spin_unlock(&dcache_lock);
-}
-
-static void prune_deathrow_one(struct ll_inode_info *lli)
-{
- struct inode *inode = ll_info2i(lli);
-
- /* first, try to drop any dentries - they hold a ref on the inode */
- if (S_ISDIR(inode->i_mode))
- prune_dir_dentries(inode);
- else
- d_prune_aliases(inode);
-
-
- /* if somebody still uses it, leave it */
- LASSERT(atomic_read(&inode->i_count) > 0);
- if (atomic_read(&inode->i_count) > 1)
- goto out;
-
- CDEBUG(D_INODE, "inode %lu/%u(%d) looks a good candidate for prune\n",
- inode->i_ino,inode->i_generation, atomic_read(&inode->i_count));
-
- /* seems nobody uses it anymore */
- inode->i_nlink = 0;
-
-out:
- iput(inode);
- return;
-}
-
-static void prune_deathrow(struct ll_sb_info *sbi, int try)
-{
- struct ll_inode_info *lli;
- int empty;
-
- do {
- if (need_resched() && try)
- break;
-
- if (try) {
- if (!spin_trylock(&sbi->ll_deathrow_lock))
- break;
- } else {
- spin_lock(&sbi->ll_deathrow_lock);
- }
-
- empty = 1;
- lli = NULL;
- if (!list_empty(&sbi->ll_deathrow)) {
- lli = list_entry(sbi->ll_deathrow.next,
- struct ll_inode_info,
- lli_dead_list);
- list_del_init(&lli->lli_dead_list);
- if (!list_empty(&sbi->ll_deathrow))
- empty = 0;
- }
- spin_unlock(&sbi->ll_deathrow_lock);
-
- if (lli)
- prune_deathrow_one(lli);
-
- } while (empty == 0);
-}
-#else /* !HAVE_EXPORT___IGET */
-#define prune_deathrow(sbi, try) do {} while (0)
-#endif /* HAVE_EXPORT___IGET */
-