aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index dc400fd29f4d..c71e3732e53b 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1659,9 +1659,25 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
1659} 1659}
1660EXPORT_SYMBOL(d_set_d_op); 1660EXPORT_SYMBOL(d_set_d_op);
1661 1661
1662
1663/*
1664 * d_set_fallthru - Mark a dentry as falling through to a lower layer
1665 * @dentry - The dentry to mark
1666 *
1667 * Mark a dentry as falling through to the lower layer (as set with
1668 * d_pin_lower()). This flag may be recorded on the medium.
1669 */
1670void d_set_fallthru(struct dentry *dentry)
1671{
1672 spin_lock(&dentry->d_lock);
1673 dentry->d_flags |= DCACHE_FALLTHRU;
1674 spin_unlock(&dentry->d_lock);
1675}
1676EXPORT_SYMBOL(d_set_fallthru);
1677
1662static unsigned d_flags_for_inode(struct inode *inode) 1678static unsigned d_flags_for_inode(struct inode *inode)
1663{ 1679{
1664 unsigned add_flags = DCACHE_FILE_TYPE; 1680 unsigned add_flags = DCACHE_REGULAR_TYPE;
1665 1681
1666 if (!inode) 1682 if (!inode)
1667 return DCACHE_MISS_TYPE; 1683 return DCACHE_MISS_TYPE;
@@ -1674,13 +1690,21 @@ static unsigned d_flags_for_inode(struct inode *inode)
1674 else 1690 else
1675 inode->i_opflags |= IOP_LOOKUP; 1691 inode->i_opflags |= IOP_LOOKUP;
1676 } 1692 }
1677 } else if (unlikely(!(inode->i_opflags & IOP_NOFOLLOW))) { 1693 goto type_determined;
1678 if (unlikely(inode->i_op->follow_link)) 1694 }
1695
1696 if (unlikely(!(inode->i_opflags & IOP_NOFOLLOW))) {
1697 if (unlikely(inode->i_op->follow_link)) {
1679 add_flags = DCACHE_SYMLINK_TYPE; 1698 add_flags = DCACHE_SYMLINK_TYPE;
1680 else 1699 goto type_determined;
1681 inode->i_opflags |= IOP_NOFOLLOW; 1700 }
1701 inode->i_opflags |= IOP_NOFOLLOW;
1682 } 1702 }
1683 1703
1704 if (unlikely(!S_ISREG(inode->i_mode)))
1705 add_flags = DCACHE_SPECIAL_TYPE;
1706
1707type_determined:
1684 if (unlikely(IS_AUTOMOUNT(inode))) 1708 if (unlikely(IS_AUTOMOUNT(inode)))
1685 add_flags |= DCACHE_NEED_AUTOMOUNT; 1709 add_flags |= DCACHE_NEED_AUTOMOUNT;
1686 return add_flags; 1710 return add_flags;
@@ -1691,7 +1715,8 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
1691 unsigned add_flags = d_flags_for_inode(inode); 1715 unsigned add_flags = d_flags_for_inode(inode);
1692 1716
1693 spin_lock(&dentry->d_lock); 1717 spin_lock(&dentry->d_lock);
1694 __d_set_type(dentry, add_flags); 1718 dentry->d_flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU);
1719 dentry->d_flags |= add_flags;
1695 if (inode) 1720 if (inode)
1696 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); 1721 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry);
1697 dentry->d_inode = inode; 1722 dentry->d_inode = inode;