add page_offset to mm.h
Subsystems (2)
PATCH 1/1 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.
include/linux/nfs_fs.h +0 -6
@@ -254,12 +254,6 @@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
include/linux/pagemap.h +8 -0
@@ -143,6 +143,14 @@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) {