summary refs log tree commit diff
path: root/fs/jbd
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-11 22:11:12 +0200
committerPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-11 22:11:12 +0200
commit34a3d1e83708702ac6cb872215e68cd07dae298b (patch)
treebed36f9a4b64a98676776ccff820b7897b1dcb74 /fs/jbd
parent523b44cff279c42c79f7bda709e2fefc30f20a59 (diff)
downloadlinux-34a3d1e83708702ac6cb872215e68cd07dae298b.tar.gz
lockdep: annotate journal_start()
On Fri, 2007-07-13 at 02:05 -0700, Andrew Morton wrote:

> Except lockdep doesn't know about journal_start(), which has ranking
> requirements similar to a semaphore.  

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'fs/jbd')
-rw-r--r--fs/jbd/transaction.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index 772b6531a2a2..8df5bac0b7a5 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -233,6 +233,8 @@ out:
 	return ret;
 }
 
+static struct lock_class_key jbd_handle_key;
+
 /* Allocate a new handle.  This should probably be in a slab... */
 static handle_t *new_handle(int nblocks)
 {
@@ -243,6 +245,8 @@ static handle_t *new_handle(int nblocks)
 	handle->h_buffer_credits = nblocks;
 	handle->h_ref = 1;
 
+	lockdep_init_map(&handle->h_lockdep_map, "jbd_handle", &jbd_handle_key, 0);
+
 	return handle;
 }
 
@@ -286,6 +290,9 @@ handle_t *journal_start(journal_t *journal, int nblocks)
 		current->journal_info = NULL;
 		handle = ERR_PTR(err);
 	}
+
+	lock_acquire(&handle->h_lockdep_map, 0, 0, 0, 2, _THIS_IP_);
+
 	return handle;
 }
 
@@ -1411,6 +1418,8 @@ int journal_stop(handle_t *handle)
 		spin_unlock(&journal->j_state_lock);
 	}
 
+	lock_release(&handle->h_lockdep_map, 1, _THIS_IP_);
+
 	jbd_free_handle(handle);
 	return err;
 }