]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mm/zswap: refactor the get/put routines
authorWeijie Yang <weijie.yang@samsung.com>
Tue, 5 Nov 2013 05:55:59 +0000 (16:55 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 5 Nov 2013 05:55:59 +0000 (16:55 +1100)
commitf5458b25addcc36c59bda92b35d04bee590304b7
tree7900f88475f7f2dc677b9a8f1d23f663f07e9927
parent342fe147155dbc63f1a68ee7c31afb92ea6b0cc7
mm/zswap: refactor the get/put routines

The refcount routine was not fit the kernel get/put semantic exactly,
There were too many judgement statements on refcount and it could be
minus.

This patch does the following:

- move refcount judgement to zswap_entry_put() to hide resource free function.

- add a new function zswap_entry_find_get(), so that callers can use easily
in the following pattern:

   zswap_entry_find_get
   .../* do something */
   zswap_entry_put

- to eliminate compile error, move some functions declaration

This patch is based on Minchan Kim <minchan@kernel.org> 's idea and suggestion.

Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Cc: Seth Jennings <sjennings@variantweb.net>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/zswap.c