[PATCH] JBD code path (kfree cleanup)

From: Zwane Mwaikambo (zwane@linux.realnet.co.sz)
Date: Sat Dec 01 2001 - 06:28:56 EST


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;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Dec 07 2001 - 21:00:15 EST