diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-08-23 03:29:11 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-08-23 03:29:11 -0400 |
commit | 216e80982324cc1290350013ada9a7ea0aca501e (patch) | |
tree | e8df87d79b54634120d16be610b7e7c6c4b4fff2 | |
parent | 6f8efee4bc3be099cea2e71eb101e2ebdf26ff28 (diff) |
fs: jbd2: Replace bit spinlocks
Bit spinlocks are not really RT friendly and in general I don't like
them as they escape the lockdep debugging. Make it use the bh locks as
we already did for jdb.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | fs/jbd2/transaction.c | 6 | ||||
-rw-r--r-- | include/linux/jbd2.h | 21 |
2 files changed, 18 insertions, 9 deletions
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 6213ac728f30..575d8c0bd757 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1451,7 +1451,7 @@ void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh) | |||
1451 | transaction_t *transaction; | 1451 | transaction_t *transaction; |
1452 | struct buffer_head *bh = jh2bh(jh); | 1452 | struct buffer_head *bh = jh2bh(jh); |
1453 | 1453 | ||
1454 | J_ASSERT_JH(jh, jbd_is_locked_bh_state(bh)); | 1454 | J_ASSERT_JH_SMP(jh, jbd_is_locked_bh_state(bh)); |
1455 | transaction = jh->b_transaction; | 1455 | transaction = jh->b_transaction; |
1456 | if (transaction) | 1456 | if (transaction) |
1457 | assert_spin_locked(&transaction->t_journal->j_list_lock); | 1457 | assert_spin_locked(&transaction->t_journal->j_list_lock); |
@@ -1883,7 +1883,7 @@ void __jbd2_journal_file_buffer(struct journal_head *jh, | |||
1883 | int was_dirty = 0; | 1883 | int was_dirty = 0; |
1884 | struct buffer_head *bh = jh2bh(jh); | 1884 | struct buffer_head *bh = jh2bh(jh); |
1885 | 1885 | ||
1886 | J_ASSERT_JH(jh, jbd_is_locked_bh_state(bh)); | 1886 | J_ASSERT_JH_SMP(jh, jbd_is_locked_bh_state(bh)); |
1887 | assert_spin_locked(&transaction->t_journal->j_list_lock); | 1887 | assert_spin_locked(&transaction->t_journal->j_list_lock); |
1888 | 1888 | ||
1889 | J_ASSERT_JH(jh, jh->b_jlist < BJ_Types); | 1889 | J_ASSERT_JH(jh, jh->b_jlist < BJ_Types); |
@@ -1971,7 +1971,7 @@ void __jbd2_journal_refile_buffer(struct journal_head *jh) | |||
1971 | int was_dirty; | 1971 | int was_dirty; |
1972 | struct buffer_head *bh = jh2bh(jh); | 1972 | struct buffer_head *bh = jh2bh(jh); |
1973 | 1973 | ||
1974 | J_ASSERT_JH(jh, jbd_is_locked_bh_state(bh)); | 1974 | J_ASSERT_JH_SMP(jh, jbd_is_locked_bh_state(bh)); |
1975 | if (jh->b_transaction) | 1975 | if (jh->b_transaction) |
1976 | assert_spin_locked(&jh->b_transaction->t_journal->j_list_lock); | 1976 | assert_spin_locked(&jh->b_transaction->t_journal->j_list_lock); |
1977 | 1977 | ||
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index d97eb652d6ca..406d3b5160be 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -319,6 +319,15 @@ void buffer_assertion_failure(struct buffer_head *bh); | |||
319 | #define J_EXPECT_JH(jh, expr, why...) __journal_expect(expr, ## why) | 319 | #define J_EXPECT_JH(jh, expr, why...) __journal_expect(expr, ## why) |
320 | #endif | 320 | #endif |
321 | 321 | ||
322 | /* | ||
323 | * For assertions that are only valid on SMP (e.g. spin_is_locked()): | ||
324 | */ | ||
325 | #ifdef CONFIG_SMP | ||
326 | # define J_ASSERT_JH_SMP(jh, expr) J_ASSERT_JH(jh, expr) | ||
327 | #else | ||
328 | # define J_ASSERT_JH_SMP(jh, assert) do { } while (0) | ||
329 | #endif | ||
330 | |||
322 | enum jbd_state_bits { | 331 | enum jbd_state_bits { |
323 | BH_JBD /* Has an attached ext3 journal_head */ | 332 | BH_JBD /* Has an attached ext3 journal_head */ |
324 | = BH_PrivateStart, | 333 | = BH_PrivateStart, |
@@ -355,32 +364,32 @@ static inline struct journal_head *bh2jh(struct buffer_head *bh) | |||
355 | 364 | ||
356 | static inline void jbd_lock_bh_state(struct buffer_head *bh) | 365 | static inline void jbd_lock_bh_state(struct buffer_head *bh) |
357 | { | 366 | { |
358 | bit_spin_lock(BH_State, &bh->b_state); | 367 | spin_lock(&bh->b_state_lock); |
359 | } | 368 | } |
360 | 369 | ||
361 | static inline int jbd_trylock_bh_state(struct buffer_head *bh) | 370 | static inline int jbd_trylock_bh_state(struct buffer_head *bh) |
362 | { | 371 | { |
363 | return bit_spin_trylock(BH_State, &bh->b_state); | 372 | return spin_trylock(&bh->b_state_lock); |
364 | } | 373 | } |
365 | 374 | ||
366 | static inline int jbd_is_locked_bh_state(struct buffer_head *bh) | 375 | static inline int jbd_is_locked_bh_state(struct buffer_head *bh) |
367 | { | 376 | { |
368 | return bit_spin_is_locked(BH_State, &bh->b_state); | 377 | return spin_is_locked(&bh->b_state_lock); |
369 | } | 378 | } |
370 | 379 | ||
371 | static inline void jbd_unlock_bh_state(struct buffer_head *bh) | 380 | static inline void jbd_unlock_bh_state(struct buffer_head *bh) |
372 | { | 381 | { |
373 | bit_spin_unlock(BH_State, &bh->b_state); | 382 | spin_unlock(&bh->b_state_lock); |
374 | } | 383 | } |
375 | 384 | ||
376 | static inline void jbd_lock_bh_journal_head(struct buffer_head *bh) | 385 | static inline void jbd_lock_bh_journal_head(struct buffer_head *bh) |
377 | { | 386 | { |
378 | bit_spin_lock(BH_JournalHead, &bh->b_state); | 387 | spin_lock(&bh->b_uptodate_lock); |
379 | } | 388 | } |
380 | 389 | ||
381 | static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh) | 390 | static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh) |
382 | { | 391 | { |
383 | bit_spin_unlock(BH_JournalHead, &bh->b_state); | 392 | spin_unlock(&bh->b_uptodate_lock); |
384 | } | 393 | } |
385 | 394 | ||
386 | /* Flags in jbd_inode->i_flags */ | 395 | /* Flags in jbd_inode->i_flags */ |