aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-05-29 14:54:47 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-06-14 11:30:06 -0400
commitd52be818e618bd252601b340ca6df760d77410e8 (patch)
tree7d1fc410b90a96487cb3a949891fe2f6a5e96f87 /fs/btrfs/ctree.h
parentc6adc9cc082e3cffda153999c9b9f8a8baaaaf45 (diff)
Btrfs: simplify unlink reservations
Dave pointed out a problem where if you filled up a file system as much as possible you couldn't remove any files. The whole unlink reservation thing is convoluted because it tries to guess if it's going to add space to unlink something or not, and has all these odd uncommented cases where it simply does not try. So to fix this I've added a way to conditionally steal from the global reserve if we can't make our normal reservation. If we have more than half the space in the global reserve free we will go ahead and steal from the global reserve. With this patch Dave's reproducer now works and I can rm all the files on the file system. Thanks, Reported-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index fd62aa856d1b..a07b8c0a260d 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1495,7 +1495,6 @@ struct btrfs_fs_info {
1495 int do_barriers; 1495 int do_barriers;
1496 int closing; 1496 int closing;
1497 int log_root_recovering; 1497 int log_root_recovering;
1498 int enospc_unlink;
1499 1498
1500 u64 total_pinned; 1499 u64 total_pinned;
1501 1500
@@ -3183,6 +3182,9 @@ int btrfs_block_rsv_refill(struct btrfs_root *root,
3183int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv, 3182int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv,
3184 struct btrfs_block_rsv *dst_rsv, 3183 struct btrfs_block_rsv *dst_rsv,
3185 u64 num_bytes); 3184 u64 num_bytes);
3185int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info,
3186 struct btrfs_block_rsv *dest, u64 num_bytes,
3187 int min_factor);
3186void btrfs_block_rsv_release(struct btrfs_root *root, 3188void btrfs_block_rsv_release(struct btrfs_root *root,
3187 struct btrfs_block_rsv *block_rsv, 3189 struct btrfs_block_rsv *block_rsv,
3188 u64 num_bytes); 3190 u64 num_bytes);