summary refs log tree commit diff
path: root/fs/btrfs/transaction.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-04-11 15:45:29 -0400
committerJosef Bacik <josef@redhat.com>2011-04-11 20:43:52 -0400
commit13c5a93e7005d7dae0b6d070d25203593e692d13 (patch)
treeecbc7205618940bbba3f0d9ad000462a5364f763 /fs/btrfs/transaction.h
parent93a54bc4c28a125978cddbe2db9e347391e3522d (diff)
downloadlinux-13c5a93e7005d7dae0b6d070d25203593e692d13.tar.gz
Btrfs: avoid taking the trans_mutex in btrfs_end_transaction
I've been working on making our O_DIRECT latency not suck and I noticed we were
taking the trans_mutex in btrfs_end_transaction.  So to do this we convert
num_writers and use_count to atomic_t's and just decrement them in
btrfs_end_transaction.  Instead of deleting the transaction from the trans list
in put_transaction we do that in btrfs_commit_transaction() since that's the
only time it actually needs to be removed from the list.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/transaction.h')
-rw-r--r--fs/btrfs/transaction.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 229a594cacd5..e441acc6c584 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -27,11 +27,11 @@ struct btrfs_transaction {
 	 * total writers in this transaction, it must be zero before the
 	 * transaction can end
 	 */
-	unsigned long num_writers;
+	atomic_t num_writers;
 
 	unsigned long num_joined;
 	int in_commit;
-	int use_count;
+	atomic_t use_count;
 	int commit_done;
 	int blocked;
 	struct list_head list;