[PATCH 4/4] btrfs: remove fs_info::transaction_blocked_wait
From: David Sterba <dsterba@suse.com>
Date: 2021-06-03 15:23:11
Subsystem:
btrfs file system, filesystems (vfs and infrastructure), the rest · Maintainers:
Chris Mason, David Sterba, Alexander Viro, Christian Brauner, Linus Torvalds
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(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index c601f6733576..384c00c982ab 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h@@ -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; /*
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index d1d5091a8385..bad7df788458 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c@@ -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);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index bc613218c8c5..8d87da2b2377 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c@@ -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); } /*
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 5f3c95c876c8..1fd04170b0bf 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c@@ -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;
--
2.31.1