From: Boaz Harrosh <bharrosh@panasas.com>
To: open-osd <osd-dev@open-osd.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: [PATCH 2/7] exofs: Optimize read_4_write
Date: Tue, 08 Feb 2011 18:26:31 +0200 [thread overview]
Message-ID: <4D516EB7.5010004@panasas.com> (raw)
In-Reply-To: <4D516C1C.8060504@panasas.com>
Don't attempt a read passed i_size, just zero the page and be
done with it.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
fs/exofs/inode.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index a755523..7d755dc 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -350,8 +350,10 @@ static int readpage_strip(void *data, struct page *page)
if (!pcol->read_4_write)
unlock_page(page);
- EXOFS_DBGMSG("readpage_strip(0x%lx, 0x%lx) empty page,"
- " splitting\n", inode->i_ino, page->index);
+ EXOFS_DBGMSG("readpage_strip(0x%lx) empty page len=%zx "
+ "read_4_write=%d index=0x%lx end_index=0x%lx "
+ "splitting\n", inode->i_ino, len,
+ pcol->read_4_write, page->index, end_index);
return read_exec(pcol);
}
@@ -722,11 +724,28 @@ int exofs_write_begin(struct file *file, struct address_space *mapping,
/* read modify write */
if (!PageUptodate(page) && (len != PAGE_CACHE_SIZE)) {
+ loff_t i_size = i_size_read(mapping->host);
+ pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
+ size_t rlen;
+
+ if (page->index < end_index)
+ rlen = PAGE_CACHE_SIZE;
+ else if (page->index == end_index)
+ rlen = i_size & ~PAGE_CACHE_MASK;
+ else
+ rlen = 0;
+
+ if (!rlen) {
+ clear_highpage(page);
+ SetPageUptodate(page);
+ goto out;
+ }
+
ret = _readpage(page, true);
if (ret) {
/*SetPageError was done by _readpage. Is it ok?*/
unlock_page(page);
- EXOFS_DBGMSG("__readpage_filler failed\n");
+ EXOFS_DBGMSG("__readpage failed\n");
}
}
out:
next prev parent reply other threads:[~2011-02-08 16:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-08 16:15 [PATCHSET 0/7] exofs: Some pending changes for 2.6.39 Boaz Harrosh
2011-02-08 16:17 ` [PATCH 1/7] exofs: trivial: fix some indentation and debug prints Boaz Harrosh
2011-02-08 16:26 ` Boaz Harrosh [this message]
2011-02-08 16:29 ` [PATCH 3/7] exofs: simple fsync race fix Boaz Harrosh
2011-02-08 16:31 ` [PATCH 4/7] exofs: Override read-ahead to align on stripe_size Boaz Harrosh
2011-02-08 16:35 ` [PATCH 5/7] exofs: Add option to mount by osdname Boaz Harrosh
2011-02-08 16:40 ` [PATCH 6/7] exofs: Write sbi->s_nextid as part of the Create command Boaz Harrosh
2011-02-08 16:42 ` [PATCH 7/7] exofs: deprecate the commands pending counter Boaz Harrosh
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=4D516EB7.5010004@panasas.com \
--to=bharrosh@panasas.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=osd-dev@open-osd.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;
as well as URLs for NNTP newsgroup(s).