
From: Christoph Hellwig <hch@lst.de>

To convert page->index to a byte index you need to cast it to loff_t first
so it's a 64bit value.  There have been quite a few places that got it
wrong in the kernel.  To make it easier a nice little helper would be nice,
and in fact the NFS code already has it.  Let's move it to pagemap.h so
everyone can use it.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/linux/nfs_fs.h  |    6 ------
 25-akpm/include/linux/pagemap.h |    8 ++++++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff -puN include/linux/nfs_fs.h~add-page_offset-to-mmh include/linux/nfs_fs.h
--- 25/include/linux/nfs_fs.h~add-page_offset-to-mmh	Wed Jan 19 15:34:15 2005
+++ 25-akpm/include/linux/nfs_fs.h	Wed Jan 19 15:34:15 2005
@@ -254,12 +254,6 @@ static inline int NFS_USE_READDIRPLUS(st
 	return NFS_FLAGS(inode) & NFS_INO_ADVISE_RDPLUS;
 }
 
-static inline
-loff_t page_offset(struct page *page)
-{
-	return ((loff_t)page->index) << PAGE_CACHE_SHIFT;
-}
-
 /**
  * nfs_save_change_attribute - Returns the inode attribute change cookie
  * @inode - pointer to inode
diff -puN include/linux/pagemap.h~add-page_offset-to-mmh include/linux/pagemap.h
--- 25/include/linux/pagemap.h~add-page_offset-to-mmh	Wed Jan 19 15:34:15 2005
+++ 25-akpm/include/linux/pagemap.h	Wed Jan 19 15:34:15 2005
@@ -143,6 +143,14 @@ static inline unsigned long get_page_cac
 	return ret;
 }
 
+/*
+ * Return byte-offset into filesystem object for page.
+ */
+static inline loff_t page_offset(struct page *page)
+{
+	return ((loff_t)page->index) << PAGE_CACHE_SHIFT;
+}
+
 static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
 					unsigned long address)
 {
_
