public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] JBD code path (kfree cleanup)
@ 2001-12-01 11:28 Zwane Mwaikambo
  2001-12-01 16:08 ` Stephen C. Tweedie
  0 siblings, 1 reply; 6+ messages in thread
From: Zwane Mwaikambo @ 2001-12-01 11:28 UTC (permalink / raw)
  To: sct; +Cc: Linux Kernel

The intent of this patch is to remove unecessary if (foo) kfree(foo)
checks and also a slight change in the code path. This is a small part of
my i-spent-friday-night-at-home-grepping-for-kfree patch to cleanup kfree
usage.

Please comment on the code path change, it seems sane to me.

Regards,
	Zwane Mwaikambo

diffed against 2.5.1-pre4

diff -urN linux-2.5.1-pre4.orig/fs/jbd/commit.c linux-2.5.1-pre4.kfree/fs/jbd/commit.c
--- linux-2.5.1-pre4.orig/fs/jbd/commit.c	Sat Nov 10 00:25:04 2001
+++ linux-2.5.1-pre4.kfree/fs/jbd/commit.c	Fri Nov 30 23:08:58 2001
@@ -619,17 +619,15 @@
 		 *
 		 * Otherwise, we can just throw away the frozen data now.
 		 */
-		if (jh->b_committed_data) {
-			kfree(jh->b_committed_data);
-			jh->b_committed_data = NULL;
-			if (jh->b_frozen_data) {
-				jh->b_committed_data = jh->b_frozen_data;
-				jh->b_frozen_data = NULL;
-			}
-		} else if (jh->b_frozen_data) {
+		kfree(jh->b_committed_data);
+		jh->b_committed_data = NULL;
+
+		if (jh->b_frozen_data)
+			jh->b_committed_data = jh->b_frozen_data;
+		else
 			kfree(jh->b_frozen_data);
-			jh->b_frozen_data = NULL;
-		}
+
+		jh->b_frozen_data = NULL;

 		spin_lock(&journal_datalist_lock);
 		cp_transaction = jh->b_cp_transaction;
diff -urN linux-2.5.1-pre4.orig/fs/jbd/transaction.c linux-2.5.1-pre4.kfree/fs/jbd/transaction.c
--- linux-2.5.1-pre4.orig/fs/jbd/transaction.c	Sat Nov 10 00:25:04 2001
+++ linux-2.5.1-pre4.kfree/fs/jbd/transaction.c	Fri Nov 30 23:29:20 2001
@@ -739,8 +739,7 @@
 	journal_cancel_revoke(handle, jh);

 out_unlocked:
-	if (frozen_buffer)
-		kfree(frozen_buffer);
+	kfree(frozen_buffer);

 	JBUFFER_TRACE(jh, "exit");
 	return error;


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [PATCH] JBD code path (kfree cleanup)
@ 2001-12-03 15:22 Zwane Mwaikambo
  0 siblings, 0 replies; 6+ messages in thread
From: Zwane Mwaikambo @ 2001-12-03 15:22 UTC (permalink / raw)
  To: ecki; +Cc: Linux Kernel

Bernd Eckenfels:
>So why do you patch it?
>
>Greetings
>Bernd

I wasn't sure, hence the reason why i sent a seperate email to Stephen
Tweedie to verify with.

Cheers,
	Zwane Mwaikambo



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-12-04  3:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-01 11:28 [PATCH] JBD code path (kfree cleanup) Zwane Mwaikambo
2001-12-01 16:08 ` Stephen C. Tweedie
2001-12-01 16:24   ` Zwane Mwaikambo
2001-12-02 13:59     ` Bernd Eckenfels
2001-12-03 10:38     ` Stephen C. Tweedie
  -- strict thread matches above, loose matches on Subject: below --
2001-12-03 15:22 Zwane Mwaikambo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox