Commit ed0c6345 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] add page_offset to mm.h

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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 439bed8b
......@@ -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
......
......@@ -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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment