More patch description fixups. Standardize case.
[ext4-patch-queue.git] / lockdep-annotate-jbd2-journal-start.patch
blob0fa1dfd81efbf5caba38478c70b9d7168c279407
1 jbd2: add lockdep support
3 From: Mingming Cao <cmm@us.ibm.com>
5 Ported from similar patch for the jbd layer.
7 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
8 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 ---
11 fs/jbd2/transaction.c | 11 +++++++++++
12 include/linux/jbd2.h | 4 ++++
13 2 files changed, 15 insertions(+)
15 Index: linux-2.6.24-rc7/fs/jbd2/transaction.c
16 ===================================================================
17 --- linux-2.6.24-rc7.orig/fs/jbd2/transaction.c 2008-01-16 15:30:24.000000000 -0800
18 +++ linux-2.6.24-rc7/fs/jbd2/transaction.c 2008-01-16 15:41:14.000000000 -0800
19 @@ -241,6 +241,8 @@ out:
20 return ret;
23 +static struct lock_class_key jbd2_handle_key;
25 /* Allocate a new handle. This should probably be in a slab... */
26 static handle_t *new_handle(int nblocks)
28 @@ -251,6 +253,9 @@ static handle_t *new_handle(int nblocks)
29 handle->h_buffer_credits = nblocks;
30 handle->h_ref = 1;
32 + lockdep_init_map(&handle->h_lockdep_map, "jbd2_handle",
33 + &jbd2_handle_key, 0);
35 return handle;
38 @@ -293,7 +298,11 @@ handle_t *jbd2_journal_start(journal_t *
39 jbd2_free_handle(handle);
40 current->journal_info = NULL;
41 handle = ERR_PTR(err);
42 + goto out;
45 + lock_acquire(&handle->h_lockdep_map, 0, 0, 0, 2, _THIS_IP_);
46 +out:
47 return handle;
50 @@ -1419,6 +1428,8 @@ int jbd2_journal_stop(handle_t *handle)
51 spin_unlock(&journal->j_state_lock);
54 + lock_release(&handle->h_lockdep_map, 1, _THIS_IP_);
56 jbd2_free_handle(handle);
57 return err;
59 Index: linux-2.6.24-rc7/include/linux/jbd2.h
60 ===================================================================
61 --- linux-2.6.24-rc7.orig/include/linux/jbd2.h 2008-01-16 15:29:03.000000000 -0800
62 +++ linux-2.6.24-rc7/include/linux/jbd2.h 2008-01-16 15:29:54.000000000 -0800
63 @@ -418,6 +418,10 @@ struct handle_s
64 unsigned int h_sync: 1; /* sync-on-close */
65 unsigned int h_jdata: 1; /* force data journaling */
66 unsigned int h_aborted: 1; /* fatal error on handle */
68 +#ifdef CONFIG_DEBUG_LOCK_ALLOC
69 + struct lockdep_map h_lockdep_map;
70 +#endif