diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-06-16 23:00:36 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-06-16 23:00:36 +0000 |
commit | 14dd2ec093cfabda3ae7efeeaf0e23c66ebaccc0 (patch) | |
tree | 9a9ce5cff6ef92faa6e07a82785b9a6d6838f7e4 /fs/nfs | |
parent | 847290510f811c572cc2aa80c1f02a04721410b1 (diff) |
Merge with 2.4.0-test1.
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/flushd.c | 3 | ||||
-rw-r--r-- | fs/nfs/inode.c | 2 | ||||
-rw-r--r-- | fs/nfs/write.c | 28 |
3 files changed, 21 insertions, 12 deletions
diff --git a/fs/nfs/flushd.c b/fs/nfs/flushd.c index 460d4eba9..02024c90e 100644 --- a/fs/nfs/flushd.c +++ b/fs/nfs/flushd.c @@ -136,6 +136,7 @@ int nfs_reqlist_alloc(struct nfs_server *server) return -ENOMEM; memset(cache, 0, sizeof(*cache)); + atomic_set(&cache->nr_requests, 0); init_waitqueue_head(&cache->request_wait); server->rw_requests = cache; @@ -280,7 +281,7 @@ nfs_flushd(struct rpc_task *task) cache->runat = jiffies + task->tk_timeout; spin_lock(&nfs_flushd_lock); - if (!cache->nr_requests && !cache->inodes) { + if (!atomic_read(&cache->nr_requests) && !cache->inodes) { cache->task = NULL; task->tk_action = NULL; } else diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 44e3030c3..cf0ea6ef3 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -417,6 +417,8 @@ nfs_read_super(struct super_block *sb, void *raw_data, int silent) if (data->wsize == 0) server->wsize = nfs_block_size(fsinfo.wtpref, NULL); server->dtsize = nfs_block_size(fsinfo.dtpref, NULL); + if (server->dtsize > PAGE_CACHE_SIZE) + server->dtsize = PAGE_CACHE_SIZE; /* NFSv3: we don't have bsize, but rather rtmult and wtmult... */ if (!fsinfo.bsize) fsinfo.bsize = (fsinfo.rtmult>fsinfo.wtmult) ? fsinfo.rtmult : fsinfo.wtmult; diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 464776ac3..cb97c40bc 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -68,7 +68,7 @@ * Spinlock */ spinlock_t nfs_wreq_lock = SPIN_LOCK_UNLOCKED; -static unsigned int nfs_nr_requests = 0; +static atomic_t nfs_nr_requests = ATOMIC_INIT(0); /* * Local structures @@ -490,9 +490,9 @@ struct nfs_page *nfs_create_request(struct file *file, struct page *page, */ do { /* If we're over the global soft limit, wake up all requests */ - if (nfs_nr_requests >= MAX_REQUEST_SOFT) { + if (atomic_read(&nfs_nr_requests) >= MAX_REQUEST_SOFT) { dprintk("NFS: hit soft limit (%d requests)\n", - nfs_nr_requests); + atomic_read(&nfs_nr_requests)); if (!cache->task) nfs_reqlist_init(NFS_SERVER(inode)); nfs_wake_flushd(); @@ -500,7 +500,7 @@ struct nfs_page *nfs_create_request(struct file *file, struct page *page, /* If we haven't reached the local hard limit yet, * try to allocate the request struct */ - if (cache->nr_requests < MAX_REQUEST_HARD) { + if (atomic_read(&cache->nr_requests) < MAX_REQUEST_HARD) { req = nfs_page_alloc(); if (req != NULL) break; @@ -508,7 +508,7 @@ struct nfs_page *nfs_create_request(struct file *file, struct page *page, /* We're over the hard limit. Wait for better times */ dprintk("NFS: create_request sleeping (total %d pid %d)\n", - cache->nr_requests, current->pid); + atomic_read(&cache->nr_requests), current->pid); timeout = 1 * HZ; if (NFS_SERVER(inode)->flags & NFS_MOUNT_INTR) { @@ -520,7 +520,7 @@ struct nfs_page *nfs_create_request(struct file *file, struct page *page, sleep_on_timeout(&cache->request_wait, timeout); dprintk("NFS: create_request waking up (tot %d pid %d)\n", - cache->nr_requests, current->pid); + atomic_read(&cache->nr_requests), current->pid); } while (!req); if (!req) return NULL; @@ -539,8 +539,8 @@ struct nfs_page *nfs_create_request(struct file *file, struct page *page, req->wb_count = 1; /* register request's existence */ - cache->nr_requests++; - nfs_nr_requests++; + atomic_inc(&cache->nr_requests); + atomic_inc(&nfs_nr_requests); return req; } @@ -580,9 +580,15 @@ nfs_release_request(struct nfs_page *req) page_cache_release(page); nfs_page_free(req); /* wake up anyone waiting to allocate a request */ - cache->nr_requests--; - nfs_nr_requests--; + atomic_dec(&cache->nr_requests); + atomic_dec(&nfs_nr_requests); wake_up(&cache->request_wait); +#ifdef NFS_PARANOIA + if (atomic_read(&cache->nr_requests) < 0) + BUG(); + if (atomic_read(&nfs_nr_requests) < 0) + BUG(); +#endif } /* @@ -931,7 +937,7 @@ nfs_strategy(struct inode *inode) if (dirty >= wpages) nfs_flush_file(inode, NULL, 0, 0, 0); if (inode->u.nfs_i.ncommit > NFS_STRATEGY_PAGES * wpages && - nfs_nr_requests > MAX_REQUEST_SOFT) + atomic_read(&nfs_nr_requests) > MAX_REQUEST_SOFT) nfs_commit_file(inode, NULL, 0, 0, 0); } #else |