patch-2.0.21-2.1.0 linux/fs/ext2/file.c

Next file: linux/fs/fat/dir.c
Previous file: linux/fs/ext2/dir.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file lx2.0/v2.0.21/linux/fs/ext2/file.c linux/fs/ext2/file.c
@@ -36,7 +36,7 @@
 #include <linux/fs.h>
 #include <linux/ext2_fs.h>
 
-static int ext2_file_write (struct inode *, struct file *, const char *, int);
+static long ext2_file_write (struct inode *, struct file *, const char *, unsigned long);
 static void ext2_release_file (struct inode *, struct file *);
 
 /*
@@ -80,8 +80,8 @@
 	NULL			/* smap */
 };
 
-static int ext2_file_write (struct inode * inode, struct file * filp,
-			    const char * buf, int count)
+static long ext2_file_write (struct inode * inode, struct file * filp,
+			    const char * buf, unsigned long count)
 {
 	const loff_t two_gb = 2147483647;
 	loff_t pos;
@@ -140,9 +140,9 @@
 				written = err;
 			break;
 		}
+		if (c > count)
+			c = count;
 		count -= c;
-		if (count < 0)
-			c += count;
 		if (c != sb->s_blocksize && !buffer_uptodate(bh)) {
 			ll_rw_block (READ, 1, &bh);
 			wait_on_buffer (bh);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov