aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-01-29 07:02:28 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-02-22 11:38:38 -0500
commitdf1a085af1f652a02238168c4f2b730c8c90dd4a (patch)
treee9f269431a6ed4ec7a70de68cd9b62b0bcbe2dea
parente7f7d2253c05143ed76ddc5e11f4cf0a9b814a27 (diff)
VFS: Add a fallthrough flag for marking virtual dentries
Add a DCACHE_FALLTHRU flag to indicate that, in a layered filesystem, this is a virtual dentry that covers another one in a lower layer that should be used instead. This may be recorded on medium if directory integration is stored there. The flag can be set with d_set_fallthru() and tested with d_is_fallthru(). Original-author: Valerie Aurora <vaurora@redhat.com> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/dcache.c19
-rw-r--r--include/linux/dcache.h9
2 files changed, 27 insertions, 1 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index dc400fd29f4d..e33a0934efd7 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1659,6 +1659,22 @@ 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_FILE_TYPE;
@@ -1691,7 +1707,8 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
1691 unsigned add_flags = d_flags_for_inode(inode); 1707 unsigned add_flags = d_flags_for_inode(inode);
1692 1708
1693 spin_lock(&dentry->d_lock); 1709 spin_lock(&dentry->d_lock);
1694 __d_set_type(dentry, add_flags); 1710 dentry->d_flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU);
1711 dentry->d_flags |= add_flags;
1695 if (inode) 1712 if (inode)
1696 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); 1713 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry);
1697 dentry->d_inode = inode; 1714 dentry->d_inode = inode;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 98d2a948a08e..728f5d31b5e6 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -223,6 +223,7 @@ struct dentry_operations {
223#define DCACHE_FILE_TYPE 0x00500000 /* Other file type (or fallthru to such) */ 223#define DCACHE_FILE_TYPE 0x00500000 /* Other file type (or fallthru to such) */
224 224
225#define DCACHE_MAY_FREE 0x00800000 225#define DCACHE_MAY_FREE 0x00800000
226#define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */
226 227
227extern seqlock_t rename_lock; 228extern seqlock_t rename_lock;
228 229
@@ -470,6 +471,14 @@ static inline bool d_is_positive(const struct dentry *dentry)
470 return !d_is_negative(dentry); 471 return !d_is_negative(dentry);
471} 472}
472 473
474extern void d_set_fallthru(struct dentry *dentry);
475
476static inline bool d_is_fallthru(const struct dentry *dentry)
477{
478 return dentry->d_flags & DCACHE_FALLTHRU;
479}
480
481
473extern int sysctl_vfs_cache_pressure; 482extern int sysctl_vfs_cache_pressure;
474 483
475static inline unsigned long vfs_pressure_ratio(unsigned long val) 484static inline unsigned long vfs_pressure_ratio(unsigned long val)