[parisc-linux-cvs] pa15: remove i_mmap_offset

Matthew Wilcox willy@ldl.fc.hp.com
Fri, 13 Jul 2001 22:20:09 -0600


I realised that we don't need to store the offset in the inode; we can
reconstruct that information from any existing shared mapping of the
file.  This is quite a big relief to me :-)

Index: arch/parisc/kernel/sys_parisc.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/sys_parisc.c,v
retrieving revision 1.12
diff -u -p -r1.12 sys_parisc.c
--- sys_parisc.c	2001/07/06 03:25:28	1.12
+++ sys_parisc.c	2001/07/14 04:06:44
@@ -56,10 +56,12 @@ static unsigned long get_unshared_area(u
 static unsigned long get_shared_area(struct inode *inode, unsigned long addr,
 		unsigned long len, unsigned long pgoff)
 {
-	struct vm_area_struct *vma;
-	int offset = (inode->i_mmap_offset + (pgoff << PAGE_SHIFT)) &
-		(SHMLBA - 1);
+	struct vm_area_struct *vma, *first_vma;
+	int offset;
 
+	first_vma = inode->i_mapping->i_mmap_shared;
+	offset = (first_vma->vm_start + ((pgoff - first_vma->vm_pgoff) << PAGE_SHIFT)) & (SHMLBA - 1);
+
 	if (!addr)
 		addr = TASK_UNMAPPED_BASE;
 	addr = DCACHE_ALIGN(addr - offset) + offset;
@@ -88,15 +90,8 @@ unsigned long arch_get_unmapped_area(str
 		inode = filp->f_dentry->d_inode;
 	}
 
-	if (inode && (flags & MAP_SHARED)) {
-		if (inode->i_mapping->i_mmap_shared) {
-			addr = get_shared_area(inode, addr, len, pgoff);
-		} else {
-			addr = get_unshared_area(addr, len);
-			if (addr) {
-				inode->i_mmap_offset = (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1);
-			}
-		}
+	if (inode && (flags & MAP_SHARED) && (inode->i_mapping->i_mmap_shared)) {
+		addr = get_shared_area(inode, addr, len, pgoff);
 	} else {
 		addr = get_unshared_area(addr, len);
 	}
Index: include/linux/fs.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/linux/fs.h,v
retrieving revision 1.12
diff -u -p -r1.12 fs.h
--- fs.h	2001/07/05 21:39:33	1.12
+++ fs.h	2001/07/14 04:06:44
@@ -451,7 +451,6 @@ struct inode {
 
 	unsigned long		i_state;
 
-	unsigned int		i_mmap_offset; /* Handle L1 d-cache aliasing */
 	unsigned int		i_flags;
 	unsigned char		i_sock;