summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-23 00:40:54 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-23 00:40:54 +0000
commit529c593ece216e4aaffd36bd940cb94f1fa63129 (patch)
tree78f1c0b805f5656aa7b0417a043c5346f700a2cf /fs/nfs
parent0bd079751d25808d1972baee5c4eaa1db2227257 (diff)
Merge with 2.3.43. I did ignore all modifications to the qlogicisp.c
driver due to the Origin A64 hacks.
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/dir.c18
-rw-r--r--fs/nfs/file.c52
-rw-r--r--fs/nfs/inode.c5
-rw-r--r--fs/nfs/write.c2
4 files changed, 35 insertions, 42 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 788307cc2..82d3f5bc3 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -52,17 +52,10 @@ static int nfs_rename(struct inode *, struct dentry *,
struct inode *, struct dentry *);
static struct file_operations nfs_dir_operations = {
- NULL, /* lseek - default */
- nfs_dir_read, /* read - bad */
- NULL, /* write - bad */
- nfs_readdir, /* readdir */
- NULL, /* select - default */
- NULL, /* ioctl - default */
- NULL, /* mmap */
- nfs_open, /* open */
- NULL, /* flush */
- nfs_release, /* release */
- NULL /* fsync */
+ read: nfs_dir_read,
+ readdir: nfs_readdir,
+ open: nfs_open,
+ release: nfs_release,
};
struct inode_operations nfs_dir_inode_operations = {
@@ -78,9 +71,6 @@ struct inode_operations nfs_dir_inode_operations = {
nfs_rename, /* rename */
NULL, /* readlink */
NULL, /* follow_link */
- NULL, /* get_block */
- NULL, /* readpage */
- NULL, /* writepage */
NULL, /* truncate */
NULL, /* permission */
nfs_revalidate, /* revalidate */
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index f687cfdab..2135ece68 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -41,19 +41,14 @@ static int nfs_file_flush(struct file *);
static int nfs_fsync(struct file *, struct dentry *dentry);
static struct file_operations nfs_file_operations = {
- NULL, /* lseek - default */
- nfs_file_read, /* read */
- nfs_file_write, /* write */
- NULL, /* readdir - bad */
- NULL, /* select - default */
- NULL, /* ioctl - default */
- nfs_file_mmap, /* mmap */
- nfs_open, /* open */
- nfs_file_flush, /* flush */
- nfs_release, /* release */
- nfs_fsync, /* fsync */
- NULL, /* fasync */
- nfs_lock, /* lock */
+ read: nfs_file_read,
+ write: nfs_file_write,
+ mmap: nfs_file_mmap,
+ open: nfs_open,
+ flush: nfs_file_flush,
+ release: nfs_release,
+ fsync: nfs_fsync,
+ lock: nfs_lock,
};
struct inode_operations nfs_file_inode_operations = {
@@ -69,9 +64,6 @@ struct inode_operations nfs_file_inode_operations = {
NULL, /* rename */
NULL, /* readlink */
NULL, /* follow_link */
- NULL, /* get_block */
- nfs_readpage, /* readpage */
- nfs_writepage, /* writepage */
NULL, /* truncate */
NULL, /* permission */
nfs_revalidate, /* revalidate */
@@ -146,11 +138,13 @@ nfs_fsync(struct file *file, struct dentry *dentry)
dfprintk(VFS, "nfs: fsync(%x/%ld)\n", inode->i_dev, inode->i_ino);
+ lock_kernel();
status = nfs_wb_file(inode, file);
if (!status) {
status = file->f_error;
file->f_error = 0;
}
+ unlock_kernel();
return status;
}
@@ -163,21 +157,29 @@ nfs_fsync(struct file *file, struct dentry *dentry)
* If the writer ends up delaying the write, the writer needs to
* increment the page use counts until he is done with the page.
*/
-static int nfs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf)
+static int nfs_prepare_write(struct page *page, unsigned offset, unsigned to)
+{
+ kmap(page);
+ return 0;
+}
+static int nfs_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to)
{
long status;
- bytes -= copy_from_user((u8*)kmap(page) + offset, buf, bytes);
kunmap(page);
- status = -EFAULT;
- if (bytes) {
- lock_kernel();
- status = nfs_updatepage(file, page, offset, bytes);
- unlock_kernel();
- }
+ lock_kernel();
+ status = nfs_updatepage(file, page, offset, to-offset);
+ unlock_kernel();
return status;
}
+struct address_space_operations nfs_file_aops = {
+ readpage: nfs_readpage,
+ writepage: nfs_writepage,
+ prepare_write: nfs_prepare_write,
+ commit_write: nfs_commit_write
+};
+
/*
* Write to a file (through the page cache).
*/
@@ -203,7 +205,7 @@ nfs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
if (!count)
goto out;
- result = generic_file_write(file, buf, count, ppos, nfs_write_one_page);
+ result = generic_file_write(file, buf, count, ppos);
out:
return result;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index aae8d3d0a..c8d42adfe 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -473,9 +473,10 @@ nfs_fill_inode(struct inode *inode, struct nfs_fattr *fattr)
NFS_FILEID(inode) = fattr->fileid;
NFS_FSID(inode) = fattr->fsid;
inode->i_mode = fattr->mode;
- if (S_ISREG(inode->i_mode))
+ if (S_ISREG(inode->i_mode)) {
inode->i_op = &nfs_file_inode_operations;
- else if (S_ISDIR(inode->i_mode))
+ inode->i_data.a_ops = &nfs_file_aops;
+ } else if (S_ISDIR(inode->i_mode))
inode->i_op = &nfs_dir_inode_operations;
else if (S_ISLNK(inode->i_mode))
inode->i_op = &nfs_symlink_inode_operations;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 09a16b302..a13e26fd0 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -479,7 +479,7 @@ updated:
if (req->wb_bytes == PAGE_SIZE)
SetPageUptodate(page);
- retval = count;
+ retval = 0;
if (synchronous) {
int status = wait_on_write_request(req);
if (status) {