mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: junjie cai <junjiec@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: junjie cai <junjiec@gmail.com>
Subject: [RFC][fat] use mpage_readpage when cluster size is page-alignment
Date: Wed, 28 Dec 2005 16:56:55 +0900	[thread overview]
Message-ID: <ca992f110512272356l379dccc5k6288c28411ff7af4@mail.gmail.com> (raw)

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) {

             reply	other threads:[~2005-12-28  7:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-28  7:56 junjie cai [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca992f110512272356l379dccc5k6288c28411ff7af4@mail.gmail.com \
    --to=junjiec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®