diff mbox

btrfs: accept zero for balance usage filter

Message ID 1360586032-22973-1-git-send-email-dsterba@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

David Sterba Feb. 11, 2013, 12:33 p.m. UTC
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(-)

Comments

Ilya Dryomov Feb. 12, 2013, 4:36 p.m. UTC | #1
On Mon, Feb 11, 2013 at 01:33:52PM +0100, David Sterba wrote:
> 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>

Josef, please don't pull this one into btrfs-next, it's been deprecated
by "Btrfs: allow for selecting only completely empty chunks" from me.
David and I discussed this on IRC, he is OK with it.

Thanks,

		Ilya
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba Feb. 12, 2013, 10:12 p.m. UTC | #2
On Tue, Feb 12, 2013 at 06:36:17PM +0200, Ilya Dryomov wrote:
> Josef, please don't pull this one into btrfs-next, it's been deprecated
> by "Btrfs: allow for selecting only completely empty chunks" from me.
> David and I discussed this on IRC, he is OK with it.

Ack.

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);