linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bob Liu <lliubbo@gmail.com>
To: linux-mm@kvack.org
Cc: dan.magenheimer@oracle.com, konrad.wilk@oracle.com,
	sjenning@linux.vnet.ibm.com, gregkh@linuxfoundation.org,
	akpm@linux-foundation.org, rcj@linux.vnet.ibm.com,
	ngupta@vflare.org, minchan@kernel.org, ric.masonn@gmail.com,
	Bob Liu <lliubbo@gmail.com>
Subject: [PATCH V2 09/11] zcache/tmem: Better error checking on frontswap_register_ops return value.
Date: Wed,  6 Mar 2013 16:51:28 +0800	[thread overview]
Message-ID: <1362559890-16710-9-git-send-email-lliubbo@gmail.com> (raw)
In-Reply-To: <1362559890-16710-1-git-send-email-lliubbo@gmail.com>

From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

In the past it either used to be NULL or the "older" backend. Now we
also return -Exx error codes.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 drivers/staging/zcache/zcache-main.c |    5 ++++-
 drivers/xen/tmem.c                   |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 3554987..48e46c5 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -2006,8 +2006,11 @@ static int __init zcache_init(void)
 			namestr, frontswap_has_exclusive_gets,
 			!disable_frontswap_ignore_nonactive);
 #endif
-		if (old_ops != NULL)
+		if (IS_ERR(old_ops) || old_ops) {
+			if (IS_ERR(old_ops))
+				return PTR_RET(old_ops);
 			pr_warn("%s: frontswap_ops overridden\n", namestr);
+		}
 	}
 	if (ramster_enabled)
 		ramster_init(!disable_cleancache, !disable_frontswap,
diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index 9a4a9ec..2f939e5 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -395,8 +395,11 @@ static int xen_tmem_init(void)
 			frontswap_register_ops(&tmem_frontswap_ops);
 
 		tmem_frontswap_poolid = -1;
-		if (old_ops)
+		if (IS_ERR(old_ops) || old_ops) {
+			if (IS_ERR(old_ops))
+				return PTR_ERR(old_ops);
 			s = " (WARNING: frontswap_ops overridden)";
+		}
 		printk(KERN_INFO "frontswap enabled, RAM provided by "
 				 "Xen Transcendent Memory\n");
 	}
-- 
1.7.10.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2013-03-06  8:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06  8:51 [PATCH V2 01/11] mm: frontswap: lazy initialization to allow tmem backends to build/run as modules Bob Liu
2013-03-06  8:51 ` [PATCH V2 02/11] frontswap: Make frontswap_init use a pointer for the ops Bob Liu
2013-03-06  8:51 ` [PATCH V2 03/11] mm: frontswap: cleanup code Bob Liu
2013-03-06 14:55   ` Konrad Rzeszutek Wilk
2013-03-06  8:51 ` [PATCH V2 04/11] frontswap: Get rid of swap_lock dependency Bob Liu
2013-03-06  8:51 ` [PATCH V2 05/11] mm: cleancache: lazy initialization to allow tmem backends to build/run as modules Bob Liu
2013-03-06  8:51 ` [PATCH V2 06/11] cleancache: Make cleancache_init use a pointer for the ops Bob Liu
2013-03-06  8:51 ` [PATCH V2 07/11] mm: cleancache: clean up cleancache_enabled Bob Liu
2013-03-06  8:51 ` [PATCH V2 08/11] xen: tmem: enable Xen tmem shim to be built/loaded as a module Bob Liu
2013-03-06  8:51 ` Bob Liu [this message]
2013-03-06  8:51 ` [PATCH V2 10/11] staging: zcache: enable ramster " Bob Liu
2013-03-06  8:51 ` [PATCH V2 11/11] staging: zcache: enable zcache " Bob Liu
2013-03-06 12:36 ` [PATCH V2 01/11] mm: frontswap: lazy initialization to allow tmem backends to build/run as modules Ric Mason
2013-03-07 10:10   ` Bob Liu
2013-03-27 21:09 ` Andrew Morton
2013-03-28  2:09   ` Bob Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362559890-16710-9-git-send-email-lliubbo@gmail.com \
    --to=lliubbo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.magenheimer@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=rcj@linux.vnet.ibm.com \
    --cc=ric.masonn@gmail.com \
    --cc=sjenning@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).