diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-04-30 18:26:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 20:04:00 -0400 |
commit | 1e01c968db3d0aebd48e31db15f24516b03128df (patch) | |
tree | 6f8ebed201fdc426a6926b4a2235e8dd2538f025 /drivers | |
parent | 905cd0e1bf9ffe82d6906a01fd974ea0f70be97a (diff) |
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 703ba7fe5e0 (ramster->zcache move]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Andor Daam <andor.daam@googlemail.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Florian Schmaus <fschmaus@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Stefan Hengelein <ilendir@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/zcache/zcache-main.c | 8 | ||||
-rw-r--r-- | drivers/xen/tmem.c | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index e23d814b5392..09c69c8026f9 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c | |||
@@ -1707,9 +1707,9 @@ static struct frontswap_ops zcache_frontswap_ops = { | |||
1707 | .init = zcache_frontswap_init | 1707 | .init = zcache_frontswap_init |
1708 | }; | 1708 | }; |
1709 | 1709 | ||
1710 | struct frontswap_ops zcache_frontswap_register_ops(void) | 1710 | struct frontswap_ops *zcache_frontswap_register_ops(void) |
1711 | { | 1711 | { |
1712 | struct frontswap_ops old_ops = | 1712 | struct frontswap_ops *old_ops = |
1713 | frontswap_register_ops(&zcache_frontswap_ops); | 1713 | frontswap_register_ops(&zcache_frontswap_ops); |
1714 | 1714 | ||
1715 | return old_ops; | 1715 | return old_ops; |
@@ -1874,7 +1874,7 @@ static int __init zcache_init(void) | |||
1874 | pr_warn("%s: cleancache_ops overridden\n", namestr); | 1874 | pr_warn("%s: cleancache_ops overridden\n", namestr); |
1875 | } | 1875 | } |
1876 | if (zcache_enabled && !disable_frontswap) { | 1876 | if (zcache_enabled && !disable_frontswap) { |
1877 | struct frontswap_ops old_ops; | 1877 | struct frontswap_ops *old_ops; |
1878 | 1878 | ||
1879 | old_ops = zcache_frontswap_register_ops(); | 1879 | old_ops = zcache_frontswap_register_ops(); |
1880 | if (frontswap_has_exclusive_gets) | 1880 | if (frontswap_has_exclusive_gets) |
@@ -1886,7 +1886,7 @@ static int __init zcache_init(void) | |||
1886 | namestr, frontswap_has_exclusive_gets, | 1886 | namestr, frontswap_has_exclusive_gets, |
1887 | !disable_frontswap_ignore_nonactive); | 1887 | !disable_frontswap_ignore_nonactive); |
1888 | #endif | 1888 | #endif |
1889 | if (old_ops.init != NULL) | 1889 | if (old_ops != NULL) |
1890 | pr_warn("%s: frontswap_ops overridden\n", namestr); | 1890 | pr_warn("%s: frontswap_ops overridden\n", namestr); |
1891 | } | 1891 | } |
1892 | if (ramster_enabled) | 1892 | if (ramster_enabled) |
diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index 3ee836d42581..7a01a5fd0f63 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c | |||
@@ -362,7 +362,7 @@ static int __init no_frontswap(char *s) | |||
362 | } | 362 | } |
363 | __setup("nofrontswap", no_frontswap); | 363 | __setup("nofrontswap", no_frontswap); |
364 | 364 | ||
365 | static struct frontswap_ops __initdata tmem_frontswap_ops = { | 365 | static struct frontswap_ops tmem_frontswap_ops = { |
366 | .store = tmem_frontswap_store, | 366 | .store = tmem_frontswap_store, |
367 | .load = tmem_frontswap_load, | 367 | .load = tmem_frontswap_load, |
368 | .invalidate_page = tmem_frontswap_flush_page, | 368 | .invalidate_page = tmem_frontswap_flush_page, |
@@ -378,11 +378,11 @@ static int __init xen_tmem_init(void) | |||
378 | #ifdef CONFIG_FRONTSWAP | 378 | #ifdef CONFIG_FRONTSWAP |
379 | if (tmem_enabled && use_frontswap) { | 379 | if (tmem_enabled && use_frontswap) { |
380 | char *s = ""; | 380 | char *s = ""; |
381 | struct frontswap_ops old_ops = | 381 | struct frontswap_ops *old_ops = |
382 | frontswap_register_ops(&tmem_frontswap_ops); | 382 | frontswap_register_ops(&tmem_frontswap_ops); |
383 | 383 | ||
384 | tmem_frontswap_poolid = -1; | 384 | tmem_frontswap_poolid = -1; |
385 | if (old_ops.init != NULL) | 385 | if (old_ops) |
386 | s = " (WARNING: frontswap_ops overridden)"; | 386 | s = " (WARNING: frontswap_ops overridden)"; |
387 | printk(KERN_INFO "frontswap enabled, RAM provided by " | 387 | printk(KERN_INFO "frontswap enabled, RAM provided by " |
388 | "Xen Transcendent Memory%s\n", s); | 388 | "Xen Transcendent Memory%s\n", s); |