[pnfs] [PATCH 1/1] Replaced BUG() with BUG_ON()

iyer at netapp.com iyer at netapp.com
Fri Mar 16 23:01:19 EDT 2007


From: Rahul Iyer <iyer at netapp.com>

Replaced instances of

if (....)
	BUG();

with

BUG_on(...);

Signed-off-by: Rahul Iyer <iyer at netapp.com>
---
 fs/nfs/nfs4proc.c |   31 +++++++++++++------------------
 1 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index b4ce093..89702cf 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -222,10 +222,9 @@ static int nfs41_proc_sequence_done(struct nfs4_session *session, struct nfs41_s
 	unsigned long timestamp;
 	struct nfs4_client *clp;
 
-	if (!session || !(clp = session->client)) {
-		printk(KERN_EMERG "%s is NULL!!!\n", (!session)?"session":"clp");
-		BUG();
-	}
+	BUG_ON(!session);
+	clp = session->client;
+	BUG_ON(!clp);
 
 	if (!status) {
 		timestamp = jiffies;
@@ -372,17 +371,17 @@ static int nfs41_proc_setup_sequence_call(struct nfs4_session *session, struct n
 	struct rpc_cred *cred;
 	struct nfs4_client *clp;
 
-	if (!session)
-		BUG();
+	BUG_ON(!session);
 
 	clp = session->client;
 
-	if (!clp)
-		BUG();
+	BUG_ON(!clp);
+
 	/* Check if the session setup is in progress */
 	down(&session->session_sem);
-	if (session->mutating)
-		BUG();
+	
+	BUG_ON(session->mutating);
+
 	up(&session->session_sem);
 
 	status = _nfs41_proc_setup_sequence(session, args, res);
@@ -393,8 +392,7 @@ static int nfs41_proc_setup_sequence_call(struct nfs4_session *session, struct n
 	if (!clp)
 		goto out;
 
-	if (list_empty(&clp->cl_superblocks))
-		BUG();
+	BUG_ON(list_empty(&clp->cl_superblocks));
 
 	status = -1;
 	list_for_each_entry(server, &clp->cl_superblocks, nfs4_siblings) {
@@ -3977,8 +3975,7 @@ void nfs4_destroy_slot_table(struct nfs4_channel *channel)
 	for (i = 0; i < tbl->max_slots;++i) {
 		slot = &tbl->slots[i];
 
-		if (slot->nr_waiters)
-			BUG();
+		BUG_ON(slot->nr_waiters);
 	}
 
 	kfree(channel->slot_table.slots);
@@ -4116,10 +4113,8 @@ int nfs4_proc_destroy_session(struct nfs4_client *clp)
 	int status = 0;
 	struct rpc_message msg;
 
-	if (!clp || (!clp->cl_session)) {
-		printk(KERN_WARNING "%s called with NULL %s\n", __FUNCTION__, ((!clp)?"client":"session"));
-		BUG();
-	}
+	BUG_ON(!clp);
+	BUG_ON(!clp->cl_session);
 
 	msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_DESTROY_SESSION];
 	msg.rpc_argp = clp->cl_session;
-- 
1.5.0.2


More information about the pNFS mailing list