patch-2.2.4 linux/fs/nfs/file.c

Next file: linux/fs/nfsd/nfsfh.c
Previous file: linux/fs/ncpfs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.3/linux/fs/nfs/file.c linux/fs/nfs/file.c
@@ -36,7 +36,6 @@
 static ssize_t nfs_file_read(struct file *, char *, size_t, loff_t *);
 static ssize_t nfs_file_write(struct file *, const char *, size_t, loff_t *);
 static int  nfs_file_flush(struct file *);
-static int  nfs_file_close(struct inode *, struct file *);
 static int  nfs_fsync(struct file *, struct dentry *dentry);
 
 static struct file_operations nfs_file_operations = {
@@ -49,7 +48,7 @@
 	nfs_file_mmap,		/* mmap */
 	NULL,			/* no special open is needed */
 	nfs_file_flush,		/* flush */
-	nfs_file_close,		/* release */
+	NULL,			/* release */
 	nfs_fsync,		/* fsync */
 	NULL,			/* fasync */
 	NULL,			/* check_media_change */
@@ -86,35 +85,23 @@
 #endif
 
 /*
- * Sync the file..
+ * Flush all dirty pages, and check for write errors.
+ *
  */
 static int
-nfs_file_close(struct inode *inode, struct file *file)
+nfs_file_flush(struct file *file)
 {
-	int	status;
+	struct inode	*inode = file->f_dentry->d_inode;
+	int		status;
 
-	dfprintk(VFS, "nfs: close(%x/%ld)\n", inode->i_dev, inode->i_ino);
+	dfprintk(VFS, "nfs: flush(%x/%ld)\n", inode->i_dev, inode->i_ino);
 
-	status = nfs_wb_all(inode);
-	if (!status)
+	status = nfs_wb_file(inode, file);
+	if (!status) {
 		status = file->f_error;
+		file->f_error = 0;
+	}
 	return status;
-}
-
-/*
- * Flush all dirty pages, and check for write errors.
- *
- * We should probably do this better - this does get called at every
- * close, so we should probably just flush the changes that "this"
- * file has done and report on only those.
- *
- * Right now we use the "flush everything" approach. Overkill, but
- * works.
- */
-static int
-nfs_file_flush(struct file *file)
-{
-	return nfs_file_close(file->f_dentry->d_inode, file);
 }
 
 static ssize_t

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