btrfs: extent-tree: Switch to new check_data_free_space and free_reserved_data_space

Use new reserve/free for buffered write and inode cache.

For buffered write case, as nodatacow write won't increase quota account,
so unlike old behavior which does reserve before check nocow, now we
check nocow first and then only reserve data if we can't do nocow write.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
Qu Wenruo
2015-09-08 17:22:43 +08:00
committed by Chris Mason
parent 4ceff0792d
commit d9d8b2a51a
3 changed files with 27 additions and 19 deletions

View File

@@ -3356,7 +3356,7 @@ again:
num_pages *= 16;
num_pages *= PAGE_CACHE_SIZE;
ret = btrfs_check_data_free_space(inode, num_pages, num_pages);
ret = __btrfs_check_data_free_space(inode, 0, num_pages);
if (ret)
goto out_put;
@@ -3365,7 +3365,7 @@ again:
&alloc_hint);
if (!ret)
dcs = BTRFS_DC_SETUP;
btrfs_free_reserved_data_space(inode, num_pages);
__btrfs_free_reserved_data_space(inode, 0, num_pages);
out_put:
iput(inode);