[lc-checkins] CVS: linux/mm swapfile.c,1.32,1.33
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-07-17 20:44:39
|
Update of /cvsroot/linuxcompressed/linux/mm In directory usw-pr-cvs1:/tmp/cvs-serv16293/mm Modified Files: swapfile.c Log Message: Features o First implementation of support for SMP systems. There are only two spinlocks used for that, but the goal at the moment is stability, not performance. With our first tests, it is working without corruption on a system with preempt patch, but only swap cache support (and without resizing compressed cache). Let the first races show up :-) As soon as the whole code is working somewhat well, those global locks will be divided into many other to improve concurrency. Bug fixes o fixed compilation error when compressed cache is disabled Cleanups o removed virtual_swap_count() since it wasn't used (swap_count() isn't used either). Index: swapfile.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/swapfile.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** swapfile.c 17 Jul 2002 13:00:57 -0000 1.32 --- swapfile.c 17 Jul 2002 20:44:36 -0000 1.33 *************** *** 162,166 **** type = SWP_TYPE(entry); if (vswap_address(entry)) ! return &swap_info[type]; if (type >= nr_swapfiles) goto bad_nofile; --- 162,166 ---- type = SWP_TYPE(entry); if (vswap_address(entry)) ! goto virtual_swap; if (type >= nr_swapfiles) goto bad_nofile; *************** *** 192,195 **** --- 192,199 ---- out: return NULL; + virtual_swap: + spin_lock(&virtual_swap_list); + /* it returns a bogus value (not allocated). FIX IT */ + return &swap_info[type]; } *************** *** 197,203 **** { if (vswap_info_struct(p)) ! return; swap_device_unlock(p); swap_list_unlock(); } --- 201,210 ---- { if (vswap_info_struct(p)) ! goto virtual_swap; swap_device_unlock(p); swap_list_unlock(); + return; + virtual_swap: + spin_unlock(&virtual_swap_list); } *************** *** 259,263 **** /* Is the only swap cache user the cache itself? */ if (vswap_address(entry)) { ! if (virtual_swap_count(entry) == 1) exclusive = 1; goto check_exclusive; --- 266,270 ---- /* Is the only swap cache user the cache itself? */ if (vswap_address(entry)) { ! if (vswap_address[SWP_OFFSET(entry)]->swap_count == 1) exclusive = 1; goto check_exclusive; *************** *** 335,339 **** retval = 0; if (vswap_address(entry)) { ! if (virtual_swap_count(entry) == 1) exclusive = 1; goto check_exclusive; --- 342,346 ---- retval = 0; if (vswap_address(entry)) { ! if (vswap_address[SWP_OFFSET(entry)]->swap_count == 1) exclusive = 1; goto check_exclusive; *************** *** 1188,1192 **** if (vswap_address(entry)) ! return virtual_swap_duplicate(entry); type = SWP_TYPE(entry); if (type >= nr_swapfiles) --- 1195,1199 ---- if (vswap_address(entry)) ! goto virtual_swap; type = SWP_TYPE(entry); if (type >= nr_swapfiles) *************** *** 1214,1217 **** --- 1221,1227 ---- printk(KERN_ERR "swap_dup: %s%08lx\n", Bad_file, entry.val); goto out; + + virtual_swap: + return virtual_swap_duplicate(entry); } *************** *** 1231,1235 **** goto bad_entry; if (vswap_address(entry)) ! return virtual_swap_count(entry); type = SWP_TYPE(entry); if (type >= nr_swapfiles) --- 1241,1245 ---- goto bad_entry; if (vswap_address(entry)) ! goto virtual_swap; type = SWP_TYPE(entry); if (type >= nr_swapfiles) *************** *** 1257,1260 **** --- 1267,1272 ---- printk(KERN_ERR "swap_count: %s%08lx\n", Unused_offset, entry.val); goto out; + virtual_swap: + return vswap_address[SWP_OFFSET(entry)]->swap_count; } |