diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2010-11-22 11:02:45 -0500 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2011-03-15 09:02:49 -0400 |
commit | a8f1418f9e9bd4c487a7b703ff26c5dd5ceb2bf3 (patch) | |
tree | 9d72e1be99cf2eb4c8a35cfa8ac3df69dfbca01a /fs/exofs | |
parent | 0a935519cca83f26dc15e7577fa6c2b39606a4ac (diff) |
exofs: Optimize read_4_write
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>
Diffstat (limited to 'fs/exofs')
-rw-r--r-- | fs/exofs/inode.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c index a7555238c41a..c8f58a96e597 100644 --- a/fs/exofs/inode.c +++ b/fs/exofs/inode.c | |||
@@ -350,8 +350,10 @@ static int readpage_strip(void *data, struct page *page) | |||
350 | 350 | ||
351 | if (!pcol->read_4_write) | 351 | if (!pcol->read_4_write) |
352 | unlock_page(page); | 352 | unlock_page(page); |
353 | EXOFS_DBGMSG("readpage_strip(0x%lx, 0x%lx) empty page," | 353 | EXOFS_DBGMSG("readpage_strip(0x%lx) empty page len=%zx " |
354 | " splitting\n", inode->i_ino, page->index); | 354 | "read_4_write=%d index=0x%lx end_index=0x%lx " |
355 | "splitting\n", inode->i_ino, len, | ||
356 | pcol->read_4_write, page->index, end_index); | ||
355 | 357 | ||
356 | return read_exec(pcol); | 358 | return read_exec(pcol); |
357 | } | 359 | } |
@@ -722,11 +724,28 @@ int exofs_write_begin(struct file *file, struct address_space *mapping, | |||
722 | 724 | ||
723 | /* read modify write */ | 725 | /* read modify write */ |
724 | if (!PageUptodate(page) && (len != PAGE_CACHE_SIZE)) { | 726 | if (!PageUptodate(page) && (len != PAGE_CACHE_SIZE)) { |
727 | loff_t i_size = i_size_read(mapping->host); | ||
728 | pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; | ||
729 | size_t rlen; | ||
730 | |||
731 | if (page->index < end_index) | ||
732 | rlen = PAGE_CACHE_SIZE; | ||
733 | else if (page->index == end_index) | ||
734 | rlen = i_size & ~PAGE_CACHE_MASK; | ||
735 | else | ||
736 | rlen = 0; | ||
737 | |||
738 | if (!rlen) { | ||
739 | clear_highpage(page); | ||
740 | SetPageUptodate(page); | ||
741 | goto out; | ||
742 | } | ||
743 | |||
725 | ret = _readpage(page, true); | 744 | ret = _readpage(page, true); |
726 | if (ret) { | 745 | if (ret) { |
727 | /*SetPageError was done by _readpage. Is it ok?*/ | 746 | /*SetPageError was done by _readpage. Is it ok?*/ |
728 | unlock_page(page); | 747 | unlock_page(page); |
729 | EXOFS_DBGMSG("__readpage_filler failed\n"); | 748 | EXOFS_DBGMSG("__readpage failed\n"); |
730 | } | 749 | } |
731 | } | 750 | } |
732 | out: | 751 | out: |