Re: [PATCH 02/25] btrfs: rework async transaction committing
From: David Sterba <hidden>
Date: 2021-11-18 12:13:37
On Fri, Nov 05, 2021 at 04:45:28PM -0400, Josef Bacik wrote:
Currently we do this awful thing where we get another ref on a trans handle, async off that handle and commit the transaction from that work. Because we do this we have to mess with current->journal_info and the freeze counting stuff. We already have an async thing to kick for the transaction commit, the transaction kthread. Replace this work struct with a flag on the fs_info to tell the kthread to go ahead and commit even if it's before our timeout. Then we can drastically simplify the async transaction commit path.
I wanted to get rid of the async commit completely and reusing the pending operations that's basically the same what you add as the new fs bit. https://lore.kernel.org/linux-btrfs/808c557f1ae3034fdfa2d2361e864aac90ba5a94.1622733245.git.dsterba@suse.com/ (local) There's also a followup removing transaction_blocked_wait, I got some hangs in btrfs/011. I haven't tested 3/4 separately so I don't know the exact cause.
quoted hunk ↗ jump to hunk
--- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h@@ -595,6 +595,9 @@ enum { /* Indicate whether there are any tree modification log users */ BTRFS_FS_TREE_MOD_LOG_USERS, + /* Indicate that we want the transaction kthread to commit right now. */ + BTRFS_FS_COMMIT_TRANS,
This is duplicating functionality behind BTRFS_PENDING_COMMIT, otherwise simplifying the async commit is good of course.