]> git.hungrycats.org Git - linux/commitdiff
[PATCH] add page_offset to mm.h
authorChristoph Hellwig <hch@lst.de>
Fri, 21 Jan 2005 00:08:14 +0000 (16:08 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 21 Jan 2005 00:08:14 +0000 (16:08 -0800)
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>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/nfs_fs.h
include/linux/pagemap.h

index 542466ca4d6912e030dace8ac85a4fb69bd3141b..12c46442cc860896d6ff16bafba896573759a6dc 100644 (file)
@@ -254,12 +254,6 @@ static inline int NFS_USE_READDIRPLUS(struct inode *inode)
        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
index 12f8116ff150d862b29a600fd7b75486767863f9..c394c0c8cb392e69c326aab0f536f504a7167947 100644 (file)
@@ -143,6 +143,14 @@ static inline unsigned long get_page_cache_size(void)
        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)
 {