From patchwork Tue Feb 12 16:28:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 2129391 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id B26BDDF23E for ; Tue, 12 Feb 2013 16:29:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932313Ab3BLQ3H (ORCPT ); Tue, 12 Feb 2013 11:29:07 -0500 Received: from mail-ee0-f43.google.com ([74.125.83.43]:42006 "EHLO mail-ee0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932294Ab3BLQ3F (ORCPT ); Tue, 12 Feb 2013 11:29:05 -0500 Received: by mail-ee0-f43.google.com with SMTP id c50so157444eek.16 for ; Tue, 12 Feb 2013 08:29:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=wLAmuLyukaE0GLcfWMGShuRCY1lW79AaiK88m6ILCCE=; b=bM23wZlhdNWNCDJtb0SSN7+RaqqJc5oWR8xPYdP7V5ZLLNqhNldFs77iTiZteYggV7 pqieABdNWqQU3Y+eI/m+VLucdbyoaWRKa6nqTH9TdlpuCJ7Ebl/7qWSks+CbVbJK7BIG 02sCoENokpHONIWehfki9Zqy/th6Q+k4xfI9suzUs2S81tt+ZHuGphFWREvH3cI+sX9y mIX7Xlxpf2+QIjr0Zg4xQ/YEGjSePPgzi5IG0TPu78i58c6Jec5+o3uO+gDATymY6erz 57Dt3rfHhcPO3P08ftYgzfn6kNicnkToGzH2fzOQpUdMFI8Aip4yUQHZM0w/KtLM9CcU YDeA== X-Received: by 10.14.202.197 with SMTP id d45mr65444428eeo.1.1360686543663; Tue, 12 Feb 2013 08:29:03 -0800 (PST) Received: from localhost ([109.110.82.161]) by mx.google.com with ESMTPS id m46sm4551050eeo.16.2013.02.12.08.29.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 12 Feb 2013 08:29:02 -0800 (PST) From: Ilya Dryomov To: linux-btrfs@vger.kernel.org Cc: Chris Mason , idryomov@gmail.com Subject: [PATCH] Btrfs: allow for selecting only completely empty chunks Date: Tue, 12 Feb 2013 18:28:59 +0200 Message-Id: <1360686539-22720-1-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 1.7.9.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Enhance balance usage filter by making it possible to balance out only completely empty chunks. Today, usage filter properly acts on values from 1 to 99 inclusive, usage=100 selects all chunks, and usage=0 selects no chunks. This commit changes the usage=0 case: the new meaning is to restripe only completely empty chunks and nothing else. Suggested-by: David Sterba Signed-off-by: Ilya Dryomov --- fs/btrfs/volumes.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 15f6efd..7e41619 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2615,7 +2615,7 @@ static int chunk_usage_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset, chunk_used = btrfs_block_group_used(&cache->item); if (bargs->usage == 0) - user_thresh = 0; + user_thresh = 1; else if (bargs->usage > 100) user_thresh = cache->key.offset; else