aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2010-10-15 16:52:49 -0400
committerJosef Bacik <josef@redhat.com>2010-10-22 15:55:01 -0400
commit8bb8ab2e93f9c3c9453e13be0f37d344a32a3a6d (patch)
tree619600c7458a3af18555f189d53efc4c092b9280 /fs/btrfs/ctree.h
parent14ed0ca6e8236f2d264c4a8faec9e3a2b3d04377 (diff)
Btrfs: rework how we reserve metadata bytes
With multi-threaded writes we were getting ENOSPC early because somebody would come in, start flushing delalloc because they couldn't make their reservation, and in the meantime other threads would come in and use the space that was getting freed up, so when the original thread went to check to see if they had space they didn't and they'd return ENOSPC. So instead if we have some free space but not enough for our reservation, take the reservation and then start doing the flushing. The only time we don't take reservations is when we've already overcommitted our space, that way we don't have people who come late to the party way overcommitting ourselves. This also moves all of the retrying and flushing code into reserve_metdata_bytes so it's all uniform. This keeps my fs_mark test from returning -ENOSPC as soon as it starts and actually lets me fill up the disk. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index f32404db2c5d..47bc66e34da7 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2082,7 +2082,7 @@ int btrfs_check_data_free_space(struct inode *inode, u64 bytes);
2082void btrfs_free_reserved_data_space(struct inode *inode, u64 bytes); 2082void btrfs_free_reserved_data_space(struct inode *inode, u64 bytes);
2083int btrfs_trans_reserve_metadata(struct btrfs_trans_handle *trans, 2083int btrfs_trans_reserve_metadata(struct btrfs_trans_handle *trans,
2084 struct btrfs_root *root, 2084 struct btrfs_root *root,
2085 int num_items, int *retries); 2085 int num_items);
2086void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans, 2086void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans,
2087 struct btrfs_root *root); 2087 struct btrfs_root *root);
2088int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans, 2088int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
@@ -2103,7 +2103,7 @@ void btrfs_add_durable_block_rsv(struct btrfs_fs_info *fs_info,
2103int btrfs_block_rsv_add(struct btrfs_trans_handle *trans, 2103int btrfs_block_rsv_add(struct btrfs_trans_handle *trans,
2104 struct btrfs_root *root, 2104 struct btrfs_root *root,
2105 struct btrfs_block_rsv *block_rsv, 2105 struct btrfs_block_rsv *block_rsv,
2106 u64 num_bytes, int *retries); 2106 u64 num_bytes);
2107int btrfs_block_rsv_check(struct btrfs_trans_handle *trans, 2107int btrfs_block_rsv_check(struct btrfs_trans_handle *trans,
2108 struct btrfs_root *root, 2108 struct btrfs_root *root,
2109 struct btrfs_block_rsv *block_rsv, 2109 struct btrfs_block_rsv *block_rsv,