btrfs: Adjust commit-transaction condition to avoid NO_SPACE more

If we have any chance to make a successful write, we should not give up.

This patch adjust commit-transaction condition from:
  pinned >= wanted
to
  left + pinned >= wanted

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
Zhao Lei 2015-02-17 17:25:51 +08:00 committed by Chris Mason
parent f2ab76188e
commit 264ca0f60b
1 changed files with 2 additions and 1 deletions

View File

@ -3931,7 +3931,8 @@ int btrfs_check_data_free_space(struct inode *inode, u64 bytes)
* don't bother committing the transaction.
*/
if (percpu_counter_compare(&data_sinfo->total_bytes_pinned,
bytes) < 0)
used + bytes -
data_sinfo->total_bytes) < 0)
have_pinned_space = 0;
spin_unlock(&data_sinfo->lock);