From patchwork Sun Jun 26 20:36:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Mills X-Patchwork-Id: 919642 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5QKcqTG032573 for ; Sun, 26 Jun 2011 20:38:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754506Ab1FZUhD (ORCPT ); Sun, 26 Jun 2011 16:37:03 -0400 Received: from frost.carfax.org.uk ([212.13.194.111]:52652 "EHLO frost.carfax.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755148Ab1FZUg6 (ORCPT ); Sun, 26 Jun 2011 16:36:58 -0400 Received: from ruthven.carfax.org.uk ([10.0.0.10]) by frost.carfax.org.uk with esmtp (Exim 4.72) (envelope-from ) id 1Qaw4e-0001Pi-Um; Sun, 26 Jun 2011 20:36:57 +0000 Received: from [10.0.0.10] (helo=ruthven.carfax.org.uk) by ruthven.carfax.org.uk with esmtp (Exim 4.72) (envelope-from ) id 1Qaw4e-0004if-Lm; Sun, 26 Jun 2011 21:36:56 +0100 From: Hugo Mills To: Btrfs mailing list , Chris Mason , David Sterba Subject: [PATCH v8 6/8] btrfs: Balance filter for virtual address ranges Date: Sun, 26 Jun 2011 21:36:53 +0100 Message-Id: <1309120615-18104-7-git-send-email-hugo@carfax.org.uk> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1309120615-18104-1-git-send-email-hugo@carfax.org.uk> References: <1309120615-18104-1-git-send-email-hugo@carfax.org.uk> X-frost.carfax.org.uk-Spam-Score: -0.0 (/) X-frost.carfax.org.uk-Spam-Report: Spam detection software, running on the system "spamd3.lon.bitfolk.com", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Allow the balancing of chunks where some part of the chunk lies within the virtual (i.e. btrfs-internal) address range passed. Signed-off-by: Hugo Mills --- fs/btrfs/ioctl.h | 9 +++++++-- fs/btrfs/volumes.c | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 DOS_RCVD_IP_TWICE_B Received from the same IP twice in a row (only one external relay) -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 26 Jun 2011 20:38:52 +0000 (UTC) Allow the balancing of chunks where some part of the chunk lies within the virtual (i.e. btrfs-internal) address range passed. Signed-off-by: Hugo Mills --- fs/btrfs/ioctl.h | 9 +++++++-- fs/btrfs/volumes.c | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h index 21b0e6a..ba09b19 100644 --- a/fs/btrfs/ioctl.h +++ b/fs/btrfs/ioctl.h @@ -203,7 +203,8 @@ struct btrfs_ioctl_balance_progress { #define BTRFS_BALANCE_FILTER_CHUNK_TYPE (1 << 1) #define BTRFS_BALANCE_FILTER_DEVID (1 << 2) -#define BTRFS_BALANCE_FILTER_MASK ((1 << 3) - 1) /* Logical or of all filter +#define BTRFS_BALANCE_FILTER_VIRTUAL_ADDRESS_RANGE (1 << 3) +#define BTRFS_BALANCE_FILTER_MASK ((1 << 4) - 1) /* Logical or of all filter * flags -- effectively versions * the filtered balance ioctl */ @@ -223,7 +224,11 @@ struct btrfs_ioctl_balance_start { /* For FILTER_DEVID */ __u64 devid; - __u64 spare[506]; /* Make up the size of the structure to 4088 + /* For FILTER_VIRTUAL_ADDRESS_RANGE */ + __u64 vrange_start; + __u64 vrange_end; + + __u64 spare[504]; /* Make up the size of the structure to 4088 * bytes for future expansion */ }; diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 36d9018..828aa34 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2054,6 +2054,12 @@ int balance_chunk_filter(struct btrfs_ioctl_balance_start *filter, if (!res) return 0; } + if (filter->flags & BTRFS_BALANCE_FILTER_VIRTUAL_ADDRESS_RANGE) { + u64 start = key->offset; + u64 end = start + btrfs_chunk_length(eb, chunk); + if (filter->vrange_start >= end || start >= filter->vrange_end) + return 0; + } return 1; }