diff mbox series

btrfs: remove redundant log root tree index assignment during log sync

Message ID 92f3ac5682d6582c04cfa8ecd5a79eafa774c253.1696852669.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: remove redundant log root tree index assignment during log sync | expand

Commit Message

Filipe Manana Oct. 9, 2023, 12:01 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

During log syncing, when we start updating the log root tree we compute
an index value, stored in variable 'index2', once we lock the log root
tree's mutex. This value depends on the log root's log_transid. And
shortly after we compute again the same value for 'index2' - the value
is exactly the same since we haven't released the mutex and therefore
the log_transid of the log root is the same as before.

This second 'index2' computation became pointless after commit
a93e01682e28 ("btrfs: remove no longer needed use of log_writers for the
log root tree"). So remove it.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/tree-log.c | 1 -
 1 file changed, 1 deletion(-)

Comments

David Sterba Oct. 9, 2023, 3:30 p.m. UTC | #1
On Mon, Oct 09, 2023 at 01:01:43PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> During log syncing, when we start updating the log root tree we compute
> an index value, stored in variable 'index2', once we lock the log root
> tree's mutex. This value depends on the log root's log_transid. And
> shortly after we compute again the same value for 'index2' - the value
> is exactly the same since we haven't released the mutex and therefore
> the log_transid of the log root is the same as before.
> 
> This second 'index2' computation became pointless after commit
> a93e01682e28 ("btrfs: remove no longer needed use of log_writers for the
> log root tree"). So remove it.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 8b3893c01734..6c7e7e723e3a 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3016,7 +3016,6 @@  int btrfs_sync_log(struct btrfs_trans_handle *trans,
 		goto out;
 	}
 
-	index2 = root_log_ctx.log_transid % 2;
 	if (atomic_read(&log_root_tree->log_commit[index2])) {
 		blk_finish_plug(&plug);
 		ret = btrfs_wait_tree_log_extents(log, mark);