Commit 2c68ee754c40099c59828e59618a54726f76126a
Committed by
Linus Torvalds
1 parent
f24075bd0c
Exists in
master
and in
20 other branches
[PATCH] sem2mutex: jbd, j_checkpoint_mutex
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 4 changed files with 10 additions and 9 deletions Side-by-side Diff
fs/jbd/checkpoint.c
... | ... | @@ -85,7 +85,7 @@ |
85 | 85 | if (journal->j_flags & JFS_ABORT) |
86 | 86 | return; |
87 | 87 | spin_unlock(&journal->j_state_lock); |
88 | - down(&journal->j_checkpoint_sem); | |
88 | + mutex_lock(&journal->j_checkpoint_mutex); | |
89 | 89 | |
90 | 90 | /* |
91 | 91 | * Test again, another process may have checkpointed while we |
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | log_do_checkpoint(journal); |
99 | 99 | spin_lock(&journal->j_state_lock); |
100 | 100 | } |
101 | - up(&journal->j_checkpoint_sem); | |
101 | + mutex_unlock(&journal->j_checkpoint_mutex); | |
102 | 102 | } |
103 | 103 | } |
104 | 104 |
fs/jbd/journal.c
... | ... | @@ -659,8 +659,8 @@ |
659 | 659 | init_waitqueue_head(&journal->j_wait_checkpoint); |
660 | 660 | init_waitqueue_head(&journal->j_wait_commit); |
661 | 661 | init_waitqueue_head(&journal->j_wait_updates); |
662 | - init_MUTEX(&journal->j_barrier); | |
663 | - init_MUTEX(&journal->j_checkpoint_sem); | |
662 | + mutex_init(&journal->j_barrier); | |
663 | + mutex_init(&journal->j_checkpoint_mutex); | |
664 | 664 | spin_lock_init(&journal->j_revoke_lock); |
665 | 665 | spin_lock_init(&journal->j_list_lock); |
666 | 666 | spin_lock_init(&journal->j_state_lock); |
fs/jbd/transaction.c
... | ... | @@ -455,7 +455,7 @@ |
455 | 455 | * to make sure that we serialise special journal-locked operations |
456 | 456 | * too. |
457 | 457 | */ |
458 | - down(&journal->j_barrier); | |
458 | + mutex_lock(&journal->j_barrier); | |
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
... | ... | @@ -470,7 +470,7 @@ |
470 | 470 | { |
471 | 471 | J_ASSERT(journal->j_barrier_count != 0); |
472 | 472 | |
473 | - up(&journal->j_barrier); | |
473 | + mutex_unlock(&journal->j_barrier); | |
474 | 474 | spin_lock(&journal->j_state_lock); |
475 | 475 | --journal->j_barrier_count; |
476 | 476 | spin_unlock(&journal->j_state_lock); |
include/linux/jbd.h
... | ... | @@ -28,6 +28,7 @@ |
28 | 28 | #include <linux/journal-head.h> |
29 | 29 | #include <linux/stddef.h> |
30 | 30 | #include <linux/bit_spinlock.h> |
31 | +#include <linux/mutex.h> | |
31 | 32 | #include <asm/semaphore.h> |
32 | 33 | #endif |
33 | 34 | |
... | ... | @@ -575,7 +576,7 @@ |
575 | 576 | * @j_wait_checkpoint: Wait queue to trigger checkpointing |
576 | 577 | * @j_wait_commit: Wait queue to trigger commit |
577 | 578 | * @j_wait_updates: Wait queue to wait for updates to complete |
578 | - * @j_checkpoint_sem: Semaphore for locking against concurrent checkpoints | |
579 | + * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints | |
579 | 580 | * @j_head: Journal head - identifies the first unused block in the journal |
580 | 581 | * @j_tail: Journal tail - identifies the oldest still-used block in the |
581 | 582 | * journal. |
... | ... | @@ -645,7 +646,7 @@ |
645 | 646 | int j_barrier_count; |
646 | 647 | |
647 | 648 | /* The barrier lock itself */ |
648 | - struct semaphore j_barrier; | |
649 | + struct mutex j_barrier; | |
649 | 650 | |
650 | 651 | /* |
651 | 652 | * Transactions: The current running transaction... |
... | ... | @@ -687,7 +688,7 @@ |
687 | 688 | wait_queue_head_t j_wait_updates; |
688 | 689 | |
689 | 690 | /* Semaphore for locking against concurrent checkpoints */ |
690 | - struct semaphore j_checkpoint_sem; | |
691 | + struct mutex j_checkpoint_mutex; | |
691 | 692 | |
692 | 693 | /* |
693 | 694 | * Journal head: identifies the first unused block in the journal. |