Skip to content

Commit

Permalink
Btrfs: don't commit the transaction if we dont have enough pinned bytes
Browse files Browse the repository at this point in the history
I noticed when running an enospc test that we would get stuck committing the
transaction in check_data_space even though we truly didn't have enough space.
So check to see if bytes_pinned is bigger than num_bytes, if it's not don't
commit the transaction.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
  • Loading branch information
Josef Bacik committed Jun 8, 2011
1 parent 3de85bb commit f2bb8f5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3089,6 +3089,13 @@ int btrfs_check_data_free_space(struct inode *inode, u64 bytes)
}
goto again;
}

/*
* If we have less pinned bytes than we want to allocate then
* don't bother committing the transaction, it won't help us.
*/
if (data_sinfo->bytes_pinned < bytes)
committed = 1;
spin_unlock(&data_sinfo->lock);

/* commit the current transaction and try again */
Expand Down

0 comments on commit f2bb8f5

Please sign in to comment.