* [PATCH] add page_offset to mm.h
@ 2005-01-19 11:21 Christoph Hellwig
0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2005-01-19 11:21 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
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.
--- 1.92/include/linux/nfs_fs.h 2005-01-04 01:00:00 +01:00
+++ edited/include/linux/nfs_fs.h 2005-01-19 11:40:42 +01:00
@@ -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
--- 1.44/include/linux/pagemap.h 2004-08-27 08:31:38 +02:00
+++ edited/include/linux/pagemap.h 2005-01-19 11:42:59 +01:00
@@ -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)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-01-19 11:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-19 11:21 [PATCH] add page_offset to mm.h Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.