Skip to content

Commit

Permalink
btrfs: Document a mutex lock/unlock sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
kdave committed May 2, 2011
1 parent b3b4aa7 commit 8cc33e5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,10 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,

btrfs_release_path(path);

/*
* Mutex was contended, block until it's released and try
* again
*/
mutex_lock(&head->mutex);
mutex_unlock(&head->mutex);
btrfs_put_delayed_ref(&head->node);
Expand Down Expand Up @@ -2297,6 +2301,10 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
atomic_inc(&ref->refs);

spin_unlock(&delayed_refs->lock);
/*
* Mutex was contended, block until it's
* released and try again
*/
mutex_lock(&head->mutex);
mutex_unlock(&head->mutex);

Expand Down Expand Up @@ -2363,6 +2371,10 @@ static noinline int check_delayed_ref(struct btrfs_trans_handle *trans,

btrfs_release_path(path);

/*
* Mutex was contended, block until it's released and let
* caller try again
*/
mutex_lock(&head->mutex);
mutex_unlock(&head->mutex);
btrfs_put_delayed_ref(&head->node);
Expand Down

0 comments on commit 8cc33e5

Please sign in to comment.