All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 4/4] btrfs: remove fs_info::transaction_blocked_wait
Date: Thu,  3 Jun 2021 17:20:28 +0200	[thread overview]
Message-ID: <2451f25c6c27f0e3e51774b95efc709bc9abf572.1622733245.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1622733245.git.dsterba@suse.com>

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


  parent reply	other threads:[~2021-06-03 15:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 15:20 [PATCH 0/4] Slightly how START_SYNC and WAIT_SYNC work David Sterba
2021-06-03 15:20 ` [PATCH 1/4] btrfs: sink wait_for_unblock parameter to async commit David Sterba
2021-06-04 12:35   ` Anand Jain
2021-06-03 15:20 ` [PATCH 2/4] btrfs: inline wait_current_trans_commit_start in its caller David Sterba
2021-06-04 12:37   ` Anand Jain
2021-06-03 15:20 ` [PATCH 3/4] btrfs: replace async commit by pending actions David Sterba
2021-06-03 15:20 ` David Sterba [this message]
2021-06-04 10:59 ` [PATCH 0/4] Slightly how START_SYNC and WAIT_SYNC work David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2451f25c6c27f0e3e51774b95efc709bc9abf572.1622733245.git.dsterba@suse.com \
    --to=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.