[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-nfs
Subject:    [NFS] [PATCH] Support for cached lookups via readdirplus [5/6]
From:       Trond Myklebust <trond.myklebust () fys ! uio ! no>
Date:       2002-07-28 15:26:31
[Download RAW message or body]


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;
 }
 
 /*


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic