Daisuke Nishimura 2ca4532a49 mm: add_to_swap_cache() does not return -EEXIST
After commit 355cfa73 ("mm: modify swap_map and add SWAP_HAS_CACHE flag"),
only the context which have set SWAP_HAS_CACHE flag by swapcache_prepare()
or get_swap_page() would call add_to_swap_cache().  So add_to_swap_cache()
doesn't return -EEXIST any more.

Even though it doesn't return -EEXIST, it's not good behavior conceptually
to call swapcache_prepare() in the -EEXIST case, because it means clearing
SWAP_HAS_CACHE flag while the entry is on swap cache.

This patch removes redundant codes and comments from callers of it, and
adds VM_BUG_ON() in error path of add_to_swap_cache() and some comments.

Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-22 07:17:35 -07:00
..
2009-04-01 08:59:13 -07:00
2009-09-22 07:17:27 -07:00
2009-06-16 19:47:28 -07:00
2009-09-22 07:17:33 -07:00
2009-09-22 07:17:33 -07:00
2009-09-22 07:17:31 -07:00
2009-09-22 07:17:31 -07:00
2009-08-10 08:31:16 -07:00
2009-09-22 07:17:29 -07:00
2009-09-22 07:17:33 -07:00
2009-09-22 07:17:33 -07:00
2009-09-22 07:17:33 -07:00
2008-06-12 18:05:41 -07:00
2007-10-20 01:27:18 +02:00
2009-09-22 07:17:31 -07:00
2009-06-29 09:57:10 +03:00
2009-09-22 07:17:33 -07:00
2009-06-23 12:50:05 -07:00
2009-09-22 07:17:30 -07:00
2009-09-22 07:17:29 -07:00