mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 17:11:46 +00:00
btrfs: replace waitqueue_actvie with cond_wake_up
Use the wrappers and reduce the amount of low-level details about the waitqueue management. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3d3a2e610e
commit
093258e6eb
9 changed files with 40 additions and 91 deletions
|
@ -222,11 +222,8 @@ int btrfs_pin_log_trans(struct btrfs_root *root)
|
|||
void btrfs_end_log_trans(struct btrfs_root *root)
|
||||
{
|
||||
if (atomic_dec_and_test(&root->log_writers)) {
|
||||
/*
|
||||
* Implicit memory barrier after atomic_dec_and_test
|
||||
*/
|
||||
if (waitqueue_active(&root->log_writer_wait))
|
||||
wake_up(&root->log_writer_wait);
|
||||
/* atomic_dec_and_test implies a barrier */
|
||||
cond_wake_up_nomb(&root->log_writer_wait);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2988,11 +2985,8 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
|
|||
|
||||
mutex_lock(&log_root_tree->log_mutex);
|
||||
if (atomic_dec_and_test(&log_root_tree->log_writers)) {
|
||||
/*
|
||||
* Implicit memory barrier after atomic_dec_and_test
|
||||
*/
|
||||
if (waitqueue_active(&log_root_tree->log_writer_wait))
|
||||
wake_up(&log_root_tree->log_writer_wait);
|
||||
/* atomic_dec_and_test implies a barrier */
|
||||
cond_wake_up_nomb(&log_root_tree->log_writer_wait);
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
|
@ -3116,13 +3110,11 @@ out_wake_log_root:
|
|||
mutex_unlock(&log_root_tree->log_mutex);
|
||||
|
||||
/*
|
||||
* The barrier before waitqueue_active is needed so all the updates
|
||||
* above are seen by the woken threads. It might not be necessary, but
|
||||
* proving that seems to be hard.
|
||||
* The barrier before waitqueue_active (in cond_wake_up) is needed so
|
||||
* all the updates above are seen by the woken threads. It might not be
|
||||
* necessary, but proving that seems to be hard.
|
||||
*/
|
||||
smp_mb();
|
||||
if (waitqueue_active(&log_root_tree->log_commit_wait[index2]))
|
||||
wake_up(&log_root_tree->log_commit_wait[index2]);
|
||||
cond_wake_up(&log_root_tree->log_commit_wait[index2]);
|
||||
out:
|
||||
mutex_lock(&root->log_mutex);
|
||||
btrfs_remove_all_log_ctxs(root, index1, ret);
|
||||
|
@ -3131,13 +3123,11 @@ out:
|
|||
mutex_unlock(&root->log_mutex);
|
||||
|
||||
/*
|
||||
* The barrier before waitqueue_active is needed so all the updates
|
||||
* above are seen by the woken threads. It might not be necessary, but
|
||||
* proving that seems to be hard.
|
||||
* The barrier before waitqueue_active (in cond_wake_up) is needed so
|
||||
* all the updates above are seen by the woken threads. It might not be
|
||||
* necessary, but proving that seems to be hard.
|
||||
*/
|
||||
smp_mb();
|
||||
if (waitqueue_active(&root->log_commit_wait[index1]))
|
||||
wake_up(&root->log_commit_wait[index1]);
|
||||
cond_wake_up(&root->log_commit_wait[index1]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue