linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [RFC] Btrfs-progs: restriper interface
@ 2011-08-23 20:08 Ilya Dryomov
  2011-08-23 20:08 ` [PATCH] Btrfs-progs: add restriper commands Ilya Dryomov
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Dryomov @ 2011-08-23 20:08 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Chris Mason, Hugo Mills, idryomov

Hello,

This is a RFC, man pages are absent and just one big commit.  Here are
some specs for the new interface:

./btrfs fi restripe start [-d[filters]] [-m[filters]] [-s[filters]]
    [-vf] <path>

where 'filters' is comma-separated list of filters (comma == AND):

o profiles={profiles mask} - profiles filter

    profiles mask is '|'-separated list ('|' == OR) of profiles

o usage={percentage} - usage filter

o devid={devid} - devid filter

o drange={start..end} - devid subset filter, it's tied to devid filter:
we say balance out range [start..end) on a particular devid.  These are
also acceptable:

    drange=start.. - [start..end of device)
    drange=..end - [start of device..end)

o vrange={start..end} - virtual address space subset filter.  Same forms
as above are acceptable.

Convert (profile changing) is specified as follows:

o convert={profile},[soft]

    soft parameter makes sense only for convert option.  It turns on
"soft" mode for profile changing, see the kernel patch.

Each chunk type can be either balanced or converted to some new profile.
By specifying some filters w/o convert option we balance chunks that
passed all filters (remember, comma == AND).  If only convert parameter
is specified we convert all chunks of that type.  If both convert and
filters are specified restriper filters out chunks according to the
given filters and then converts everything that passed through all the
filters.

Some examples:

o ./btrfs fi restripe start <path>

will balance everything (what ./btrfs fi balance <path> would do)

o ./btrfs fi restripe start -d

will balance only data chunks

o ./btrfs fi restripe start -d -s

will balance all data and system chunks, won't touch meta chunks

o ./btrfs fi restripe start -dprofiles=raid1\|raid0

\ - shell escape, will balance only data chunks that have raid1 or
raid0 profile

o ./btrfs fi restripe start -mprofiles=raid1\|raid0,devid=2

will balance meta chunks that have raid1 or raid0 profile and at least
one stripe located on device with devid 2

o ./btrfs fi restripe start -s -musage=80,profiles=dup

will balance all system chunks and dup'ed metadata chunks which are less
than 80% full

o ./btrfs fi restripe start -s -mprofiles=dup,convert=raid1

will *balance* all system chunks and *convert* dup meta chunks to raid1

o ./btrfs fi restripe start -dvrange=100..803337011,convert=raid0,soft

will soft-convert chunks in that virtual address space range to raid0

Note that you can't put a space between e.g. -m and a list of filters
because of the way getopt(3) works.  There are also long options, if you
prefer (--data, --metadata, --system), e.g:

    ./btrfs fi restripe start --data=profiles=raid1\|raid0

All permutations are possible, restriper doesn't care about the order in
which options are given, all settings are per-chunk-type, and what you
do with one chunk type is completely independent of what you do with the
other.

The -f (--force) flag has to be given if you want to "downgrade" the
profile.  By downgrading I mean reducing the number of copies, so
raid10->raid1 can be done w/o this flag, while raid1->raid0 cannot.

And the management commands:

./btrfs fi restripe cancel <path>
./btrfs fi restripe pause <path>
./btrfs fi restripe resume <path>

Any suggestions on the interface are welcome.  Patch is on top of tmp
branch of cmason's repo, available at:

git://github.com/idryomov/btrfs-progs.git restriper-rfc

Thanks,

		Ilya


Ilya Dryomov (1):
  Btrfs-progs: add restriper commands

 btrfs.c      |   25 +++-
 btrfs_cmds.c |  508 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 btrfs_cmds.h |    5 +
 ctree.h      |    9 +
 ioctl.h      |   44 +++++
 print-tree.c |    3 +
 volumes.h    |   42 +++++
 7 files changed, 632 insertions(+), 4 deletions(-)

-- 
1.7.5.4


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

end of thread, other threads:[~2011-08-23 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-23 20:08 [PATCH] [RFC] Btrfs-progs: restriper interface Ilya Dryomov
2011-08-23 20:08 ` [PATCH] Btrfs-progs: add restriper commands Ilya Dryomov

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