sys_swapon: do not depend on "type" after allocation
authorCesar Eduardo Barros <cesarb@cesarb.net>
Tue, 22 Mar 2011 23:33:16 +0000 (16:33 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Mar 2011 00:44:06 +0000 (17:44 -0700)
commite8e6c2ec403ecfaa226857d8204344c98fe12b7b
tree93a3cdaf385c72ba1f98add399b34ba65608efff
parent80b0df12b808bf8e8391afae1b43f5e529f76d89
sys_swapon: do not depend on "type" after allocation

Within sys_swapon, after the swap_info entry has been allocated, we
always have type == p->type and swap_info[type] == p. Use this fact to
reduce the dependency on the "type" local variable within the function,
as a preparation to move the allocation of the swap_info entry to a
separate function.

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Tested-by: Eric B Munson <emunson@mgebm.net>
Acked-by: Eric B Munson <emunson@mgebm.net>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujisu.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/swapfile.c