Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: accept zero for balance usage filter
@ 2013-02-11 12:33 David Sterba
  2013-02-12 16:36 ` Ilya Dryomov
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2013-02-11 12:33 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba, Ilya Dryomov

The condition can be relaxed to accept also 0 which will delete
unoccupied chunks and does not need space for the actual data
relocation. Until there is an automatic empty chunk reclaim, we
can use this as a last resort option under enospc.

CC: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
---

Also needs progs update, but is not required for the kernel side.

 fs/btrfs/volumes.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5cbb7f4..fb871d0 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2623,7 +2623,10 @@ static int chunk_usage_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset,
 		user_thresh = div_factor_fine(cache->key.offset,
 					      bargs->usage);
 
-	if (chunk_used < user_thresh)
+	pr_debug("btrfs: chunk_used %llu, user_thresh %llu\n",
+			(unsigned long long)chunk_used,
+			(unsigned long long)user_thresh);
+	if (chunk_used <= user_thresh)
 		ret = 0;
 
 	btrfs_put_block_group(cache);
-- 
1.7.9


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-12 22:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-11 12:33 [PATCH] btrfs: accept zero for balance usage filter David Sterba
2013-02-12 16:36 ` Ilya Dryomov
2013-02-12 22:12   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox