[lc-checkins] CVS: linux/mm swapfile.c,1.31,1.32
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-07-17 13:01:02
|
Update of /cvsroot/linuxcompressed/linux/mm
In directory usw-pr-cvs1:/tmp/cvs-serv577/mm
Modified Files:
swapfile.c
Log Message:
Bug fixes
o Fixed bug in find_free_swp_buffer() that would leak fragment structs
if the fragment got completely freed while refilling swap buffers.
o Fixed bug in find_free_swp_buffer() that would panic in the case it
couldn't free any swap buffers because of gfp_mask. In this case,
simply return neither decompressing nor writing the dirty fragment.
o Fixed bug in comp_cache_swp_duplicate() (now known as
virtual_swap_duplicate()) that would cause a kernel BUG if duplicating
a freed entry. This scenario may happen in the swapin path code.
Cleanups
o Renamed comp_cache_swp_{duplicate,free,count} -> virtual_swap_*
o Removed useless "nrpages" parameter
Index: swapfile.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/swapfile.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** swapfile.c 16 Jul 2002 18:41:55 -0000 1.31
--- swapfile.c 17 Jul 2002 13:00:57 -0000 1.32
***************
*** 208,212 ****
if (vswap_info_struct(p))
! return comp_cache_swp_free(SWP_ENTRY(COMP_CACHE_SWP_TYPE, offset));
count = p->swap_map[offset];
--- 208,212 ----
if (vswap_info_struct(p))
! return virtual_swap_free(offset);
count = p->swap_map[offset];
***************
*** 259,270 ****
/* Is the only swap cache user the cache itself? */
if (vswap_address(entry)) {
! if (comp_cache_swp_count(entry) == 1)
exclusive = 1;
}
! else {
! if (p->swap_map[SWP_OFFSET(entry)] == 1)
! exclusive = 1;
! }
!
if (exclusive) {
/* Recheck the page count with the pagecache lock held.. */
--- 259,269 ----
/* Is the only swap cache user the cache itself? */
if (vswap_address(entry)) {
! if (virtual_swap_count(entry) == 1)
exclusive = 1;
+ goto check_exclusive;
}
! if (p->swap_map[SWP_OFFSET(entry)] == 1)
! exclusive = 1;
! check_exclusive:
if (exclusive) {
/* Recheck the page count with the pagecache lock held.. */
***************
*** 336,347 ****
retval = 0;
if (vswap_address(entry)) {
! if (comp_cache_swp_count(entry) == 1)
exclusive = 1;
}
! else {
! if (p->swap_map[SWP_OFFSET(entry)] == 1)
! exclusive = 1;
! }
!
if (exclusive) {
/* Recheck the page count with the pagecache lock held.. */
--- 335,345 ----
retval = 0;
if (vswap_address(entry)) {
! if (virtual_swap_count(entry) == 1)
exclusive = 1;
+ goto check_exclusive;
}
! if (p->swap_map[SWP_OFFSET(entry)] == 1)
! exclusive = 1;
! check_exclusive:
if (exclusive) {
/* Recheck the page count with the pagecache lock held.. */
***************
*** 1190,1194 ****
if (vswap_address(entry))
! return comp_cache_swp_duplicate(entry);
type = SWP_TYPE(entry);
if (type >= nr_swapfiles)
--- 1188,1192 ----
if (vswap_address(entry))
! return virtual_swap_duplicate(entry);
type = SWP_TYPE(entry);
if (type >= nr_swapfiles)
***************
*** 1233,1237 ****
goto bad_entry;
if (vswap_address(entry))
! return comp_cache_swp_count(entry);
type = SWP_TYPE(entry);
if (type >= nr_swapfiles)
--- 1231,1235 ----
goto bad_entry;
if (vswap_address(entry))
! return virtual_swap_count(entry);
type = SWP_TYPE(entry);
if (type >= nr_swapfiles)
|