Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34a3d1e8 authored by Peter Zijlstra's avatar Peter Zijlstra
Browse files

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: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 523b44cf
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -233,6 +233,8 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
	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;
}
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include <linux/bit_spinlock.h>
#include <linux/mutex.h>
#include <linux/timer.h>
#include <linux/lockdep.h>

#include <asm/semaphore.h>
#endif
@@ -396,6 +397,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
};