@@ -683,7 +683,6 @@ struct btrfs_fs_info {
struct btrfs_transaction *running_transaction;
wait_queue_head_t transaction_throttle;
wait_queue_head_t transaction_wait;
- wait_queue_head_t transaction_blocked_wait;
wait_queue_head_t async_submit_wait;
/*
@@ -2986,7 +2986,6 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
init_waitqueue_head(&fs_info->transaction_throttle);
init_waitqueue_head(&fs_info->transaction_wait);
- init_waitqueue_head(&fs_info->transaction_blocked_wait);
init_waitqueue_head(&fs_info->async_submit_wait);
init_waitqueue_head(&fs_info->delayed_iputs_wait);
@@ -4918,8 +4917,8 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
btrfs_destroy_delayed_refs(cur_trans, fs_info);
cur_trans->state = TRANS_STATE_COMMIT_START;
- wake_up(&fs_info->transaction_blocked_wait);
-
+ /* Serialize state change, but there are no waiters */
+ smp_mb();
cur_trans->state = TRANS_STATE_UNBLOCKED;
wake_up(&fs_info->transaction_wait);
@@ -302,7 +302,6 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
WRITE_ONCE(trans->transaction->aborted, errno);
/* Wake up anybody who may be waiting on this transaction */
wake_up(&fs_info->transaction_wait);
- wake_up(&fs_info->transaction_blocked_wait);
__btrfs_handle_fs_error(fs_info, function, line, errno, NULL);
}
/*
@@ -2057,7 +2057,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
}
cur_trans->state = TRANS_STATE_COMMIT_START;
- wake_up(&fs_info->transaction_blocked_wait);
+ /* Serialize state change, but there are no waiters */
+ smp_mb();
if (cur_trans->list.prev != &fs_info->trans_list) {
enum btrfs_trans_state want_state = TRANS_STATE_COMPLETED;
Previous commit removed last use of transaction_blocked_wait. There were still the waking call sites, that are now without use as there's nothing populating the wait list. As wake_up has a memory barrier semantics, it's directly replaced by smp_mb. The transaction state TRANS_STATE_COMMIT_START is now perhaps trivial, but there's more code relying on that, it's left in place to keep the behaviour as close as possible to the original code. Signed-off-by: David Sterba <dsterba@suse.com> --- fs/btrfs/ctree.h | 1 - fs/btrfs/disk-io.c | 5 ++--- fs/btrfs/super.c | 1 - fs/btrfs/transaction.c | 3 ++- 4 files changed, 4 insertions(+), 6 deletions(-)