From: Goffredo Baroncelli Subject: [RFC] Move all btrfs command to only one command Date: Thu, 21 Jan 2010 20:29:26 +0100 Message-ID: <201001212029.26681.kreijack@libero.it> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_WsKWLgT6ixYjt9w" Cc: David Nicol , taruishi.hiroak@jp.fujitsu.com To: linux-btrfs@vger.kernel.org Return-path: List-ID: --Boundary-00=_WsKWLgT6ixYjt9w Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi all this RFC is about unify all btrfs command (btrfsctl, btrfs-show, btrfs-tune.. ) in only one called "btrfs" (or whatever we want). Today "btrfsctl" needs a "bit" of care because * the help is basically wrong [1] * the return codes are incoherent [2] * the syntax of the command are very ugly (a lot of people complained about the subvolumes/snapshot creation, because they aren't very clear) [3] * the code is a mess (in the main there is a useless for(); there a lot of 'if' because sometime the last argument is the target of ioctl, sometime no..) [4] * The checks of the number of argument are incorrect [5] I think that is better to rewrite from scratch a new command instead of patching the old one. So we don't care about the backward compatibility. Other filesystem (hammer, tux3, zfs) have only one command for management purpose. Instead we have btrfsctl (which has a lot of different function) and btrfs-show, btrfs-tune, btrfs-volume which have few functions. There are patches which address [6] some of the previous issues, but these are not integrated (because the developers are busy on other issues). To me rewriting from scratch seems a fast path for solving these issues. I made a prototype (see attached file) in bash of what "btrfs" should be. The major different from btrfsctl are: - I talk about clone and not snapshot - If a sub-volume is required (for example for the cloning), the program check that the argument is a root of the subvolume and not a subdirectory - Creating a sub-volume requires only one argument Below some examples: $ btrfs Usage: btrfs clone|-c [/] Clone the subvolume with the name in the directory. btrfs delete|-d Delete the subvolume . btrfs create|-C [/] Create a subvolume in (or the current directory if not passed. btrfs defrag|-d | [|...] Defragment a file or a directory. btrfs fssync|-s Force a fs sync on the filesystem btrfs resize|-r [+/-][gkm]|max Resize the file system. If 'max' is passed, the filesystem will occupe all available space on the device. btrfs scan|-S [ [..] Scan all device for or the passed device for a btrfs filesystem. btrfs show|-l |