mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
frontswap: allow multiple backends
Change frontswap single pointer to a singly linked list of frontswap implementations. Update Xen tmem implementation as register no longer returns anything. Frontswap only keeps track of a single implementation; any implementation that registers second (or later) will replace the previously registered implementation, and gets a pointer to the previous implementation that the new implementation is expected to pass all frontswap functions to if it can't handle the function itself. However that method doesn't really make much sense, as passing that work on to every implementation adds unnecessary work to implementations; instead, frontswap should simply keep a list of all registered implementations and try each implementation for any function. Most importantly, neither of the two currently existing frontswap implementations in the kernel actually do anything with any previous frontswap implementation that they replace when registering. This allows frontswap to successfully manage multiple implementations by keeping a list of them all. Signed-off-by: Dan Streetman <[email protected]> Cc: Konrad Rzeszutek Wilk <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: David Vrabel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
b05b9f5f9d
commit
d1dc6f1bcf
3 changed files with 139 additions and 98 deletions
|
|
@ -381,15 +381,9 @@ static int __init xen_tmem_init(void)
|
|||
#ifdef CONFIG_FRONTSWAP
|
||||
if (tmem_enabled && frontswap) {
|
||||
char *s = "";
|
||||
struct frontswap_ops *old_ops;
|
||||
|
||||
tmem_frontswap_poolid = -1;
|
||||
old_ops = frontswap_register_ops(&tmem_frontswap_ops);
|
||||
if (IS_ERR(old_ops) || old_ops) {
|
||||
if (IS_ERR(old_ops))
|
||||
return PTR_ERR(old_ops);
|
||||
s = " (WARNING: frontswap_ops overridden)";
|
||||
}
|
||||
frontswap_register_ops(&tmem_frontswap_ops);
|
||||
pr_info("frontswap enabled, RAM provided by Xen Transcendent Memory%s\n",
|
||||
s);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue