Skip to content

Commit

Permalink
Btrfs: save us a read_lock
Browse files Browse the repository at this point in the history
This does not change the logic of code, but can save us a read_lock.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
  • Loading branch information
Liu Bo authored and Josef Bacik committed Feb 20, 2013
1 parent 51fab69 commit 39f9d02
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fs/btrfs/locking.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ void btrfs_tree_read_lock(struct extent_buffer *eb)
read_unlock(&eb->lock);
return;
}
read_unlock(&eb->lock);
wait_event(eb->write_lock_wq, atomic_read(&eb->blocking_writers) == 0);
read_lock(&eb->lock);
if (atomic_read(&eb->blocking_writers)) {
read_unlock(&eb->lock);
wait_event(eb->write_lock_wq,
atomic_read(&eb->blocking_writers) == 0);
goto again;
}
atomic_inc(&eb->read_locks);
Expand Down

0 comments on commit 39f9d02

Please sign in to comment.