From b63ad0882a16a5d28003e57f2b0b81dee3fb322b Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 28 Nov 2000 03:58:46 +0000 Subject: Merge with 2.4.0-test11. --- fs/nfs/dir.c | 8 ++++---- fs/nfs/inode.c | 7 ++----- fs/nfs/read.c | 4 ++-- fs/nfs/symlink.c | 4 ++-- fs/nfs/write.c | 23 +++++++++++------------ 5 files changed, 21 insertions(+), 25 deletions(-) (limited to 'fs/nfs') diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 3f6b770aa..c66d870d9 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -97,7 +97,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) { struct file *file = desc->file; struct inode *inode = file->f_dentry->d_inode; - void *buffer = (void *)kmap(page); + void *buffer = kmap(page); int plus = NFS_USE_READDIRPLUS(inode); int error; @@ -145,7 +145,7 @@ static inline int find_dirent(nfs_readdir_descriptor_t *desc, struct page *page) { struct nfs_entry *entry = desc->entry; - char *start = (char *)kmap(page), + char *start = kmap(page), *p = start; int loop_count = 0, status = 0; @@ -251,7 +251,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, { struct file *file = desc->file; struct nfs_entry *entry = desc->entry; - char *start = (char *)kmap(desc->page), + char *start = kmap(desc->page), *p = start + desc->page_offset; unsigned long fileid; int loop_count = 0, @@ -323,7 +323,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent, status = -ENOMEM; goto out; } - p = (u32 *)kmap(page); + p = kmap(page); status = NFS_PROTO(inode)->readdir(file, desc->target, p, NFS_SERVER(inode)->dtsize, 0); if (status >= 0) { diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b21592528..5b582024e 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -720,12 +720,9 @@ nfs_fhget(struct dentry *dentry, struct nfs_fh *fhandle, if ((dentry->d_parent->d_inode->u.nfs_i.flags & NFS_IS_SNAPSHOT) || (dentry->d_name.len == 9 && memcmp(dentry->d_name.name, ".snapshot", 9) == 0)) { - struct inode *inode = get_empty_inode(); + struct inode *inode = new_inode(sb); if (!inode) - goto out; - inode->i_sb = sb; - inode->i_dev = sb->s_dev; - inode->i_flags = 0; + goto out; inode->i_ino = nfs_fattr_to_ino_t(fattr); nfs_read_inode(inode); nfs_fill_inode(inode, fattr); diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 7c1aad253..76fc2f437 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -101,7 +101,7 @@ nfs_readpage_sync(struct file *file, struct page *page) * This works now because the socket layer never tries to DMA * into this buffer directly. */ - buffer = (char *) kmap(page); + buffer = kmap(page); do { if (count < rsize) rsize = count; @@ -257,7 +257,7 @@ nfs_read_rpcsetup(struct list_head *head, struct nfs_read_data *data) struct nfs_page *req = nfs_list_entry(head->next); nfs_list_remove_request(req); nfs_list_add_request(req, &data->pages); - iov->iov_base = (void *)(kmap(req->wb_page) + req->wb_offset); + iov->iov_base = kmap(req->wb_page) + req->wb_offset; iov->iov_len = req->wb_bytes; count += req->wb_bytes; iov++; diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c index 4c9c45e2a..4960526b4 100644 --- a/fs/nfs/symlink.c +++ b/fs/nfs/symlink.c @@ -30,7 +30,7 @@ static int nfs_symlink_filler(struct dentry *dentry, struct page *page) { struct inode *inode = dentry->d_inode; - void *buffer = (void *)kmap(page); + void *buffer = kmap(page); int error; /* We place the length at the beginning of the page, @@ -69,7 +69,7 @@ static char *nfs_getlink(struct dentry *dentry, struct page **ppage) if (!Page_Uptodate(page)) goto getlink_read_error; *ppage = page; - p = (u32 *) kmap(page); + p = kmap(page); return (char*)(p+1); getlink_read_error: diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 5346e6302..230954993 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -184,7 +184,7 @@ nfs_writepage_sync(struct file *file, struct page *page, dentry->d_parent->d_name.name, dentry->d_name.name, count, (long long)(page_offset(page) + offset)); - buffer = (u8 *) kmap(page) + offset; + buffer = kmap(page) + offset; base = page_offset(page) + offset; flags = ((IS_SWAPFILE(inode)) ? NFS_RW_SWAP : 0) | NFS_RW_SYNC; @@ -601,14 +601,10 @@ nfs_wait_on_request(struct nfs_page *req) { struct inode *inode = req->wb_dentry->d_inode; struct rpc_clnt *clnt = NFS_CLIENT(inode); - int retval; if (!NFS_WBACK_BUSY(req)) return 0; - req->wb_count++; - retval = nfs_wait_event(clnt, req->wb_wait, !NFS_WBACK_BUSY(req)); - nfs_release_request(req); - return retval; + return nfs_wait_event(clnt, req->wb_wait, !NFS_WBACK_BUSY(req)); } /* @@ -1065,7 +1061,7 @@ nfs_write_rpcsetup(struct list_head *head, struct nfs_write_data *data) struct nfs_page *req = nfs_list_entry(head->next); nfs_list_remove_request(req); nfs_list_add_request(req, &data->pages); - iov->iov_base = (void *)(kmap(req->wb_page) + req->wb_offset); + iov->iov_base = kmap(req->wb_page) + req->wb_offset; iov->iov_len = req->wb_bytes; count += req->wb_bytes; iov++; @@ -1239,6 +1235,13 @@ nfs_writeback_done(struct rpc_task *task) } #endif + /* + * Update attributes as result of writeback. + * FIXME: There is an inherent race with invalidate_inode_pages and + * writebacks since the page->count is kept > 1 for as long + * as the page has a write request pending. + */ + nfs_write_attributes(inode, resp->fattr); while (!list_empty(&data->pages)) { req = nfs_list_entry(data->pages.next); nfs_list_remove_request(req); @@ -1278,9 +1281,6 @@ nfs_writeback_done(struct rpc_task *task) next: nfs_unlock_request(req); } - /* Update attributes as result of writeback. */ - nfs_write_attributes(inode, resp->fattr); - } @@ -1395,6 +1395,7 @@ nfs_commit_done(struct rpc_task *task) dprintk("NFS: %4d nfs_commit_done (status %d)\n", task->tk_pid, task->tk_status); + nfs_write_attributes(inode, resp->fattr); while (!list_empty(&data->pages)) { req = nfs_list_entry(data->pages.next); nfs_list_remove_request(req); @@ -1426,8 +1427,6 @@ nfs_commit_done(struct rpc_task *task) next: nfs_unlock_request(req); } - - nfs_write_attributes(inode, resp->fattr); } #endif -- cgit v1.2.3