patch-2.3.99-pre7 linux/mm/swap_state.c
Next file: linux/mm/swapfile.c
Previous file: linux/mm/slab.c
Back to the patch index
Back to the overall index
- Lines: 40
- Date:
Wed May 3 17:04:12 2000
- Orig file:
v2.3.99-pre6/linux/mm/swap_state.c
- Orig date:
Wed Apr 26 16:34:09 2000
diff -u --recursive --new-file v2.3.99-pre6/linux/mm/swap_state.c linux/mm/swap_state.c
@@ -47,14 +47,20 @@
void add_to_swap_cache(struct page *page, swp_entry_t entry)
{
+ unsigned long flags;
+
#ifdef SWAP_CACHE_INFO
swap_cache_add_total++;
#endif
+ if (!PageLocked(page))
+ BUG();
if (PageTestandSetSwapCache(page))
BUG();
if (page->mapping)
BUG();
- add_to_page_cache(page, &swapper_space, entry.val);
+ flags = page->flags & ~((1 << PG_error) | (1 << PG_dirty));
+ page->flags = flags | (1 << PG_referenced) | (1 << PG_uptodate);
+ add_to_page_cache_locked(page, &swapper_space, entry.val);
}
static inline void remove_from_swap_cache(struct page *page)
@@ -130,9 +136,6 @@
}
UnlockPage(page);
}
-
- ClearPageSwapEntry(page);
-
__free_page(page);
}
@@ -228,6 +231,7 @@
/*
* Add it to the swap cache and read its contents.
*/
+ lock_page(new_page);
add_to_swap_cache(new_page, entry);
rw_swap_page(READ, new_page, wait);
return new_page;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)