patch-2.3.43 linux/fs/fat/file.c

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

diff -u --recursive --new-file v2.3.42/linux/fs/fat/file.c linux/fs/fat/file.c
@@ -31,17 +31,10 @@
 #define Printk(x) printk x
 
 static struct file_operations fat_file_operations = {
-	NULL,			/* lseek - default */
-	fat_file_read,		/* read */
-	fat_file_write,		/* write */
-	NULL,			/* readdir - bad */
-	NULL,			/* select v2.0.x/poll v2.1.x - default */
-	NULL,			/* ioctl - default */
-	generic_file_mmap,	/* mmap */
-	NULL,			/* no special open is needed */
-	NULL,			/* flush */
-	NULL,			/* release */
-	file_fsync		/* fsync */
+	read:		fat_file_read,
+	write:		fat_file_write,
+	mmap:		generic_file_mmap,
+	fsync:		file_fsync,
 };
 
 struct inode_operations fat_file_inode_operations = {
@@ -57,12 +50,7 @@
 	NULL,			/* rename */
 	NULL,			/* readlink */
 	NULL,			/* follow_link */
-	fat_get_block,		/* get_block */
-	block_read_full_page,	/* readpage */
-	NULL,			/* writepage */
 	fat_truncate,		/* truncate */
-	NULL,			/* permission */
-	NULL			/* revalidate */
 };
 
 ssize_t fat_file_read(
@@ -88,7 +76,7 @@
 	}
 	if (!create)
 		return 0;
-	if (iblock<<9 != MSDOS_I(inode)->i_realsize) {
+	if (iblock<<9 != MSDOS_I(inode)->mmu_private) {
 		BUG();
 		return -EIO;
 	}
@@ -96,7 +84,7 @@
 		if (fat_add_cluster(inode))
 			return -ENOSPC;
 	}
-	MSDOS_I(inode)->i_realsize+=SECTOR_SIZE;
+	MSDOS_I(inode)->mmu_private += 512;
 	phys=fat_bmap(inode, iblock);
 	if (!phys)
 		BUG();
@@ -107,30 +95,6 @@
 	return 0;
 }
 
-static int fat_write_partial_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf)
-{
-	struct dentry *dentry = file->f_dentry;
-	struct inode *inode = dentry->d_inode;
-	struct page *new_page;
-	unsigned long pgpos;
-	long status;
-
-	while((pgpos=MSDOS_I(inode)->i_realsize>>PAGE_CACHE_SHIFT)<page->index){
-		status = -ENOMEM;
-		new_page = grab_cache_page(&inode->i_data, pgpos);
-		if (!new_page)
-			goto out;
-		status = block_write_cont_page(file, new_page, PAGE_SIZE, 0, NULL);
-		UnlockPage(new_page);
-		page_cache_release(new_page);
-		if (status < 0)
-			goto out;
-	}
-	status = block_write_cont_page(file, page, offset, bytes, buf);
-out:
-	return status;
-}
-
 ssize_t fat_file_write(
 	struct file *filp,
 	const char *buf,
@@ -152,8 +116,7 @@
 	struct inode *inode = filp->f_dentry->d_inode;
 	int retval;
 
-	retval = generic_file_write(filp, buf, count, ppos,
-					fat_write_partial_page);
+	retval = generic_file_write(filp, buf, count, ppos);
 	if (retval > 0) {
 		inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 		MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
@@ -173,7 +136,7 @@
 	if (IS_IMMUTABLE(inode))
 		return /* -EPERM */;
 	cluster = SECTOR_SIZE*sbi->cluster_size;
-	MSDOS_I(inode)->i_realsize = ((inode->i_size-1) | (SECTOR_SIZE-1)) + 1;
+	MSDOS_I(inode)->mmu_private = inode->i_size;
 	fat_free(inode,(inode->i_size+(cluster-1))>>sbi->cluster_bits);
 	MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
 	inode->i_ctime = inode->i_mtime = CURRENT_TIME;

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