]> err.no Git - linux-2.6/commitdiff
jbd2: add lockdep support
authorMingming Cao <cmm@us.ibm.com>
Tue, 29 Jan 2008 04:58:27 +0000 (23:58 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 29 Jan 2008 04:58:27 +0000 (23:58 -0500)
Ported from similar patch for the jbd layer.

Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/jbd2/transaction.c
include/linux/jbd2.h

index f30802aeefae3739b717592d4c82331f2fffc79d..70b3199e69dc02050a33b9630e0deb07f09fe1e2 100644 (file)
@@ -241,6 +241,8 @@ out:
        return ret;
 }
 
+static struct lock_class_key jbd2_handle_key;
+
 /* Allocate a new handle.  This should probably be in a slab... */
 static handle_t *new_handle(int nblocks)
 {
@@ -251,6 +253,9 @@ static handle_t *new_handle(int nblocks)
        handle->h_buffer_credits = nblocks;
        handle->h_ref = 1;
 
+       lockdep_init_map(&handle->h_lockdep_map, "jbd2_handle",
+                                               &jbd2_handle_key, 0);
+
        return handle;
 }
 
@@ -293,7 +298,11 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
                jbd2_free_handle(handle);
                current->journal_info = NULL;
                handle = ERR_PTR(err);
+               goto out;
        }
+
+       lock_acquire(&handle->h_lockdep_map, 0, 0, 0, 2, _THIS_IP_);
+out:
        return handle;
 }
 
@@ -1419,6 +1428,8 @@ int jbd2_journal_stop(handle_t *handle)
                spin_unlock(&journal->j_state_lock);
        }
 
+       lock_release(&handle->h_lockdep_map, 1, _THIS_IP_);
+
        jbd2_free_handle(handle);
        return err;
 }
index 98a2bc5d3e3f9463f298ff1b78320e28d211d36d..2cbf6fdb17993409c40c4cc67db62a633ec858db 100644 (file)
@@ -418,6 +418,10 @@ struct handle_s
        unsigned int    h_sync:         1;      /* sync-on-close */
        unsigned int    h_jdata:        1;      /* force data journaling */
        unsigned int    h_aborted:      1;      /* fatal error on handle */
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+       struct lockdep_map      h_lockdep_map;
+#endif
 };