summaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 56271c14b..2d71aa7b5 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -101,9 +101,11 @@ nfs_read_inode(struct inode * inode)
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 @@ nfs_delete_inode(struct inode * inode)
/*
* 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 @@ nfs_read_super(struct super_block *sb, void *raw_data, int silent)
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 @@ nfs_read_super(struct super_block *sb, void *raw_data, int silent)
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 int nfs_init_fhcache(void);
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 @@ init_nfs_fs(void)
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 @@ init_module(void)
void
cleanup_module(void)
{
+ nfs_destroy_readpagecache();
nfs_destroy_nfspagecache();
nfs_destroy_fhcache();
#ifdef CONFIG_PROC_FS