Upstream-Status: Inappropriate [Backport]
From 0a63a11c3d3bbb7e061daad28435b5eef91a947d Mon Sep 17 00:00:00 2001
From: Hubert Kario <kario@wit.edu.pl>
Date: Sun, 23 Jan 2011 15:31:07 +0000
Subject: [PATCH 04/15] update man page to new defragment command interface

Update

        btrfs filesystem defragment

command explanation. Add explanation of advanced parameters and notes
about general usage.

Add few notes about the

        btrfs <command> --help

usage, fix related grammar.

Signed-off-by: Hubert Kario <kario@wit.edu.pl>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
---
 man/btrfs.8.in |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/man/btrfs.8.in b/man/btrfs.8.in
index 26ef982..cba2de1 100644
--- a/man/btrfs.8.in
+++ b/man/btrfs.8.in
@@ -15,7 +15,7 @@ btrfs \- control a btrfs filesystem
 .PP
 \fBbtrfs\fP \fBsubvolume set-default\fP\fI <id> <path>\fP
 .PP
-\fBbtrfs\fP \fBfilesystem defrag\fP\fI <file>|<dir> [<file>|<dir>...]\fP
+\fBbtrfs\fP \fBfilesystem defragment\fP\fI [-vcf] [-s start] [-l len] [-t size] <file>|<dir> [<file>|<dir>...]\fP
 .PP
 \fBbtrfs\fP \fBfilesystem sync\fP\fI <path> \fP
 .PP
@@ -34,6 +34,8 @@ btrfs \- control a btrfs filesystem
 .PP
 \fBbtrfs\fP \fBhelp|\-\-help|\-h \fP\fI\fP
 .PP
+\fBbtrfs\fP \fB<command> \-\-help \fP\fI\fP
+.PP
 .SH DESCRIPTION
 .B btrfs
 is used to control the filesystem and the files and directories stored. It is
@@ -60,12 +62,12 @@ returns an error.
 
 If a command is terminated by
 .I --help
-, the relevant help is showed. If the passed command matches more commands,
-the help of all the matched commands are showed. For example
+, the detailed help is showed. If the passed command matches more commands,
+detailed help of all the matched commands is showed. For example
 .I btrfs dev --help
 shows the help of all
 .I device*
-command.
+commands.
 
 .SH COMMANDS
 .TP
@@ -98,12 +100,29 @@ mount time via the \fIsubvol=\fR option.
 
 \fBsubvolume set-default\fR\fI <id> <path>\fR
 Set the subvolume of the filesystem \fI<path>\fR which is mounted as 
-\fIdefault\fR. The subvolume is identified by \fB<id>\fR, which 
+\fIdefault\fR. The subvolume is identified by \fI<id>\fR, which 
 is returned by the \fBsubvolume list\fR command.
 .TP
 
-\fBfilesystem defragment\fP\fI <file>|<dir> [<file>|<dir>...]\fR
-Defragment files and/or directories.
+\fBfilesystem defragment\fP\fI [-vcf] [-s start] [-l len] [-t size] <file>|<dir> [<file>|<dir>...]\fR
+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.
+
+\fB-v\fP be verbose
+
+\fB-c\fP compress file contents while defragmenting
+
+\fB-f\fP flush filesystem after defragmenting
+
+\fB-s start\fP defragment only from byte \fIstart\fR onward
+
+\fB-l len\fP defragment only up to \fIlen\fR bytes
+
+\fB-t size\fP defragment only files at least \fIsize\fR 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 
+\fBcp --reflink\fP.
 .TP
 
 \fBdevice scan\fR \fI[<device> [<device>..]]\fR
-- 
1.7.2.3

