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>
This commit is contained in:
Josef Bacik
2011-04-11 15:45:29 -04:00
parent 93a54bc4c2
commit 13c5a93e70
3 changed files with 19 additions and 24 deletions

View File

@@ -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;