public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][fat] use mpage_readpage when cluster size is page-alignment
@ 2005-12-28  7:56 junjie cai
       [not found] ` <2cd57c900512280040g594ba003y@mail.gmail.com>
  2005-12-28 12:57 ` OGAWA Hirofumi
  0 siblings, 2 replies; 9+ messages in thread
From: junjie cai @ 2005-12-28  7:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: junjie cai

hi,

it seems that mpage_read is faster then block_read_full_page
when performing block-adjacent I/O.
though not tested strictly, in a flash-based system,
copying a 600k file reduced to 17ms from 30ms

thanks.
                                             junjie

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index a0f9b9f..3d25a2b 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -22,6 +22,7 @@
 #include <linux/mount.h>
 #include <linux/vfs.h>
 #include <linux/parser.h>
+#include <linux/mpage.h>
 #include <asm/unaligned.h>

 #ifndef CONFIG_FAT_DEFAULT_IOCHARSET
@@ -95,6 +96,11 @@ static int fat_readpage(struct file *fil
 	return block_read_full_page(page, fat_get_block);
 }

+static int fat_mpage_readpage(struct file *file, struct page *page)
+{
+	return  mpage_readpage(page, fat_get_block);
+}
+
 static int fat_prepare_write(struct file *file, struct page *page,
 			     unsigned from, unsigned to)
 {
@@ -130,6 +136,18 @@ static struct address_space_operations f
 };

 /*
+ * for page-alignemnt cluster-size
+ */
+static struct address_space_operations fat_mpage_aops = {
+	.readpage	= fat_mpage_readpage,
+	.writepage	= fat_writepage,
+	.sync_page	= block_sync_page,
+	.prepare_write	= fat_prepare_write,
+	.commit_write	= fat_commit_write,
+	.bmap		= _fat_bmap
+};
+
+/*
  * New FAT inode stuff. We do the following:
  *	a) i_ino is constant and has nothing with on-disk location.
  *	b) FAT manages its own cache of directory entries.
@@ -288,7 +306,12 @@ static int fat_fill_inode(struct inode *
 		inode->i_size = le32_to_cpu(de->size);
 		inode->i_op = &fat_file_inode_operations;
 		inode->i_fop = &fat_file_operations;
-		inode->i_mapping->a_ops = &fat_aops;
+
+		if (sbi->cluster_size & ~PAGE_MASK)
+			inode->i_mapping->a_ops = &fat_aops;
+		else
+			inode->i_mapping->a_ops = &fat_mpage_aops;
+
 		MSDOS_I(inode)->mmu_private = inode->i_size;
 	}
 	if (de->attr & ATTR_SYS) {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-29 10:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-28  7:56 [RFC][fat] use mpage_readpage when cluster size is page-alignment junjie cai
     [not found] ` <2cd57c900512280040g594ba003y@mail.gmail.com>
2005-12-28  9:36   ` junjie cai
2005-12-28 12:57 ` OGAWA Hirofumi
2005-12-29  6:38   ` cai
2005-12-29  8:06     ` Pekka Enberg
2005-12-29  8:52       ` cai
2005-12-29  9:12         ` Pekka J Enberg
2005-12-29  9:19     ` OGAWA Hirofumi
2005-12-29 10:24       ` cai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox