[PATCH] Support for cached lookups via readdirplus [5/6]

From: Trond Myklebust (trond.myklebust@fys.uio.no)
Date: Sun Jul 28 2002 - 10:26:31 EST


Enable lookups of negative dentries using READDIRPLUS.

If we find that the entire READDIR cache has been read, and we've seen
that no pages are missing, and that the EOF has been reached, then we
assume that the file does not exist.

Cheers,
  Trond

diff -u --recursive --new-file linux-2.5.29-rdplus4/fs/nfs/dir.c linux-2.5.29-rdplus5/fs/nfs/dir.c
--- linux-2.5.29-rdplus4/fs/nfs/dir.c Sat Jul 27 19:15:50 2002
+++ linux-2.5.29-rdplus5/fs/nfs/dir.c Sat Jul 27 19:15:41 2002
@@ -614,9 +614,11 @@
                         d_add(dentry, inode);
                         nfs_renew_times(dentry);
                         error = 0;
+ goto out;
                 }
- goto out;
- }
+ nfs_zap_caches(dir);
+ } else if (error == -ENOENT)
+ goto no_entry;
 
         error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr);
         if (error == -ENOENT)
@@ -674,10 +676,10 @@
         int res;
 
         if (!NFS_USE_READDIRPLUS(dir))
- return -ENOENT;
+ return -ENOTSUPP;
         server = NFS_SERVER(dir);
         if (server->flags & NFS_MOUNT_NOAC)
- return -ENOENT;
+ return -EIO;
         nfs_revalidate_inode(server, dir);
 
         entry.fh = fh;
@@ -698,15 +700,19 @@
                 }
                 page_cache_release(page);
 
- if (res == 0)
- goto out_found;
- if (res != -EAGAIN)
- break;
+ switch (res) {
+ case 0:
+ fattr->timestamp = timestamp;
+ return 0;
+ case -ENOENT:
+ return -ENOENT;
+ case -EAGAIN:
+ continue;
+ default:
+ }
+ break;
         }
- return -ENOENT;
- out_found:
- fattr->timestamp = timestamp;
- return 0;
+ return -EIO;
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jul 30 2002 - 14:00:29 EST