summaryrefslogtreecommitdiffstats
path: root/mm/swap_state.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-05-12 21:05:59 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-05-12 21:05:59 +0000
commitba2dacab305c598cd4c34a604f8e276bf5bab5ff (patch)
tree78670a0139bf4d5ace617b29b7eba82bbc74d602 /mm/swap_state.c
parentb77bf69998121e689c5e86cc5630d39a0a9ee6ca (diff)
Merge with Linux 2.3.99-pre7 and various other bits.
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r--mm/swap_state.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 29ba0d78b..ad686e4c3 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -47,14 +47,20 @@ void show_swap_cache_info(void)
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 @@ void free_page_and_swap_cache(struct page *page)
}
UnlockPage(page);
}
-
- ClearPageSwapEntry(page);
-
__free_page(page);
}
@@ -228,6 +231,7 @@ struct page * read_swap_cache_async(swp_entry_t entry, int wait)
/*
* 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;