frontswap: make frontswap_init use a pointer for the ops

This simplifies the code in the frontswap - we can get rid of the
'backend_registered' test and instead check against frontswap_ops.

[v1: Rebase on top of 703ba7fe5e (ramster->zcache move]
Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
Signed-off-by: Bob Liu <[email protected]>
Cc: Wanpeng Li <[email protected]>
Cc: Andor Daam <[email protected]>
Cc: Dan Magenheimer <[email protected]>
Cc: Florian Schmaus <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Stefan Hengelein <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Konrad Rzeszutek Wilk 2013-04-30 15:26:51 -07:00 • committed by Linus Torvalds
commit 1e01c968db
4 changed files with 26 additions and 28 deletions

View file

@ -362,7 +362,7 @@ static int __init no_frontswap(char *s)
}
__setup("nofrontswap", no_frontswap);
static struct frontswap_ops __initdata tmem_frontswap_ops = {
static struct frontswap_ops tmem_frontswap_ops = {
.store = tmem_frontswap_store,
.load = tmem_frontswap_load,
.invalidate_page = tmem_frontswap_flush_page,
@ -378,11 +378,11 @@ static int __init xen_tmem_init(void)
#ifdef CONFIG_FRONTSWAP
if (tmem_enabled && use_frontswap) {
char *s = "";
struct frontswap_ops old_ops =
struct frontswap_ops *old_ops =
frontswap_register_ops(&tmem_frontswap_ops);
tmem_frontswap_poolid = -1;
if (old_ops.init != NULL)
if (old_ops)
s = " (WARNING: frontswap_ops overridden)";
printk(KERN_INFO "frontswap enabled, RAM provided by "
"Xen Transcendent Memory%s\n", s);