Date: Mon, 18 May 1998 22:11:23 +0200
From: Juergen Orschiedt <orschied@rumms.uni-mannheim.de>
To: linux-m68k@lists.linux-m68k.org
Subject: patch for stram.c (was: Re: L68K: kswapd dies with BUSERR)
Mail-Followup-To: linux-m68k@lists.linux-m68k.org
References: <199805181148.NAA27725@faui22c.informatik.uni-erlangen.de> <199805181255.OAA01664@kassandra.zx.basf-ag.de>
In-Reply-To: <199805181255.OAA01664@kassandra.zx.basf-ag.de>; from juergen.orschiedt@zx.basf-ag.de on Mon, May 18, 1998 at 02:55:12PM +0200
Sender: owner-linux-m68k@phil.uni-sb.de

> But I know exactly that there aren't any differences between
> swapfile.c from 2.1.85 and 2.1.101 - which can't be right in
> this case. 
> 

.. was a bit to unprecise - should read
any differences between swapfile.c:scan_swap_map 2.1.85 and 2.1.101.

Here's my patch:
 
*** linux/arch/m68k/atari/stram.c.~1~	Thu May  7 15:44:04 1998
--- linux/arch/m68k/atari/stram.c	Mon May 18 21:20:28 1998
***************
*** 357,366 ****
  				 "swap=%08lx-%08lx\n", swap_start, swap_end );
  		
  		/* reserve some amount of memory for maintainance of swapping itself:
! 		 * one page for each 4096 (PAGE_SIZE) swap pages. (1 byte for each
! 		 * page) */
  		swap_data = start_mem;
! 		start_mem += PAGE_ALIGN(SWAP_NR(swap_end));
  		/* correct swap_start if necessary */
  		if (swap_start == swap_data)
  			swap_start = start_mem;
--- 357,366 ----
  				 "swap=%08lx-%08lx\n", swap_start, swap_end );
  		
  		/* reserve some amount of memory for maintainance of swapping itself:
! 		 * 1 page for the lockmap, and one page for each 4096 (PAGE_SIZE) swap
! 		 * pages. (1 byte for each page) */
  		swap_data = start_mem;
! 		start_mem += PAGE_ALIGN(SWAP_NR(swap_end)) + PAGE_SIZE;
  		/* correct swap_start if necessary */
  		if (swap_start == swap_data)
  			swap_start = start_mem;
***************
*** 620,626 ****
  	p->flags        = SWP_USED;
  	p->swap_file    = &fake_dentry[0];
  	p->swap_device  = 0;
! 	p->swap_map	    = (unsigned char *)swap_data;
  	p->cluster_nr   = 0;
  	p->next         = -1;
  	p->prio         = 0x7ff0;	/* a rather high priority, but not the higest
--- 620,627 ----
  	p->flags        = SWP_USED;
  	p->swap_file    = &fake_dentry[0];
  	p->swap_device  = 0;
! 	p->swap_lockmap = (unsigned char *)(swap_data);
! 	p->swap_map	    = (unsigned char *)(swap_data + PAGE_SIZE);
  	p->cluster_nr   = 0;
  	p->next         = -1;
  	p->prio         = 0x7ff0;	/* a rather high priority, but not the higest
***************
*** 632,637 ****
--- 633,641 ----
  	swap_inode.i_rdev = p->swap_device;
  	stram_open( &swap_inode, MAGIC_FILE_P );
  	p->max = SWAP_NR(swap_end);
+ 
+ 	/* initialize lockmap */
+ 	memset( p->swap_lockmap, 0, PAGE_SIZE );
  
  	/* initialize swap_map: set regions that are already allocated or belong
  	 * to kernel data space to SWP_RSVD, otherwise to free */
