diff options
-rw-r--r-- | fs/dcache.c | 18 | ||||
-rw-r--r-- | include/linux/dcache.h | 17 |
2 files changed, 27 insertions, 8 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; |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 728f5d31b5e6..d8358799c594 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -219,8 +219,9 @@ struct dentry_operations { | |||
219 | #define DCACHE_WHITEOUT_TYPE 0x00100000 /* Whiteout dentry (stop pathwalk) */ | 219 | #define DCACHE_WHITEOUT_TYPE 0x00100000 /* Whiteout dentry (stop pathwalk) */ |
220 | #define DCACHE_DIRECTORY_TYPE 0x00200000 /* Normal directory */ | 220 | #define DCACHE_DIRECTORY_TYPE 0x00200000 /* Normal directory */ |
221 | #define DCACHE_AUTODIR_TYPE 0x00300000 /* Lookupless directory (presumed automount) */ | 221 | #define DCACHE_AUTODIR_TYPE 0x00300000 /* Lookupless directory (presumed automount) */ |
222 | #define DCACHE_SYMLINK_TYPE 0x00400000 /* Symlink (or fallthru to such) */ | 222 | #define DCACHE_REGULAR_TYPE 0x00400000 /* Regular file type (or fallthru to such) */ |
223 | #define DCACHE_FILE_TYPE 0x00500000 /* Other file type (or fallthru to such) */ | 223 | #define DCACHE_SPECIAL_TYPE 0x00500000 /* Other file type (or fallthru to such) */ |
224 | #define DCACHE_SYMLINK_TYPE 0x00600000 /* Symlink (or fallthru to such) */ | ||
224 | 225 | ||
225 | #define DCACHE_MAY_FREE 0x00800000 | 226 | #define DCACHE_MAY_FREE 0x00800000 |
226 | #define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */ | 227 | #define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */ |
@@ -455,9 +456,19 @@ static inline bool d_is_symlink(const struct dentry *dentry) | |||
455 | return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; | 456 | return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; |
456 | } | 457 | } |
457 | 458 | ||
459 | static inline bool d_is_reg(const struct dentry *dentry) | ||
460 | { | ||
461 | return __d_entry_type(dentry) == DCACHE_REGULAR_TYPE; | ||
462 | } | ||
463 | |||
464 | static inline bool d_is_special(const struct dentry *dentry) | ||
465 | { | ||
466 | return __d_entry_type(dentry) == DCACHE_SPECIAL_TYPE; | ||
467 | } | ||
468 | |||
458 | static inline bool d_is_file(const struct dentry *dentry) | 469 | static inline bool d_is_file(const struct dentry *dentry) |
459 | { | 470 | { |
460 | return __d_entry_type(dentry) == DCACHE_FILE_TYPE; | 471 | return d_is_reg(dentry) || d_is_special(dentry); |
461 | } | 472 | } |
462 | 473 | ||
463 | static inline bool d_is_negative(const struct dentry *dentry) | 474 | static inline bool d_is_negative(const struct dentry *dentry) |