linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] filemap : fix the wrong offset
@ 2009-09-29  9:06 Huang Shijie
  2009-09-29 11:02 ` Hugh Dickins
  0 siblings, 1 reply; 4+ messages in thread
From: Huang Shijie @ 2009-09-29  9:06 UTC (permalink / raw)
  To: akpm; +Cc: hugh.dickins, linux-mm, Huang Shijie

The offset should be in PAGE_CACHE_SHIFT unit, not in PAGE_SHIFT unit.

Though we do not fully implement the page cache in larger chunks,
but in the vma_address(), all the pages do the (PAGE_CACHE_SHIFT - PAGE_SHIFT) shift,
so do a reverse operation in filemap_fault() is needed.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
---
 mm/filemap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index ef169f3..2d8385e 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1502,7 +1502,7 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	struct address_space *mapping = file->f_mapping;
 	struct file_ra_state *ra = &file->f_ra;
 	struct inode *inode = mapping->host;
-	pgoff_t offset = vmf->pgoff;
+	pgoff_t offset = vmf->pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT);
 	struct page *page;
 	pgoff_t size;
 	int ret = 0;
-- 
1.6.0.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2009-10-01  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-29  9:06 [PATCH] filemap : fix the wrong offset Huang Shijie
2009-09-29 11:02 ` Hugh Dickins
2009-09-30  3:23   ` Huang Shijie
2009-10-01 10:24     ` Hugh Dickins

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