diff options
author | Josef Bacik <josef@redhat.com> | 2011-08-30 14:19:10 (GMT) |
---|---|---|
committer | Josef Bacik <josef@redhat.com> | 2011-10-19 19:12:42 (GMT) |
commit | c09544e07f8cdc455ed8615d4c067d694c33bd18 (patch) | |
tree | c9943e56457ac64e2223396841e043e4514462e0 /fs/btrfs/inode-map.c | |
parent | 300e4f8a56f263797568c95b71c949f9f02e4534 (diff) | |
download | linux-c09544e07f8cdc455ed8615d4c067d694c33bd18.tar.xz |
Btrfs: handle enospc accounting for free space inodes
Since free space inodes now use normal checksumming we need to make sure to
account for their metadata use. So reserve metadata space, and then if we fail
to write out the metadata we can just release it, otherwise it will be freed up
when the io completes. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/inode-map.c')
-rw-r--r-- | fs/btrfs/inode-map.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index b4087e0..53dcbdf 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c @@ -465,14 +465,16 @@ again: /* Just to make sure we have enough space */ prealloc += 8 * PAGE_CACHE_SIZE; - ret = btrfs_check_data_free_space(inode, prealloc); + ret = btrfs_delalloc_reserve_space(inode, prealloc); if (ret) goto out_put; ret = btrfs_prealloc_file_range_trans(inode, trans, 0, 0, prealloc, prealloc, prealloc, &alloc_hint); - if (ret) + if (ret) { + btrfs_delalloc_release_space(inode, prealloc); goto out_put; + } btrfs_free_reserved_data_space(inode, prealloc); out_put: |