linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs-progs: restriper interface
@ 2012-01-06 14:37 Ilya Dryomov
  2012-01-06 14:38 ` [PATCH] Btrfs-progs: add restriper commands Ilya Dryomov
  2012-01-07 12:48 ` [PATCH] Btrfs-progs: restriper interface Goffredo Baroncelli
  0 siblings, 2 replies; 9+ messages in thread
From: Ilya Dryomov @ 2012-01-06 14:37 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Chris Mason, idryomov

Hello,

This is an update of userspace restriper interface.  The main change is
that restriper commands have been moved under balance prefix.  So now we
have:

btrfs fi balance start
btrfs fi balance pause
btrfs fi balance cancel
btrfs fi balance resume
btrfs fi balance status

This breaks btrfs-progs backwards compatibility: to get the old
balancing behaviour you have to call 'btrfs fi balance start' instead of
'btrfs fi balance'.  This is caused by stupidity of the core sub-command
matcher.  There are also some other problems with that parser and I'll
fix them all in one commit shortly.  After that the "start" will be
optional:

btrfs fi balance [options]
btrfs fi balance start [options]

Apart from some minor error handling fixes went in.

Here are some specs:

./btrfs fi balance 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.

By default system chunks are relocated along with meta chunks with the
same exact options.  To operate explicitly on system chunks -f (--force)
flag has to be specified.

Examples (somewhat contrived, but they demonstrate the flexibility of
the interface):

o ./btrfs fi balance start <path>

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

o ./btrfs fi balance start -d

will balance only data chunks

o ./btrfs fi balance start -d -m

will balance everything (because -m by default applies to system chunks
too, see above)

o ./btrfs fi balance start -d -s -f

will balance all data and system chunks, won't touch meta chunks (note
that the force is used to operate explicitly on system chunks)

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

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

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

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

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

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

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

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

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

will soft-convert data 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 balance 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 force flag also 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 balance cancel <path>
./btrfs fi balance pause <path>
./btrfs fi balance resume <path>

./btrfs fi balance status [-v] <path>

Patch is on top of master branch of btrfs-progs repo, available at:

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

Thanks,

		Ilya


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

 btrfs.c      |   27 +++-
 btrfs_cmds.c |  577 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 btrfs_cmds.h |    8 +-
 ctree.h      |   23 ++-
 ioctl.h      |   53 ++++++
 print-tree.c |    6 +
 volumes.h    |   30 +++
 7 files changed, 687 insertions(+), 37 deletions(-)

-- 
1.7.6.3


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [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; 9+ 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] 9+ messages in thread

end of thread, other threads:[~2012-01-07 17:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-06 14:37 [PATCH] Btrfs-progs: restriper interface Ilya Dryomov
2012-01-06 14:38 ` [PATCH] Btrfs-progs: add restriper commands Ilya Dryomov
2012-01-07 12:48 ` [PATCH] Btrfs-progs: restriper interface Goffredo Baroncelli
2012-01-07 14:25   ` Ilya Dryomov
2012-01-07 14:32     ` Roman Mamedov
2012-01-07 15:14       ` Ilya Dryomov
2012-01-07 16:49         ` Goffredo Baroncelli
2012-01-07 17:21           ` Goffredo Baroncelli
  -- strict thread matches above, loose matches on Subject: below --
2011-08-23 20:08 [PATCH] [RFC] " 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).