Commit 39e3c9553f34381a1b664c27b0c696a266a5735e

Authored by Jeff Layton
Committed by Al Viro
1 parent 741b7c3f77

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>

Showing 4 changed files with 3 additions and 65 deletions Side-by-side Diff

... ... @@ -4262,16 +4262,7 @@
4262 4262 if (dentry->d_name.len > BTRFS_NAME_LEN)
4263 4263 return ERR_PTR(-ENAMETOOLONG);
4264 4264  
4265   - if (unlikely(d_need_lookup(dentry))) {
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   -
  4265 + ret = btrfs_inode_by_name(dir, dentry, &location);
4275 4266 if (ret < 0)
4276 4267 return ERR_PTR(ret);
4277 4268  
... ... @@ -4341,11 +4332,6 @@
4341 4332 struct dentry *ret;
4342 4333  
4343 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 4335 return ret;
4350 4336 }
4351 4337  
... ... @@ -455,24 +455,6 @@
455 455 EXPORT_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   - */
466   -void 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   -}
473   -EXPORT_SYMBOL(d_clear_need_lookup);
474   -
475   -/*
476 458 * Finish off a dentry we've decided to kill.
477 459 * dentry->d_lock must be held, returns with it unlocked.
478 460 * If ref is non-zero, then decrement the refcount too.
... ... @@ -565,13 +547,7 @@
565 547 if (d_unhashed(dentry))
566 548 goto kill_it;
567 549  
568   - /*
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;
  550 + dentry->d_flags |= DCACHE_REFERENCED;
575 551 dentry_lru_add(dentry);
576 552  
577 553 dentry->d_count--;
... ... @@ -1735,13 +1711,6 @@
1735 1711 iput(inode);
1736 1712 return found;
1737 1713 }
1738   -
1739   - /*
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 1714  
1746 1715 /*
1747 1716 * Negative dentry: instantiate it unless the inode is a directory and
... ... @@ -1275,9 +1275,7 @@
1275 1275 *need_lookup = false;
1276 1276 dentry = d_lookup(dir, name);
1277 1277 if (dentry) {
1278   - if (d_need_lookup(dentry)) {
1279   - *need_lookup = true;
1280   - } else if (dentry->d_flags & DCACHE_OP_REVALIDATE) {
  1278 + if (dentry->d_flags & DCACHE_OP_REVALIDATE) {
1281 1279 error = d_revalidate(dentry, flags);
1282 1280 if (unlikely(error <= 0)) {
1283 1281 if (error < 0) {
... ... @@ -1383,8 +1381,6 @@
1383 1381 return -ECHILD;
1384 1382 nd->seq = seq;
1385 1383  
1386   - if (unlikely(d_need_lookup(dentry)))
1387   - goto unlazy;
1388 1384 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
1389 1385 status = d_revalidate(dentry, nd->flags);
1390 1386 if (unlikely(status <= 0)) {
... ... @@ -1409,11 +1405,6 @@
1409 1405  
1410 1406 if (unlikely(!dentry))
1411 1407 goto need_lookup;
1412   -
1413   - if (unlikely(d_need_lookup(dentry))) {
1414   - dput(dentry);
1415   - goto need_lookup;
1416   - }
1417 1408  
1418 1409 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
1419 1410 status = d_revalidate(dentry, nd->flags);
include/linux/dcache.h
... ... @@ -202,7 +202,6 @@
202 202 #define DCACHE_MOUNTED 0x10000 /* is a mountpoint */
203 203 #define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */
204 204 #define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */
205   -#define DCACHE_NEED_LOOKUP 0x80000 /* dentry requires i_op->lookup */
206 205 #define DCACHE_MANAGED_DENTRY \
207 206 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
208 207  
... ... @@ -407,13 +406,6 @@
407 406 {
408 407 return dentry->d_flags & DCACHE_MOUNTED;
409 408 }
410   -
411   -static inline bool d_need_lookup(struct dentry *dentry)
412   -{
413   - return dentry->d_flags & DCACHE_NEED_LOOKUP;
414   -}
415   -
416   -extern void d_clear_need_lookup(struct dentry *dentry);
417 409  
418 410 extern int sysctl_vfs_cache_pressure;
419 411