aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.h
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2014-09-18 11:20:02 -0400
committerChris Mason <clm@fb.com>2014-09-22 20:13:21 -0400
commit47ab2a6c689913db23ccae38349714edf8365e0a (patch)
tree5d1001d192e6ccd0159d59e31d705b38e17c09ef /fs/btrfs/volumes.h
parent8407f553268a4611f2542ed90677f0edfaa2c9c4 (diff)
Btrfs: remove empty block groups automatically
One problem that has plagued us is that a user will use up all of his space with data, remove a bunch of that data, and then try to create a bunch of small files and run out of space. This happens because all the chunks were allocated for data since the metadata requirements were so low. But now there's a bunch of empty data block groups and not enough metadata space to do anything. This patch solves this problem by automatically deleting empty block groups. If we notice the used count go down to 0 when deleting or on mount notice that a block group has a used count of 0 then we will queue it to be deleted. When the cleaner thread runs we will double check to make sure the block group is still empty and then we will delete it. This patch has the side effect of no longer having a bunch of BUG_ON()'s in the chunk delete code, which will be helpful for both this and relocate. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r--fs/btrfs/volumes.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 91998bc0b4c4..08980fa23039 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -463,6 +463,8 @@ unsigned long btrfs_full_stripe_len(struct btrfs_root *root,
463int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans, 463int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans,
464 struct btrfs_root *extent_root, 464 struct btrfs_root *extent_root,
465 u64 chunk_offset, u64 chunk_size); 465 u64 chunk_offset, u64 chunk_size);
466int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
467 struct btrfs_root *root, u64 chunk_offset);
466 468
467static inline int btrfs_dev_stats_dirty(struct btrfs_device *dev) 469static inline int btrfs_dev_stats_dirty(struct btrfs_device *dev)
468{ 470{