X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fparisc%2Fkernel%2Fsys_parisc.c;h=625a701f0eaba3a55a587df0e90f56cfa5b70ae4;hb=d939d46ba7caa14e960be18e18f5c07be8806d7a;hp=93cd4dcfa4702c76335e20219e42835a5fd90648;hpb=86090fcac5e27b630656fe3d963a6b80e26dac44;p=linux-2.6.git diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index 93cd4dcfa..625a701f0 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c @@ -68,17 +68,8 @@ static unsigned long get_unshared_area(unsigned long addr, unsigned long len) * existing mapping and use the same offset. New scheme is to use the * address of the kernel data structure as the seed for the offset. * We'll see how that works... - */ -#if 0 -static int get_offset(struct address_space *mapping) -{ - struct vm_area_struct *vma = list_entry(mapping->i_mmap_shared.next, - struct vm_area_struct, shared); - return (vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT)) & - (SHMLBA - 1); -} -#else -/* The mapping is cacheline aligned, so there's no information in the bottom + * + * The mapping is cacheline aligned, so there's no information in the bottom * few bits of the address. We're looking for 10 bits (4MB / 4k), so let's * drop the bottom 8 bits and use bits 8-17. */ @@ -87,13 +78,12 @@ static int get_offset(struct address_space *mapping) int offset = (unsigned long) mapping << (PAGE_SHIFT - 8); return offset & 0x3FF000; } -#endif static unsigned long get_shared_area(struct address_space *mapping, unsigned long addr, unsigned long len, unsigned long pgoff) { struct vm_area_struct *vma; - int offset = get_offset(mapping); + int offset = mapping ? get_offset(mapping) : 0; addr = DCACHE_ALIGN(addr - offset) + offset; @@ -117,8 +107,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, if (!addr) addr = TASK_UNMAPPED_BASE; - if (filp && (flags & MAP_SHARED)) { + if (filp) { addr = get_shared_area(filp->f_mapping, addr, len, pgoff); + } else if(flags & MAP_SHARED) { + addr = get_shared_area(NULL, addr, len, pgoff); } else { addr = get_unshared_area(addr, len); }