From: Hugo Mills <hugo@carfax.org.uk>
To: Btrfs mailing list <linux-btrfs@vger.kernel.org>,
Chris Mason <chris.mason@oracle.com>,
David Sterba <dave@jikos.cz>
Subject: [PATCH v8 6/8] btrfs: Balance filter for virtual address ranges
Date: Sun, 26 Jun 2011 21:36:53 +0100 [thread overview]
Message-ID: <1309120615-18104-7-git-send-email-hugo@carfax.org.uk> (raw)
In-Reply-To: <1309120615-18104-1-git-send-email-hugo@carfax.org.uk>
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 <hugo@carfax.org.uk>
---
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;
}
--
1.7.2.5
next prev parent reply other threads:[~2011-06-26 20:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-26 20:36 [PATCH v8 0/8] Balance management patches, v8 Hugo Mills
2011-06-26 20:36 ` [PATCH v8 1/8] btrfs: Balance progress monitoring Hugo Mills
2011-06-26 20:36 ` [PATCH v8 2/8] btrfs: Cancel filesystem balance Hugo Mills
2011-06-29 6:00 ` Li Zefan
2011-06-29 10:43 ` David Sterba
2011-06-26 20:36 ` [PATCH v8 3/8] btrfs: Factor out enumeration of chunks to a separate function Hugo Mills
2011-06-26 20:36 ` [PATCH v8 4/8] btrfs: Implement filtered balance ioctl Hugo Mills
2011-06-26 20:36 ` [PATCH v8 5/8] btrfs: Balance filter for device ID Hugo Mills
2011-06-26 20:36 ` Hugo Mills [this message]
2011-06-26 20:36 ` [PATCH v8 7/8] btrfs: Replication-type information Hugo Mills
2011-06-28 16:32 ` David Sterba
2011-06-28 19:26 ` Hugo Mills
2011-06-28 20:41 ` Ilya Dryomov
2011-06-26 20:36 ` [PATCH v8 8/8] btrfs: Balance filter for physical device address Hugo Mills
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1309120615-18104-7-git-send-email-hugo@carfax.org.uk \
--to=hugo@carfax.org.uk \
--cc=chris.mason@oracle.com \
--cc=dave@jikos.cz \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).