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) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]