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

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

diff -u --recursive --new-file v2.3.29/linux/fs/fat/file.c linux/fs/fat/file.c
@@ -60,10 +60,8 @@
 	fat_get_block,		/* get_block */
 	block_read_full_page,	/* readpage */
 	NULL,			/* writepage */
-	block_flushpage,	/* flushpage */
 	fat_truncate,		/* truncate */
 	NULL,			/* permission */
-	NULL,			/* smap */
 	NULL			/* revalidate */
 };
 
@@ -113,39 +111,23 @@
 {
 	struct dentry *dentry = file->f_dentry;
 	struct inode *inode = dentry->d_inode;
-	struct page *new_page, **hash;
+	struct page *new_page;
 	unsigned long pgpos;
-	struct page *page_cache = NULL;
 	long status;
 
-	pgpos = MSDOS_I(inode)->i_realsize >> PAGE_CACHE_SHIFT;
-	while (pgpos < page->index) {
-		hash = page_hash(&inode->i_data, pgpos);
-repeat_find:	new_page = __find_lock_page(&inode->i_data, pgpos, hash);
-		if (!new_page) {
-			if (!page_cache) {
-				page_cache = page_cache_alloc();
-				if (page_cache)
-					goto repeat_find;
-				status = -ENOMEM;
-				goto out;
-			}
-			new_page = page_cache;
-			if (add_to_page_cache_unique(new_page,&inode->i_data,pgpos,hash))
-				goto repeat_find;
-			page_cache = NULL;
-		}
+	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;
-		pgpos = MSDOS_I(inode)->i_realsize >> PAGE_CACHE_SHIFT;
 	}
 	status = block_write_cont_page(file, page, offset, bytes, buf);
 out:
-	if (page_cache)
-		page_cache_free(page_cache);
 	return status;
 }
 

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