diff options
author | David Howells <dhowells@redhat.com> | 2015-01-29 07:02:29 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-02-22 11:38:38 -0500 |
commit | 44bdb5e5f6382ba88f7678d6f535f879324522ae (patch) | |
tree | e9aab8e53a78446f60e4036cb617c9dd10655228 /fs | |
parent | df1a085af1f652a02238168c4f2b730c8c90dd4a (diff) |
VFS: Split DCACHE_FILE_TYPE into regular and special types
Split DCACHE_FILE_TYPE into DCACHE_REGULAR_TYPE (dentries representing regular
files) and DCACHE_SPECIAL_TYPE (representing blockdev, chardev, FIFO and
socket files).
d_is_reg() and d_is_special() are added to detect these subtypes and
d_is_file() is left as the union of the two.
This allows a number of places that use S_ISREG(dentry->d_inode->i_mode) to
use d_is_reg(dentry) instead.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dcache.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index e33a0934efd7..c71e3732e53b 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1677,7 +1677,7 @@ EXPORT_SYMBOL(d_set_fallthru); | |||
1677 | 1677 | ||
1678 | static unsigned d_flags_for_inode(struct inode *inode) | 1678 | static unsigned d_flags_for_inode(struct inode *inode) |
1679 | { | 1679 | { |
1680 | unsigned add_flags = DCACHE_FILE_TYPE; | 1680 | unsigned add_flags = DCACHE_REGULAR_TYPE; |
1681 | 1681 | ||
1682 | if (!inode) | 1682 | if (!inode) |
1683 | return DCACHE_MISS_TYPE; | 1683 | return DCACHE_MISS_TYPE; |
@@ -1690,13 +1690,21 @@ static unsigned d_flags_for_inode(struct inode *inode) | |||
1690 | else | 1690 | else |
1691 | inode->i_opflags |= IOP_LOOKUP; | 1691 | inode->i_opflags |= IOP_LOOKUP; |
1692 | } | 1692 | } |
1693 | } else if (unlikely(!(inode->i_opflags & IOP_NOFOLLOW))) { | 1693 | goto type_determined; |
1694 | 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)) { | ||
1695 | add_flags = DCACHE_SYMLINK_TYPE; | 1698 | add_flags = DCACHE_SYMLINK_TYPE; |
1696 | else | 1699 | goto type_determined; |
1697 | inode->i_opflags |= IOP_NOFOLLOW; | 1700 | } |
1701 | inode->i_opflags |= IOP_NOFOLLOW; | ||
1698 | } | 1702 | } |
1699 | 1703 | ||
1704 | if (unlikely(!S_ISREG(inode->i_mode))) | ||
1705 | add_flags = DCACHE_SPECIAL_TYPE; | ||
1706 | |||
1707 | type_determined: | ||
1700 | if (unlikely(IS_AUTOMOUNT(inode))) | 1708 | if (unlikely(IS_AUTOMOUNT(inode))) |
1701 | add_flags |= DCACHE_NEED_AUTOMOUNT; | 1709 | add_flags |= DCACHE_NEED_AUTOMOUNT; |
1702 | return add_flags; | 1710 | return add_flags; |