diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-07-30 10:04:48 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-07-30 10:14:46 -0400 |
commit | f36f3042eae238bdaefe7c79310afe573bfc3622 (patch) | |
tree | 83ea0e271dedeef36423509be7f4189b838d14b5 /fs/btrfs/transaction.c | |
parent | 276e680d192a67d222fcea51af37b056feffb665 (diff) | |
download | lwn-f36f3042eae238bdaefe7c79310afe573bfc3622.tar.gz lwn-f36f3042eae238bdaefe7c79310afe573bfc3622.zip |
Btrfs: be more polite in the async caching threads
The semaphore used by the async caching threads can prevent a
transaction commit, which can make the FS appear to stall. This
releases the semaphore more often when a transaction commit is
in progress.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index de48e4ec808c..cdbb5022da52 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -857,6 +857,16 @@ static void update_super_roots(struct btrfs_root *root) super->root_level = root_item->level; } +int btrfs_transaction_in_commit(struct btrfs_fs_info *info) +{ + int ret = 0; + spin_lock(&info->new_trans_lock); + if (info->running_transaction) + ret = info->running_transaction->in_commit; + spin_unlock(&info->new_trans_lock); + return ret; +} + int btrfs_commit_transaction(struct btrfs_trans_handle *trans, struct btrfs_root *root) { |