summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7f366cf)
This reduces contention on the extent buffer spin locks by testing for a
blocking lock before trying to take the spinlock.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
static int btrfs_spin_on_block(struct extent_buffer *eb)
{
int i;
static int btrfs_spin_on_block(struct extent_buffer *eb)
{
int i;
for (i = 0; i < 512; i++) {
for (i = 0; i < 512; i++) {
if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
return 1;
if (need_resched())
break;
if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
return 1;
if (need_resched())
break;
/* spin for a bit on the BLOCKING flag */
for (i = 0; i < 2; i++) {
/* spin for a bit on the BLOCKING flag */
for (i = 0; i < 2; i++) {
if (!btrfs_spin_on_block(eb))
break;
if (!btrfs_spin_on_block(eb))
break;
DEFINE_WAIT(wait);
wait.func = btrfs_wake_function;
DEFINE_WAIT(wait);
wait.func = btrfs_wake_function;
+ if (!btrfs_spin_on_block(eb))
+ goto sleep;
+
while(1) {
spin_nested(eb);
while(1) {
spin_nested(eb);
* spin for a bit, and if the blocking flag goes away,
* loop around
*/
* spin for a bit, and if the blocking flag goes away,
* loop around
*/
if (btrfs_spin_on_block(eb))
continue;
if (btrfs_spin_on_block(eb))
continue;
prepare_to_wait_exclusive(&eb->lock_wq, &wait,
TASK_UNINTERRUPTIBLE);
prepare_to_wait_exclusive(&eb->lock_wq, &wait,
TASK_UNINTERRUPTIBLE);