From mboxrd@z Thu Jan 1 00:00:00 1970 From: Goffredo Baroncelli Subject: Re: [RFC] btrfs: a new tool to manage a btrfs filesystem Date: Sat, 20 Feb 2010 11:48:38 +0100 Message-ID: <201002201148.39264.kreijack@libero.it> References: <201002192112.17752.kreijack@libero.it> <93cdabd21002191316r7f65a031veb943045dca82c14@mail.gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 Cc: linux-btrfs@vger.kernel.org To: Mike Fedyk Return-path: In-Reply-To: <93cdabd21002191316r7f65a031veb943045dca82c14@mail.gmail.com> List-ID: Hi Mike, Thanks, I implemented all your suggestion except the one related to the= resize=20 command. These patches doesn't address problems related to btrfs itself, and now= the=20 interface of the btrfs function is based on the filesystem and not on t= he=20 device. But I agree with you that today if a btrfs filesystem relies on more th= an one=20 device, is not clear how "shrink" the occupation of one specific device= =20 (remove the device, resize the partition and add the device again ?)=20 I hope to post the new patches (with the implementation of the resize i= octl=20 call) in this week end. BR Goffredo On Friday 19 February 2010, Mike Fedyk wrote: > On Fri, Feb 19, 2010 at 12:12 PM, Goffredo Baroncelli > wrote: > > Hi all, > > > > on the basis of the suggestion received, I update my btrfs tool. > > > > The main changes are: > > - removed the short form of the command (like '-C') > > - deployed the "multi level" command (i.e.: btrfs snapshot create) > > - split the source in three files. This because the new parses are = quite=20 big > > (about 295 lines; for example btrfsctl.c are only 239 lines). > > > > The "multi level" command parser is quite flexible. They accept the= full- > > length command (btrfs subvolume create) and a contract form (btrfs = subvol=20 cr). > > The commands may be arbitrary shortly (even 1 chars) but they have = to be=20 un- > > ambiguous. For example > > - btrfs s s -> OK (matches 'btrfs subvolume snapshot' o= nly) > > - btrfs dev s -> FAIL (matches both 'btrfs dev show' and > > 'btrfs dev scan') > > > > The parser highlights which part of the command are ambiguous. > > > > This is a RFC because there is no agreement about the name of the c= ommand. > > I am proposing the following structure: > > > > btrfs > > > > where are: > > - subvolume (valid action: create, delete, snapshot, list [not=20 implemented]) > > - filesystem (valid action: defrag, sync, resize [not implemented]) > > - device (valid action: add, delete, scan, show, balance) > > > > You can find the source at > > > > http://cassiopea.homelinux.net/git/btrfs-command.git > > > > (commit 3deec45d18879d60b4032dc1f8895d7b7e1211ec, remember to switc= h to=20 the > > "remotes/origin/multi-level-command" branch (I hate git!!!) > > > > > > BR > > G.Baroncelli > > ---- > > > > $ git diff remotes/origin/orig | diffstat > > Makefile | 6 > > btrfs.c | 73 ++++++ > > btrfs_cmds.c | 587=20 +++++++++++++++++++++++++++++++++++++++++++[...] > > btrfs_cmds.h | 30 ++ > > btrfs_cmds_parse.c | 296 +++++++++++++++++++++++++ > > man/Makefile | 5 > > man/btrfs.8.in | 148 ++++++++++++ > > 13 files changed, 1291 insertions(+), 2 deletions(-) > > > > ---- > > $ ./btrfs > > Usage: > > btrfs subvolume snapshot [/] > > Create a writeble snapshot of the subvolume = with > > the name in the directory. > > btrfs subvolume delete > > Delete the subvolume . > > btrfs subvolume create [/] > > Create a subvolume in (or the current directo= ry if > > not passed). > > btrfs filesystem defrag | [|...] > > Defragment a file or a directory. > > btrfs device scan [ [..] > > Scan all device for or the passed device for a btrfs > > filesystem. > > btrfs filesystem sync > > Force a fs sync on the filesystem > > btrfs filesystem resize [+/-][gkm]|max > > Resize the file system. If 'max' is passed, the file= system > > will occupe all available space on the device. > > btrfs device show [|