]> code.ossystems Code Review - openembedded-core.git/blob
3b44d20b9fbb83ba7aac5d2cc6f7201aec358391
[openembedded-core.git] /
1 Upstream-Status: Inappropriate [Backport]
2 From 6f81e1197015ab2dc41beec92c347919feb26967 Mon Sep 17 00:00:00 2001
3 From: Goffredo Baroncelli <kreijack@libero.it>
4 Date: Sun, 5 Dec 2010 17:47:45 +0000
5 Subject: [PATCH 09/15] Update/clean up btrfs help and man page V2
6
7 Hi all,
8
9 enclose you can find a patch which improves the help of the btrfs commands,
10  updates the INSTALL file  and  the btrfs (command) man page.
11
12 Regarding the help of the btrfs command:
13 - moved the "subvolume set-default" command in the "subvolume" commands group
14 - removed a wrong new line
15 - small tweak on the basis of Andreas suggestion
16
17 Regarding the btrfs command man page:
18 - renaming the command "device balance" in "filesystem balance" (thanks to
19 Andreas Phillipp to highlight that)
20 - adding the entry "subvolume find-new"
21 - document the switches of the command "filesystem defrag"
22 - document the <devid> facility of the command "filesystem resize"
23 - small tweak on the basis of Andreas suggestion
24
25 Regarding the INSTALL file, which was very old, I removed the reference of the
26 old btrfsctl utility and changed the examples using the btrfs command.
27 I removed the old (and now wrong) statement about the inability to delete a
28 subvolume/snapshot
29
30 Chris, you can pull the patch from the branch "help_cleanup" of the following
31 repository.
32
33 http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git
34
35 (or you can browse the changes at
36 http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git/?p=btrfs-
37 progs-unstable-all.git;a=summary)
38
39 The patch is very simple: only updates the man page, the INSTALL file and
40  moves/updates some lines in the help of btrfs command. Comments are welcome.
41
42 Regards
43 G.Baroncelli
44
45  INSTALL        |   29 ++++++++++++++++++++---------
46  btrfs.c        |   24 ++++++++++++------------
47  man/btrfs.8.in |   45 +++++++++++++++++++++++++--------------------
48  3 files changed, 57 insertions(+), 41 deletions(-)
49
50  all the block devices.
51  .TP
52 @@ -138,21 +143,21 @@ can expand the partition before enlarging the filesystem
53 and shrink the
54  partition after reducing the size of the filesystem.
55  .TP
56
57 -\fBfilesystem show\fR [<uuid>|<label>]\fR
58 -Show the btrfs filesystem with some additional info. If no UUID or label is
59 -passed, \fBbtrfs\fR show info of all the btrfs filesystem.
60 +\fBfilesystem show\fR [<device>|<uuid>|<label>]\fR
61 +Show the btrfs filesystem with some additional info. If no argument is
62 +passed, \fBbtrfs\fR shows info of all the btrfs filesystems.
63  .TP
64
65 -\fBdevice balance\fR \fI<path>\fR
66 +\fBfilesystem balance\fR \fI<path>\fR
67  Balance the chunks of the filesystem identified by \fI<path>\fR
68  across the devices.
69  .TP
70
71 -\fBdevice add\fR\fI <dev> [<dev>..] <path>\fR
72 +\fBdevice add\fR\fI <device> [<device>...] <path>\fR
73  Add device(s) to the filesystem identified by \fI<path>\fR.
74  .TP
75
76 -\fBdevice delete\fR\fI <dev> [<dev>..] <path>\fR
77 +\fBdevice delete\fR\fI <device> [<device>...] <path>\fR
78  Remove device(s) from a filesystem identified by \fI<path>\fR.
79  .PP
80
81 Signed-off-by: Chris Mason <chris.mason@oracle.com>
82 ---
83  INSTALL        |   29 ++++++++++++++++++++---------
84  btrfs.c        |   24 ++++++++++++------------
85  man/btrfs.8.in |   29 +++++++++++++++++------------
86  3 files changed, 49 insertions(+), 33 deletions(-)
87
88 diff --git a/INSTALL b/INSTALL
89 index 16b45a5..3840148 100644
90 --- a/INSTALL
91 +++ b/INSTALL
92 @@ -22,23 +22,32 @@ in the e2fsprogs sources, and is usually available as libuuid or
93  e2fsprogs-devel from various distros.
94  
95  Building the utilities is just make ; make install.  The programs go
96 -into /usr/local/bin.  The commands available are:
97 +into /usr/local/bin.  The mains commands available are:
98  
99  mkfs.btrfs: create a filesystem
100  
101 -btrfsctl: control program to create snapshots and subvolumes:
102 -
103 +btrfs: control program to create snapshots and subvolumes:
104 +       # mount a btrfs filesystem
105         mount /dev/sda2 /mnt
106 -       btrfsctl -s new_subvol_name /mnt
107 -       btrfsctl -s snapshot_of_default /mnt/default
108 -       btrfsctl -s snapshot_of_new_subvol /mnt/new_subvol_name
109 -       btrfsctl -s snapshot_of_a_snapshot /mnt/snapshot_of_new_subvol
110 +
111 +       # create a subvolume
112 +       btrfs subvolume create /mnt/new_subvol_name
113 +
114 +       # snapshot of a subvolume
115 +       btrfs subvolume snapshot /mnt/default /mnt/snapshot_of_default 
116 +       btrfs subvolume snapshot /mnt/snapshot_of_default \
117 +               /mnt/snapshot_of_a_snapshot
118 +
119 +       # list of the subvolumes
120         ls /mnt
121         default snapshot_of_a_snapshot snapshot_of_new_subvol
122         new_subvol_name snapshot_of_default
123  
124 -       Snapshots and subvolumes cannot be deleted right now, but you can
125 -       rm -rf all the files and directories inside them.
126 +       # removal of a subvolume or a snapshot
127 +       btrfs subvolume delete /mn/snapshot_of_a_snapshot
128 +
129 +       # look a the btrfs man page for further information
130 +       man btrfs
131  
132  btrfsck: do a limited check of the FS extent trees.</li>
133  
134 @@ -46,3 +55,5 @@ debug-tree: print all of the FS metadata in text form.  Example:
135  
136         debug-tree /dev/sda2 >& big_output_file
137  
138 +
139 +
140 diff --git a/btrfs.c b/btrfs.c
141 index 1b4f403..62140ef 100644
142 --- a/btrfs.c
143 +++ b/btrfs.c
144 @@ -61,6 +61,11 @@ static struct Command commands[] = {
145         { do_subvol_list, 1, "subvolume list", "<path>\n"
146                 "List the snapshot/subvolume of a filesystem."
147         },
148 +       { do_set_default_subvol, 2,
149 +         "subvolume set-default", "<id> <path>\n"
150 +               "Set the subvolume of the filesystem <path> which will be mounted\n"
151 +               "as default."
152 +       },
153         { do_find_newer, 2, "subvolume find-new", "<path> <last_gen>\n"
154                 "List the recently modified files in a filesystem."
155         },
156 @@ -68,11 +73,6 @@ static struct Command commands[] = {
157           "filesystem defragment", "[-vf] [-c[zlib,lzo]] [-s start] [-l len] [-t size] <file>|<dir> [<file>|<dir>...]\n"
158                 "Defragment a file or a directory."
159         },
160 -       { do_set_default_subvol, 2,
161 -         "subvolume set-default", "<id> <path>\n"
162 -               "Set the subvolume of the filesystem <path> which will be mounted\n"
163 -               "as default."
164 -       },
165         { do_fssync, 1,
166           "filesystem sync", "<path>\n"
167                 "Force a sync on the filesystem <path>."
168 @@ -83,29 +83,29 @@ static struct Command commands[] = {
169                 "will occupe all available space on the device."
170         },
171         { do_show_filesystem, 999,
172 -         "filesystem show", "[<uuid>|<label>]\n"
173 -               "Show the info of a btrfs filesystem. If no <uuid> or <label>\n"
174 +         "filesystem show", "[<device>|<uuid>|<label>]\n"
175 +               "Show the info of a btrfs filesystem. If no argument\n"
176                 "is passed, info of all the btrfs filesystem are shown."
177         },
178         { do_df_filesystem, 1,
179           "filesystem df", "<path>\n"
180 -               "Show space usage information for a mount point\n."
181 +               "Show space usage information for a mount point."
182         },
183         { do_balance, 1,
184           "filesystem balance", "<path>\n"
185                 "Balance the chunks across the device."
186         },
187 -       { do_scan,
188 -         999, "device scan", "[<device> [<device>..]\n"
189 +       { do_scan, 999, 
190 +         "device scan", "[<device>...]\n"
191                 "Scan all device for or the passed device for a btrfs\n"
192                 "filesystem."
193         },
194         { do_add_volume, -2,
195 -         "device add", "<dev> [<dev>..] <path>\n"
196 +         "device add", "<device> [<device>...] <path>\n"
197                 "Add a device to a filesystem."
198         },
199         { do_remove_volume, -2,
200 -         "device delete", "<dev> [<dev>..] <path>\n"
201 +         "device delete", "<device> [<device>...] <path>\n"
202                 "Remove a device from a filesystem."
203         },
204         /* coming soon
205 diff --git a/man/btrfs.8.in b/man/btrfs.8.in
206 index 1ffed13..b9b8913 100644
207 --- a/man/btrfs.8.in
208 +++ b/man/btrfs.8.in
209 @@ -21,15 +21,19 @@ btrfs \- control a btrfs filesystem
210  .PP
211  \fBbtrfs\fP \fBfilesystem defrag\fP\fI [options] <file>|<dir> [<file>|<dir>...]\fP
212  .PP
213 -\fBbtrfs\fP \fBdevice scan\fP\fI [<device> [<device>..]]\fP
214 +\fBbtrfs\fP \fBsubvolume find-new\fP\fI <subvolume> <last_gen>\fP
215  .PP
216 -\fBbtrfs\fP \fBdevice show\fP\fI <dev>|<label> [<dev>|<label>...]\fP
217 +\fBbtrfs\fP \fBfilesystem balance\fP\fI <path> \fP
218  .PP
219 -\fBbtrfs\fP \fBdevice balance\fP\fI <path> \fP
220 +\fBbtrfs\fP \fBfilesystem defragment\fP\fI <file>|<dir> [<file>|<dir>...]\fP
221  .PP
222 -\fBbtrfs\fP \fBdevice add\fP\fI <dev> [<dev>..] <path> \fP
223 +\fBbtrfs\fP \fBdevice scan\fP\fI [<device>...]\fP
224  .PP
225 -\fBbtrfs\fP \fBdevice delete\fP\fI <dev> [<dev>..] <path> \fP]
226 +\fBbtrfs\fP \fBdevice show\fP\fI [<device>|<uuid>|<label>]\fP
227 +.PP
228 +\fBbtrfs\fP \fBdevice add\fP\fI <device> [<device>...] <path> \fP
229 +.PP
230 +\fBbtrfs\fP \fBdevice delete\fP\fI <device> [<device>...] <path> \fP]
231  .PP
232  \fBbtrfs\fP \fBhelp|\-\-help|\-h \fP\fI\fP
233  .PP
234 @@ -48,17 +52,16 @@ For example: it is possible to run
235  instead of
236  .I btrfs subvolume snapshot.
237  But
238 -.I btrfs dev s
239 +.I btrfs file s
240  is not allowed, because
241 -.I dev s
242 +.I file s
243  may be interpreted both as
244 -.I device show
245 +.I filesystem show
246  and as
247 -.I device scan.
248 +.I filesystem sync.
249  In this case
250  .I btrfs
251 -returns an error.
252 -
253 +returnsfilesystem sync
254  If a command is terminated by
255  .I --help
256  , the detailed help is showed. If the passed command matches more commands,
257 @@ -125,9 +128,11 @@ The start position and the number of bytes to deframention can be specified by \
258  NOTE: defragmenting with kernels up to 2.6.37 will unlink COW-ed copies of data, don't 
259  use it if you use snapshots, have de-duplicated your data or made copies with 
260  \fBcp --reflink\fP.
261 +\fBsubvolume find-new\fR\fI <subvolume> <last_gen>\fR
262 +List the recently modified files in a subvolume, after \fI<last_gen>\fR ID.
263  .TP
264  
265 -\fBdevice scan\fR \fI[<device> [<device>..]]\fR
266 +\fBdevice scan\fR \fI[<device>...]\fR
267  Scan devices for a btrfs filesystem. If no devices are passed, \fBbtrfs\fR scans
268  all the block devices.
269  .TP
270 -- 
271 1.7.2.3
272