Commit 39e3c955 authored by Jeff Layton's avatar Jeff Layton Committed by Al Viro

vfs: remove DCACHE_NEED_LOOKUP

The code that relied on that flag was ripped out of btrfs quite some
time ago, and never added back. Josef indicated that he was going to
take a different approach to the problem in btrfs, and that we
could just eliminate this flag.

Cc: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 741b7c3f
...@@ -4262,16 +4262,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) ...@@ -4262,16 +4262,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
if (dentry->d_name.len > BTRFS_NAME_LEN) if (dentry->d_name.len > BTRFS_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
if (unlikely(d_need_lookup(dentry))) { ret = btrfs_inode_by_name(dir, dentry, &location);
memcpy(&location, dentry->d_fsdata, sizeof(struct btrfs_key));
kfree(dentry->d_fsdata);
dentry->d_fsdata = NULL;
/* This thing is hashed, drop it for now */
d_drop(dentry);
} else {
ret = btrfs_inode_by_name(dir, dentry, &location);
}
if (ret < 0) if (ret < 0)
return ERR_PTR(ret); return ERR_PTR(ret);
...@@ -4341,11 +4332,6 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, ...@@ -4341,11 +4332,6 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
struct dentry *ret; struct dentry *ret;
ret = d_splice_alias(btrfs_lookup_dentry(dir, dentry), dentry); ret = d_splice_alias(btrfs_lookup_dentry(dir, dentry), dentry);
if (unlikely(d_need_lookup(dentry))) {
spin_lock(&dentry->d_lock);
dentry->d_flags &= ~DCACHE_NEED_LOOKUP;
spin_unlock(&dentry->d_lock);
}
return ret; return ret;
} }
......
...@@ -454,24 +454,6 @@ void d_drop(struct dentry *dentry) ...@@ -454,24 +454,6 @@ void d_drop(struct dentry *dentry)
} }
EXPORT_SYMBOL(d_drop); EXPORT_SYMBOL(d_drop);
/*
* d_clear_need_lookup - drop a dentry from cache and clear the need lookup flag
* @dentry: dentry to drop
*
* This is called when we do a lookup on a placeholder dentry that needed to be
* looked up. The dentry should have been hashed in order for it to be found by
* the lookup code, but now needs to be unhashed while we do the actual lookup
* and clear the DCACHE_NEED_LOOKUP flag.
*/
void d_clear_need_lookup(struct dentry *dentry)
{
spin_lock(&dentry->d_lock);
__d_drop(dentry);
dentry->d_flags &= ~DCACHE_NEED_LOOKUP;
spin_unlock(&dentry->d_lock);
}
EXPORT_SYMBOL(d_clear_need_lookup);
/* /*
* Finish off a dentry we've decided to kill. * Finish off a dentry we've decided to kill.
* dentry->d_lock must be held, returns with it unlocked. * dentry->d_lock must be held, returns with it unlocked.
...@@ -565,13 +547,7 @@ void dput(struct dentry *dentry) ...@@ -565,13 +547,7 @@ void dput(struct dentry *dentry)
if (d_unhashed(dentry)) if (d_unhashed(dentry))
goto kill_it; goto kill_it;
/* dentry->d_flags |= DCACHE_REFERENCED;
* If this dentry needs lookup, don't set the referenced flag so that it
* is more likely to be cleaned up by the dcache shrinker in case of
* memory pressure.
*/
if (!d_need_lookup(dentry))
dentry->d_flags |= DCACHE_REFERENCED;
dentry_lru_add(dentry); dentry_lru_add(dentry);
dentry->d_count--; dentry->d_count--;
...@@ -1736,13 +1712,6 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, ...@@ -1736,13 +1712,6 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
return found; return found;
} }
/*
* We are going to instantiate this dentry, unhash it and clear the
* lookup flag so we can do that.
*/
if (unlikely(d_need_lookup(found)))
d_clear_need_lookup(found);
/* /*
* Negative dentry: instantiate it unless the inode is a directory and * Negative dentry: instantiate it unless the inode is a directory and
* already has a dentry. * already has a dentry.
......
...@@ -1275,9 +1275,7 @@ static struct dentry *lookup_dcache(struct qstr *name, struct dentry *dir, ...@@ -1275,9 +1275,7 @@ static struct dentry *lookup_dcache(struct qstr *name, struct dentry *dir,
*need_lookup = false; *need_lookup = false;
dentry = d_lookup(dir, name); dentry = d_lookup(dir, name);
if (dentry) { if (dentry) {
if (d_need_lookup(dentry)) { if (dentry->d_flags & DCACHE_OP_REVALIDATE) {
*need_lookup = true;
} else if (dentry->d_flags & DCACHE_OP_REVALIDATE) {
error = d_revalidate(dentry, flags); error = d_revalidate(dentry, flags);
if (unlikely(error <= 0)) { if (unlikely(error <= 0)) {
if (error < 0) { if (error < 0) {
...@@ -1383,8 +1381,6 @@ static int lookup_fast(struct nameidata *nd, struct qstr *name, ...@@ -1383,8 +1381,6 @@ static int lookup_fast(struct nameidata *nd, struct qstr *name,
return -ECHILD; return -ECHILD;
nd->seq = seq; nd->seq = seq;
if (unlikely(d_need_lookup(dentry)))
goto unlazy;
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
status = d_revalidate(dentry, nd->flags); status = d_revalidate(dentry, nd->flags);
if (unlikely(status <= 0)) { if (unlikely(status <= 0)) {
...@@ -1410,11 +1406,6 @@ static int lookup_fast(struct nameidata *nd, struct qstr *name, ...@@ -1410,11 +1406,6 @@ static int lookup_fast(struct nameidata *nd, struct qstr *name,
if (unlikely(!dentry)) if (unlikely(!dentry))
goto need_lookup; goto need_lookup;
if (unlikely(d_need_lookup(dentry))) {
dput(dentry);
goto need_lookup;
}
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
status = d_revalidate(dentry, nd->flags); status = d_revalidate(dentry, nd->flags);
if (unlikely(status <= 0)) { if (unlikely(status <= 0)) {
......
...@@ -202,7 +202,6 @@ struct dentry_operations { ...@@ -202,7 +202,6 @@ struct dentry_operations {
#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */ #define DCACHE_MOUNTED 0x10000 /* is a mountpoint */
#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */ #define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */
#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */ #define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */
#define DCACHE_NEED_LOOKUP 0x80000 /* dentry requires i_op->lookup */
#define DCACHE_MANAGED_DENTRY \ #define DCACHE_MANAGED_DENTRY \
(DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
...@@ -408,13 +407,6 @@ static inline bool d_mountpoint(struct dentry *dentry) ...@@ -408,13 +407,6 @@ static inline bool d_mountpoint(struct dentry *dentry)
return dentry->d_flags & DCACHE_MOUNTED; return dentry->d_flags & DCACHE_MOUNTED;
} }
static inline bool d_need_lookup(struct dentry *dentry)
{
return dentry->d_flags & DCACHE_NEED_LOOKUP;
}
extern void d_clear_need_lookup(struct dentry *dentry);
extern int sysctl_vfs_cache_pressure; extern int sysctl_vfs_cache_pressure;
#endif /* __LINUX_DCACHE_H */ #endif /* __LINUX_DCACHE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment