aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-11-28 11:30:53 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-20 13:57:36 -0500
commit39e3c9553f34381a1b664c27b0c696a266a5735e (patch)
treef754789dccac7a017ee8feb602b01dd42b73023d
parent741b7c3f77937b2fb7c10aeb4c5c621463582583 (diff)
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: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/btrfs/inode.c16
-rw-r--r--fs/dcache.c33
-rw-r--r--fs/namei.c11
-rw-r--r--include/linux/dcache.h8
4 files changed, 3 insertions, 65 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 67ed24ae86bb..16d9e8e191e6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4262,16 +4262,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
4262 if (dentry->d_name.len > BTRFS_NAME_LEN) 4262 if (dentry->d_name.len > BTRFS_NAME_LEN)
4263 return ERR_PTR(-ENAMETOOLONG); 4263 return ERR_PTR(-ENAMETOOLONG);
4264 4264
4265 if (unlikely(d_need_lookup(dentry))) { 4265 ret = btrfs_inode_by_name(dir, dentry, &location);
4266 memcpy(&location, dentry->d_fsdata, sizeof(struct btrfs_key));
4267 kfree(dentry->d_fsdata);
4268 dentry->d_fsdata = NULL;
4269 /* This thing is hashed, drop it for now */
4270 d_drop(dentry);
4271 } else {
4272 ret = btrfs_inode_by_name(dir, dentry, &location);
4273 }
4274
4275 if (ret < 0) 4266 if (ret < 0)
4276 return ERR_PTR(ret); 4267 return ERR_PTR(ret);
4277 4268
@@ -4341,11 +4332,6 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
4341 struct dentry *ret; 4332 struct dentry *ret;
4342 4333
4343 ret = d_splice_alias(btrfs_lookup_dentry(dir, dentry), dentry); 4334 ret = d_splice_alias(btrfs_lookup_dentry(dir, dentry), dentry);
4344 if (unlikely(d_need_lookup(dentry))) {
4345 spin_lock(&dentry->d_lock);
4346 dentry->d_flags &= ~DCACHE_NEED_LOOKUP;
4347 spin_unlock(&dentry->d_lock);
4348 }
4349 return ret; 4335 return ret;
4350} 4336}
4351 4337
diff --git a/fs/dcache.c b/fs/dcache.c
index 3a463d0c4fe8..1782be3fc3ef 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -455,24 +455,6 @@ void d_drop(struct dentry *dentry)
455EXPORT_SYMBOL(d_drop); 455EXPORT_SYMBOL(d_drop);
456 456
457/* 457/*
458 * d_clear_need_lookup - drop a dentry from cache and clear the need lookup flag
459 * @dentry: dentry to drop
460 *
461 * This is called when we do a lookup on a placeholder dentry that needed to be
462 * looked up. The dentry should have been hashed in order for it to be found by
463 * the lookup code, but now needs to be unhashed while we do the actual lookup
464 * and clear the DCACHE_NEED_LOOKUP flag.
465 */
466void d_clear_need_lookup(struct dentry *dentry)
467{
468 spin_lock(&dentry->d_lock);
469 __d_drop(dentry);
470 dentry->d_flags &= ~DCACHE_NEED_LOOKUP;
471 spin_unlock(&dentry->d_lock);
472}
473EXPORT_SYMBOL(d_clear_need_lookup);
474
475/*
476 * Finish off a dentry we've decided to kill. 458 * Finish off a dentry we've decided to kill.
477 * dentry->d_lock must be held, returns with it unlocked. 459 * dentry->d_lock must be held, returns with it unlocked.
478 * If ref is non-zero, then decrement the refcount too. 460 * If ref is non-zero, then decrement the refcount too.
@@ -565,13 +547,7 @@ repeat:
565 if (d_unhashed(dentry)) 547 if (d_unhashed(dentry))
566 goto kill_it; 548 goto kill_it;
567 549
568 /* 550 dentry->d_flags |= DCACHE_REFERENCED;
569 * If this dentry needs lookup, don't set the referenced flag so that it
570 * is more likely to be cleaned up by the dcache shrinker in case of
571 * memory pressure.
572 */
573 if (!d_need_lookup(dentry))
574 dentry->d_flags |= DCACHE_REFERENCED;
575 dentry_lru_add(dentry); 551 dentry_lru_add(dentry);
576 552
577 dentry->d_count--; 553 dentry->d_count--;
@@ -1737,13 +1713,6 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
1737 } 1713 }
1738 1714
1739 /* 1715 /*
1740 * We are going to instantiate this dentry, unhash it and clear the
1741 * lookup flag so we can do that.
1742 */
1743 if (unlikely(d_need_lookup(found)))
1744 d_clear_need_lookup(found);
1745
1746 /*
1747 * Negative dentry: instantiate it unless the inode is a directory and 1716 * Negative dentry: instantiate it unless the inode is a directory and
1748 * already has a dentry. 1717 * already has a dentry.
1749 */ 1718 */
diff --git a/fs/namei.c b/fs/namei.c
index 35195ff9d194..25a41e02984b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1275,9 +1275,7 @@ static struct dentry *lookup_dcache(struct qstr *name, struct dentry *dir,
1275 *need_lookup = false; 1275 *need_lookup = false;
1276 dentry = d_lookup(dir, name); 1276 dentry = d_lookup(dir, name);
1277 if (dentry) { 1277 if (dentry) {
1278 if (d_need_lookup(dentry)) { 1278 if (dentry->d_flags & DCACHE_OP_REVALIDATE) {
1279 *need_lookup = true;
1280 } else if (dentry->d_flags & DCACHE_OP_REVALIDATE) {
1281 error = d_revalidate(dentry, flags); 1279 error = d_revalidate(dentry, flags);
1282 if (unlikely(error <= 0)) { 1280 if (unlikely(error <= 0)) {
1283 if (error < 0) { 1281 if (error < 0) {
@@ -1383,8 +1381,6 @@ static int lookup_fast(struct nameidata *nd, struct qstr *name,
1383 return -ECHILD; 1381 return -ECHILD;
1384 nd->seq = seq; 1382 nd->seq = seq;
1385 1383
1386 if (unlikely(d_need_lookup(dentry)))
1387 goto unlazy;
1388 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { 1384 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
1389 status = d_revalidate(dentry, nd->flags); 1385 status = d_revalidate(dentry, nd->flags);
1390 if (unlikely(status <= 0)) { 1386 if (unlikely(status <= 0)) {
@@ -1410,11 +1406,6 @@ unlazy:
1410 if (unlikely(!dentry)) 1406 if (unlikely(!dentry))
1411 goto need_lookup; 1407 goto need_lookup;
1412 1408
1413 if (unlikely(d_need_lookup(dentry))) {
1414 dput(dentry);
1415 goto need_lookup;
1416 }
1417
1418 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) 1409 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
1419 status = d_revalidate(dentry, nd->flags); 1410 status = d_revalidate(dentry, nd->flags);
1420 if (unlikely(status <= 0)) { 1411 if (unlikely(status <= 0)) {
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 59200795482e..c1754b59ddd3 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -202,7 +202,6 @@ struct dentry_operations {
202#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */ 202#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */
203#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */ 203#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */
204#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */ 204#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */
205#define DCACHE_NEED_LOOKUP 0x80000 /* dentry requires i_op->lookup */
206#define DCACHE_MANAGED_DENTRY \ 205#define DCACHE_MANAGED_DENTRY \
207 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 206 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
208 207
@@ -408,13 +407,6 @@ static inline bool d_mountpoint(struct dentry *dentry)
408 return dentry->d_flags & DCACHE_MOUNTED; 407 return dentry->d_flags & DCACHE_MOUNTED;
409} 408}
410 409
411static inline bool d_need_lookup(struct dentry *dentry)
412{
413 return dentry->d_flags & DCACHE_NEED_LOOKUP;
414}
415
416extern void d_clear_need_lookup(struct dentry *dentry);
417
418extern int sysctl_vfs_cache_pressure; 410extern int sysctl_vfs_cache_pressure;
419 411
420#endif /* __LINUX_DCACHE_H */ 412#endif /* __LINUX_DCACHE_H */