patch-2.3.99-pre6 linux/fs/nfs/inode.c

Next file: linux/fs/nfs/mount_clnt.c
Previous file: linux/fs/nfs/flushd.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre5/linux/fs/nfs/inode.c linux/fs/nfs/inode.c
@@ -101,9 +101,11 @@
 	inode->i_rdev = 0;
 	NFS_FILEID(inode) = 0;
 	NFS_FSID(inode) = 0;
+	INIT_LIST_HEAD(&inode->u.nfs_i.read);
 	INIT_LIST_HEAD(&inode->u.nfs_i.dirty);
 	INIT_LIST_HEAD(&inode->u.nfs_i.commit);
 	INIT_LIST_HEAD(&inode->u.nfs_i.writeback);
+	inode->u.nfs_i.nread = 0;
 	inode->u.nfs_i.ndirty = 0;
 	inode->u.nfs_i.ncommit = 0;
 	inode->u.nfs_i.npages = 0;
@@ -131,7 +133,7 @@
 	/*
 	 * The following can never actually happen...
 	 */
-	if (nfs_have_writebacks(inode)) {
+	if (nfs_have_writebacks(inode) || nfs_have_read(inode)) {
 		printk(KERN_ERR "nfs_delete_inode: inode %ld has pending RPC requests\n", inode->i_ino);
 	}
 
@@ -260,6 +262,7 @@
 	struct nfs_fsinfo	fsinfo;
 	int			tcp, version, maxlen;
 
+	memset(&sb->u.nfs_sb, 0, sizeof(sb->u.nfs_sb));
 	if (!data)
 		goto out_miss_args;
 
@@ -428,12 +431,20 @@
 		sb->s_blocksize = nfs_block_bits(fsinfo.bsize, &sb->s_blocksize_bits);
 	if (server->rsize > fsinfo.rtmax)
 		server->rsize = fsinfo.rtmax;
-	if (server->rsize > PAGE_CACHE_SIZE)
-		server->rsize = PAGE_CACHE_SIZE;
 	if (server->wsize > fsinfo.wtmax)
 		server->wsize = fsinfo.wtmax;
-        if (server->wsize > NFS_WRITE_MAXIOV << PAGE_CACHE_SHIFT)
-                server->wsize = NFS_WRITE_MAXIOV << PAGE_CACHE_SHIFT;
+
+	server->rpages = (server->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+	if (server->rpages > NFS_READ_MAXIOV) {
+		server->rpages = NFS_READ_MAXIOV;
+		server->rsize = server->rpages << PAGE_CACHE_SHIFT;
+	}
+
+	server->wpages = (server->wsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+        if (server->wpages > NFS_WRITE_MAXIOV) {
+		server->wpages = NFS_WRITE_MAXIOV;
+                server->wsize = server->wpages << PAGE_CACHE_SHIFT;
+	}
 
         maxlen = (version == 2) ? NFS2_MAXNAMLEN : NFS3_MAXNAMLEN;
 
@@ -1145,6 +1156,8 @@
 extern void nfs_destroy_fhcache(void);
 extern int nfs_init_nfspagecache(void);
 extern void nfs_destroy_nfspagecache(void);
+extern int nfs_init_readpagecache(void);
+extern int nfs_destroy_readpagecache(void);
 
 /*
  * Initialize NFS
@@ -1162,6 +1175,10 @@
 	if (err)
 		return err;
 
+	err = nfs_init_readpagecache();
+	if (err)
+		return err;
+
 #ifdef CONFIG_PROC_FS
 	rpc_proc_register(&nfs_rpcstat);
 #endif
@@ -1186,6 +1203,7 @@
 void
 cleanup_module(void)
 {
+	nfs_destroy_readpagecache();
 	nfs_destroy_nfspagecache();
 	nfs_destroy_fhcache();
 #ifdef CONFIG_PROC_FS

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)