Commit 4625956a authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched/wait, fs/btrfs: Convert wait_on_atomic_t() usage to the new wait_var_event() API

The old wait_on_atomic_t() is going to get removed, use the more
flexible wait_var_event() API instead.

No change in functionality.
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarDavid Sterba <dsterba@suse.com>
Cc: Chris Mason <clm@fb.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent ab1fbe32
...@@ -3990,7 +3990,7 @@ void btrfs_dec_nocow_writers(struct btrfs_fs_info *fs_info, u64 bytenr) ...@@ -3990,7 +3990,7 @@ void btrfs_dec_nocow_writers(struct btrfs_fs_info *fs_info, u64 bytenr)
bg = btrfs_lookup_block_group(fs_info, bytenr); bg = btrfs_lookup_block_group(fs_info, bytenr);
ASSERT(bg); ASSERT(bg);
if (atomic_dec_and_test(&bg->nocow_writers)) if (atomic_dec_and_test(&bg->nocow_writers))
wake_up_atomic_t(&bg->nocow_writers); wake_up_var(&bg->nocow_writers);
/* /*
* Once for our lookup and once for the lookup done by a previous call * Once for our lookup and once for the lookup done by a previous call
* to btrfs_inc_nocow_writers() * to btrfs_inc_nocow_writers()
...@@ -4001,8 +4001,7 @@ void btrfs_dec_nocow_writers(struct btrfs_fs_info *fs_info, u64 bytenr) ...@@ -4001,8 +4001,7 @@ void btrfs_dec_nocow_writers(struct btrfs_fs_info *fs_info, u64 bytenr)
void btrfs_wait_nocow_writers(struct btrfs_block_group_cache *bg) void btrfs_wait_nocow_writers(struct btrfs_block_group_cache *bg)
{ {
wait_on_atomic_t(&bg->nocow_writers, atomic_t_wait, wait_var_event(&bg->nocow_writers, !atomic_read(&bg->nocow_writers));
TASK_UNINTERRUPTIBLE);
} }
static const char *alloc_name(u64 flags) static const char *alloc_name(u64 flags)
...@@ -6526,7 +6525,7 @@ void btrfs_dec_block_group_reservations(struct btrfs_fs_info *fs_info, ...@@ -6526,7 +6525,7 @@ void btrfs_dec_block_group_reservations(struct btrfs_fs_info *fs_info,
bg = btrfs_lookup_block_group(fs_info, start); bg = btrfs_lookup_block_group(fs_info, start);
ASSERT(bg); ASSERT(bg);
if (atomic_dec_and_test(&bg->reservations)) if (atomic_dec_and_test(&bg->reservations))
wake_up_atomic_t(&bg->reservations); wake_up_var(&bg->reservations);
btrfs_put_block_group(bg); btrfs_put_block_group(bg);
} }
...@@ -6552,8 +6551,7 @@ void btrfs_wait_block_group_reservations(struct btrfs_block_group_cache *bg) ...@@ -6552,8 +6551,7 @@ void btrfs_wait_block_group_reservations(struct btrfs_block_group_cache *bg)
down_write(&space_info->groups_sem); down_write(&space_info->groups_sem);
up_write(&space_info->groups_sem); up_write(&space_info->groups_sem);
wait_on_atomic_t(&bg->reservations, atomic_t_wait, wait_var_event(&bg->reservations, !atomic_read(&bg->reservations));
TASK_UNINTERRUPTIBLE);
} }
/** /**
...@@ -11061,7 +11059,7 @@ void btrfs_wait_for_snapshot_creation(struct btrfs_root *root) ...@@ -11061,7 +11059,7 @@ void btrfs_wait_for_snapshot_creation(struct btrfs_root *root)
ret = btrfs_start_write_no_snapshotting(root); ret = btrfs_start_write_no_snapshotting(root);
if (ret) if (ret)
break; break;
wait_on_atomic_t(&root->will_be_snapshotted, atomic_t_wait, wait_var_event(&root->will_be_snapshotted,
TASK_UNINTERRUPTIBLE); !atomic_read(&root->will_be_snapshotted));
} }
} }
...@@ -723,7 +723,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, ...@@ -723,7 +723,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
btrfs_subvolume_release_metadata(fs_info, &pending_snapshot->block_rsv); btrfs_subvolume_release_metadata(fs_info, &pending_snapshot->block_rsv);
dec_and_free: dec_and_free:
if (atomic_dec_and_test(&root->will_be_snapshotted)) if (atomic_dec_and_test(&root->will_be_snapshotted))
wake_up_atomic_t(&root->will_be_snapshotted); wake_up_var(&root->will_be_snapshotted);
free_pending: free_pending:
kfree(pending_snapshot->root_item); kfree(pending_snapshot->root_item);
btrfs_free_path(pending_snapshot->path); btrfs_free_path(pending_snapshot->path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment