From patchwork Tue Jul 19 16:11:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 989152 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6JGBksD006655 for ; Tue, 19 Jul 2011 16:11:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752159Ab1GSQLm (ORCPT ); Tue, 19 Jul 2011 12:11:42 -0400 Received: from smtp204.alice.it ([82.57.200.100]:47689 "EHLO smtp204.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464Ab1GSQLl (ORCPT ); Tue, 19 Jul 2011 12:11:41 -0400 Received: from venice.bhome (82.59.204.123) by smtp204.alice.it (8.5.124.08) id 4E259C1B0001E443 for linux-btrfs@vger.kernel.org; Tue, 19 Jul 2011 18:11:40 +0200 Subject: [PATCH 1/6] Add info for the commands. To: linux-btrfs From: Goffredo Baroncelli Date: Tue, 19 Jul 2011 18:11:59 +0200 Message-ID: <20110719161159.3210.80622.stgit@venice.bhome> In-Reply-To: <20110719161049.3210.54794.stgit@venice.bhome> References: <20110719161049.3210.54794.stgit@venice.bhome> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 19 Jul 2011 16:11:46 +0000 (UTC) From: Goffredo Baroncelli Add info for every btrfs sub-commands in the sources. --- btrfs_cmds.c | 276 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scrub.c | 79 +++++++++++++++++ 2 files changed, 355 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/btrfs_cmds.c b/btrfs_cmds.c index 0612f34..3cdebea 100644 --- a/btrfs_cmds.c +++ b/btrfs_cmds.c @@ -156,6 +156,42 @@ static int parse_compress_type(char *s) }; } + +/**** man: btrfs filesystem defragment + * + * \Bbtrfs\b \Bfilesystem defragment\b -c[zlib|lzo] [-l \Ilen\i] [-s \Istart\i] [-t \Isize\i] -[vf] <\Ifile\i>|<\Idir\i> [<\Ifile\i>|<\Idir\i>...] + * + * Defragment a file or a directory. + * + * Defragment file data and/or directory metadata. To defragment all files in a + * directory you have to specify each one on its own or use your shell + * wildcards. + * + * The start position and the number of bytes to deframention can be specified + * by \Istart\i and \Ilen\i. Any extent bigger than \Ithresh\i will be + * considered already defragged. Use 0 to take the kernel default, and use 1 + * to say eveery single extent must be rewritten. You can also turn on + * compression in defragment operations. + * + * \B-v\b be verbose + * + * \B-c\b compress file contents while defragmenting + * + * \B-f\b flush filesystem after defragmenting + * + * \B-s start\b defragment only from byte \Istart\i onward + * + * \B-l len\b defragment only up to \Ilen\i bytes + * + * \B-t size\b defragment only files at least \Isize\i bytes big + * + * NOTE: defragmenting with kernels up to 2.6.37 will unlink COW-ed copies of + * data, don't use it if you use snapshots, have de-duplicated your data or + * made copies with + * + * \Bcp --reflink\b. + ****/ + int do_defrag(int ac, char **av) { int fd; @@ -268,6 +304,16 @@ int do_defrag(int ac, char **av) return errors + 20; } + +/**** man: btrfs subvolume find-new + * + * \Bbtrfs\b \Bsubvolume find-new\b\I \i + * + * List the recently modified files in a filesystem. + * + * List the recently modified files in a subvolume, after \I\i ID. + ****/ + int do_find_newer(int argc, char **argv) { int fd; @@ -299,6 +345,25 @@ int do_find_newer(int argc, char **argv) return 0; } + +/**** man: btrfs subvolume list + * + * \Bbtrfs\b \Bsubvolume list\b\I [-p] \i + * + * List the snapshot/subvolume of a filesystem. + * + * List the subvolumes present in the filesystem \I\i. For every + * subvolume the following information is shown by default. + * ID top level path + * where path is the relative path of the subvolume to the \Itop level\i + * subvolume. + * The subvolume's ID may be used by the \Bsubvolume set-default\b command, or + * at mount time via the \Isubvol=\i option. + * If \I-p\i is given, then \Iparent \i is added to the output between ID + * and top level. The parent's ID may be used at mount time via the + * \Isubvolrootid=\i option. + ****/ + int do_subvol_list(int argc, char **argv) { int fd; @@ -346,6 +411,20 @@ int do_subvol_list(int argc, char **argv) return 0; } + +/**** man: btrfs subvolume snapshot + * + * \Bbtrfs\b \Bsubvolume snapshot\b\I [-r] [/]\i + * + * Create a writable/readonly snapshot of the subvolume with + * the name in the directory. + * + * Create a writable/readonly snapshot of the subvolume \I\i with the + * name \I\i in the \I\i directory. If \I\i is not a + * subvolume, \Bbtrfs\b returns an error. If \I-r\i is given, the snapshot + * will be readonly. + ****/ + int do_clone(int argc, char **argv) { char *subvol, *dst; @@ -463,6 +542,17 @@ int do_clone(int argc, char **argv) } + +/**** man: btrfs subvolume delete + * + * \Bbtrfs\b \Bsubvolume delete\b\I \i + * + * Delete the subvolume . + * + * Delete the subvolume \I\i. If \I\i is not a + * subvolume, \Bbtrfs\b returns an error. + ****/ + int do_delete_subvolume(int argc, char **argv) { int res, fd, len, e; @@ -525,6 +615,18 @@ int do_delete_subvolume(int argc, char **argv) } + +/**** man: btrfs subvolume create + * + * \Bbtrfs\b \Bsubvolume create\b\I [/]\i + * + * Create a subvolume in (or the current directory if + * not passed). + * + * Create a subvolume in \I\i (or in the current directory if + * \I\i is omitted). + ****/ + int do_create_subvol(int argc, char **argv) { int res, fddst, len, e; @@ -581,6 +683,16 @@ int do_create_subvol(int argc, char **argv) } + +/**** man: btrfs filesystem sync + * + * \Bbtrfs\b \Bfilesystem sync\b\I \i + * + * Force a sync on the filesystem . + * + * Force a sync for the filesystem identified by \I\i. + ****/ + int do_fssync(int argc, char **argv) { int fd, res, e; @@ -605,6 +717,21 @@ int do_fssync(int argc, char **argv) return 0; } + +/**** man: btrfs device scan + * + * \Bbtrfs\b \Bdevice scan\b \I[--all-devices| [...]\i + * + * Scan all device for or the passed device for a btrfs + * filesystem. + * + * If one or more devices are passed, these are scanned for a btrfs filesystem. + * If no devices are passed, \Bbtrfs\b scans all the block devices listed + * in the /proc/partitions file. + * Finally, if \B--all-devices\b is passed, all the devices under /dev are + * scanned. + ****/ + int do_scan(int argc, char **argv) { int i, fd, e; @@ -672,6 +799,32 @@ int do_scan(int argc, char **argv) } + +/**** man: btrfs filesystem resize + * + * \Bbtrfs\b \Bfilesystem resize\b\I [+/\-][gkm]|max \i + * + * Resize the file system. If 'max' is passed, the filesystem + * will occupe all available space on the device. + * + * Resize a filesystem identified by \I\i. + * The \I\i parameter specifies the new size of the filesystem. + * If the prefix \I+\i or \I\-\i is present the size is increased or decreased + * by the quantity \I\i. + * If no units are specified, the unit of the \I\i parameter defaults to + * bytes. Optionally, the size parameter may be suffixed by one of the following + * the units designators: 'K', 'M', or 'G', kilobytes, megabytes, or gigabytes, + * respectively. + * + * If 'max' is passed, the filesystem will occupy all available space on the + * volume(s). + * + * The \Bresize\b command \Bdoes not\b manipulate the size of underlying + * partition. If you wish to enlarge/reduce a filesystem, you must make sure + * you can expand the partition before enlarging the filesystem and shrink the + * partition after reducing the size of the filesystem. + ****/ + int do_resize(int argc, char **argv) { @@ -762,6 +915,20 @@ static void print_one_uuid(struct btrfs_fs_devices *fs_devices) printf("\n"); } + +/**** man: btrfs filesystem show + * + * \Bbtrfs\b \Bfilesystem show\b [--all-devices||