]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] JBD: add some locking assertions
authorAndrew Morton <akpm@digeo.com>
Wed, 18 Jun 2003 01:30:59 +0000 (18:30 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 18 Jun 2003 01:30:59 +0000 (18:30 -0700)
Drop in a few assertions to ensure that the locking rules are being adhered
to.

fs/jbd/transaction.c
include/linux/jbd.h

index 6ee3a0820f2e801475ed1a4283d5ed67dd2459d0..f42f25429858c6404acee1ea7c04189961179e17 100644 (file)
@@ -1498,6 +1498,7 @@ void __journal_unfile_buffer(struct journal_head *jh)
        transaction_t *transaction;
        struct buffer_head *bh = jh2bh(jh);
 
+       J_ASSERT_JH(jh, jbd_is_locked_bh_state(bh));
        transaction = jh->b_transaction;
        if (transaction)
                assert_spin_locked(&transaction->t_journal->j_list_lock);
@@ -1924,6 +1925,7 @@ void __journal_file_buffer(struct journal_head *jh,
        int was_dirty = 0;
        struct buffer_head *bh = jh2bh(jh);
 
+       J_ASSERT_JH(jh, jbd_is_locked_bh_state(bh));
        assert_spin_locked(&transaction->t_journal->j_list_lock);
 
 #ifdef __SMP__
@@ -2013,6 +2015,7 @@ void __journal_refile_buffer(struct journal_head *jh)
        int was_dirty;
        struct buffer_head *bh = jh2bh(jh);
 
+       J_ASSERT_JH(jh, jbd_is_locked_bh_state(bh));
        if (jh->b_transaction)
                assert_spin_locked(&jh->b_transaction->t_journal->j_list_lock);
 
index 81a5767c9b0497f75059e6995fad5ab34c158eea..e0501a317e316cae0e7c1108b63a87d59df51fe3 100644 (file)
@@ -322,6 +322,11 @@ static inline int jbd_trylock_bh_state(struct buffer_head *bh)
        return bit_spin_trylock(BH_State, &bh->b_state);
 }
 
+static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
+{
+       return bit_spin_is_locked(BH_State, &bh->b_state);
+}
+
 static inline void jbd_unlock_bh_state(struct buffer_head *bh)
 {
        bit_spin_unlock(BH_State, &bh->b_state);