Re: [PATCH] Btrfs: add support for mixed data+metadata block groups V3

2010-10-21 Thread David Nicol
Does this mixing constitute a forbidden change of on-disk format, and
if not how not?


On Wed, Oct 20, 2010 at 11:21 PM, Mitch Harder
mitch.har...@sabayonlinux.org wrote:
 Other than that, it seemed to perform well.  I did not encounter any
 stability issues as long as I was using a patched kernel.
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


csum errors, and resizing...

2010-10-21 Thread Hugo Mills
   Just encountered an interesting issue.

   Rapid summary: when a resize encounters a file with broken
checksums, it stops, and will not (apparently) proceed any further.
Un/remount seems to clear the error condition.

   I've got a filesystem with some (lots of) checksum errors on it.
It lives on a single partition. In trying to move all the data off
this, onto a btrfs raid10 filesystem, I've been moving data, and
shrinking the filesystem. The shrink process has now hit some of those
csum errors:

h...@vlad:~ $ sudo btrfs fi show -h
failed to read /dev/sr0
Label: none  uuid: fad2f415-979d-405e-9aa2-0c1011389273
Total devices 1 FS bytes used 660.75GiB
devid1 size 675.40GiB used 1019.00GiB path /dev/dm-14
[...]

h...@vlad:~ $ sudo strace btrfs fi resize 708209608k /media/vlad/video
[...]
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7fcd26974000
write(1, Resize '/media/vlad/video' of '70..., 43Resize '/media/vlad/video' 
of '708209608k'
) = 43
ioctl(3, 0x50009403, 0x7fffe9a8d140)= -1 EIO (Input/output error)
close(3)= 0
write(2, ERROR: unable to resize '/media/v..., 44ERROR: unable to resize 
'/media/vlad/video'
) = 44
exit_group(30)  = ?

   In syslog, I get a bunch of csum errors:

Oct 21 19:40:01 vlad kernel: new size for /dev/mapper/media-video is 
725206638592
Oct 21 19:40:03 vlad kernel: btrfs: relocating block group 1090913304576 flags 1
Oct 21 19:40:05 vlad kernel: btrfs_readpage_end_io_hook: 4088 callbacks 
suppressed
Oct 21 19:40:05 vlad kernel: btrfs csum failed ino 257 off 131072 csum 
752820288 private 2880127001
Oct 21 19:40:05 vlad kernel: btrfs csum failed ino 257 off 135168 csum 
2112861244 private 3414608960
[and more]

   This is, I suppose, expected.

   However, it seems to put the filesystem into a state where a resize
cannot be attempted again:

h...@vlad:~ $ sudo strace btrfs fi resize 708209608k /media/vlad/video
[...]
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f559f8af000
write(1, Resize '/media/vlad/video' of '70..., 43Resize '/media/vlad/video' 
of '708209608k'
) = 43
ioctl(3, 0x50009403, 0x7fff8dfda770)= -1 EINVAL (Invalid argument)
close(3)= 0
write(2, ERROR: unable to resize '/media/v..., 44ERROR: unable to resize 
'/media/vlad/video'
) = 44
exit_group(30)  = ?

   Unmounting and remounting it resets the resize state, and I end up
back in the first state again. Is this toggling of state intended?

   I'm on the git unstable kernel. Should I go up to 2.6.36 and try
again? The other thing I can think of to do is to delete some of the
files with bad checksums (I have backups) and see if I can get any
further with the resize.

   Hugo.

-- 
=== Hugo Mills: h...@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
  --- We teach people management skills by examining characters in ---   
Shakespeare.  You could look at Claudius's crisis
   management techniques, for example.   


signature.asc
Description: Digital signature


kernel bug during balancing in raid0

2010-10-21 Thread dont
Hi,

this is my first ever mail for a mailing list!! This is exciting!!

Anyways, this is the scenario:

I have four 1TB drives that I've strapped together with the help of
btrfs using its built in RAID0.

The second and third drives that I added and subsequently balanced it
with:

btrfs-vol -b /mnt/raid0

went smooth without any reported errors and the command returned
cleanly.

Now since I compiled the new btrfs-utils form get a couple days ago I
noticed in the wiki there are command name changes so this time I used
this:

btrfs filesystem balance /mnt/raid0

and I can hear it doing stuff for a little while but then I get this
message in the terminal:

segmentation fault.

After this parts of my system become un-usable, like many commands get
stuck in the terminal not doing anything.

However the drive seems to have been added and I have not sufferend data
loss.

df -h
FilesystemSize  Used Avail Use% Mounted on
/dev/sdb  3.7T  1.7T  2.0T  46% /mnt/raid0

df
Filesystem   1K-blocksUsed  Available Use% Mounted on
/dev/sdb 3907050336 1779276448 2127773888  46% /mnt/raid0

dmesg shows something about this thing:

kernel BUG at fs/btrfs/extent-tree.c:2148!

oh I almost forgot my kernel is 2.6.35.

And the full dmesg output is below after the command I used.

btrfs filesystem balance /mnt/raid0/

[10040.981444] btrfs: relocating block group 6230205857792 flags 12
[10197.411858] btrfs: found 22355 extents
[10197.954791] btrfs: relocating block group 6226984632320 flags 9
[10198.501821] btrfs: relocating block group 6223763406848 flags 9
[10198.991431] btrfs: relocating block group 6220542181376 flags 9
[10199.522250] btrfs: relocating block group 6217320955904 flags 9
[10200.122756] btrfs: relocating block group 6214099730432 flags 9
[10200.641977] btrfs: relocating block group 6210878504960 flags 9
[10201.164459] btrfs: relocating block group 6207657279488 flags 9
[10201.662113] btrfs: relocating block group 6204436054016 flags 9
[10202.217882] btrfs: relocating block group 6201214828544 flags 9
[10202.757626] btrfs: relocating block group 6197993603072 flags 9
[10203.362371] btrfs: relocating block group 6194772377600 flags 9
[10203.868333] btrfs: relocating block group 6191551152128 flags 9
[10206.431497] btrfs: relocating block group 6188329926656 flags 9
[10207.094667] btrfs: relocating block group 6185108701184 flags 9
[10207.600651] btrfs: relocating block group 6181887475712 flags 9
[10208.355416] btrfs: relocating block group 6178666250240 flags 9
[10208.877984] btrfs: relocating block group 6175445024768 flags 9
[10209.582904] btrfs: relocating block group 6172223799296 flags 9
[10210.254746] btrfs: relocating block group 6169002573824 flags 9
[10210.843661] btrfs: relocating block group 6165781348352 flags 9
[10211.56] btrfs: relocating block group 6162560122880 flags 9
[10212.162329] btrfs: relocating block group 6159338897408 flags 9
[10212.851535] btrfs: relocating block group 6156117671936 flags 9
[10213.445385] btrfs: relocating block group 6152896446464 flags 9
[10214.069966] btrfs: relocating block group 6149675220992 flags 9
[10214.756110] btrfs: relocating block group 6146453995520 flags 9
[10215.372133] btrfs: relocating block group 6143232770048 flags 9
[10215.911293] btrfs: relocating block group 6140011544576 flags 9
[10216.566483] btrfs: relocating block group 6136790319104 flags 9
[10217.205129] btrfs: relocating block group 6133569093632 flags 9
[10217.822784] btrfs: relocating block group 6130347868160 flags 9
[10218.416009] btrfs: relocating block group 6127126642688 flags 9
[10219.087872] btrfs: relocating block group 6123905417216 flags 9
[10219.734828] btrfs: relocating block group 6120684191744 flags 9
[10220.363728] btrfs: relocating block group 6117462966272 flags 9
[10220.987199] btrfs: relocating block group 6114241740800 flags 9
[10221.592132] btrfs: relocating block group 6111020515328 flags 9
[10222.264522] btrfs: relocating block group 6107799289856 flags 9
[10222.795290] btrfs: relocating block group 6104578064384 flags 9
[10223.450587] btrfs: relocating block group 6101356838912 flags 9
[10224.047699] btrfs: relocating block group 6098135613440 flags 9
[10224.586848] btrfs: relocating block group 6094914387968 flags 9
[10225.119203] btrfs: relocating block group 6091693162496 flags 9
[10225.706517] btrfs: relocating block group 6088471937024 flags 9
[10226.287043] btrfs: relocating block group 6085250711552 flags 9
[10226.834568] btrfs: relocating block group 6082029486080 flags 9
[10227.390150] btrfs: relocating block group 6078808260608 flags 9
[10227.954166] btrfs: relocating block group 6075587035136 flags 9
[10228.475583] btrfs: relocating block group 6072365809664 flags 9
[10229.148512] btrfs: relocating block group 6072097439744 flags 12
[10378.421912] btrfs: found 58060 extents
[10378.954956] btrfs: relocating block group 6068876214272 flags 9
[10379.510704] btrfs: relocating block group 6065654988800 

[patch v2 0/4] Size reporting in userspace tools

2010-10-21 Thread Hugo Mills
   While playing around with resizing volumes recently, I realised
that I didn't know whether btrfs fi show and btrfs fi df reported
sizes in ISO (e.g. powers of 10^3) units, as they appear to from the
labels they use, or in binary (powers of 2^10) units. Also, a mere
three significant figures is somewhat less than I'm comfortable with
if I'm about to resize the containing block device downwards.
   
   This patch series adds the ability to pick which scale is used for
show and df, and labels the amounts properly (e.g. MB for ISO, MiB for
binary units).

   I've incorporated Frank's suggestion of defaulting to raw, and
matching coreutils' use of -h and -H. I've also updated the man pages
as requested by Goffredo.

   Hugo.
   
-- 
=== Hugo Mills: h...@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
   --- I spent most of my money on drink, women and fast cars. The ---   
  rest I wasted.  -- James Hunt  

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch v2 2/4] Add an option to show ISO, binary or raw bytes counts using df.

2010-10-21 Thread Hugo Mills
Change btrfs filesystem df to allow the user to control the scales
used for sizes in the output.

Signed-off-by: Hugo Mills h...@carfax.org.uk
---
 btrfs.c|6 +++---
 btrfs_cmds.c   |   42 --
 man/btrfs.8.in |8 
 3 files changed, 47 insertions(+), 9 deletions(-)

Index: btrfs-progs-unstable/btrfs.c
===
--- btrfs-progs-unstable.orig/btrfs.c   2010-10-20 19:12:18.0 +0100
+++ btrfs-progs-unstable/btrfs.c2010-10-20 19:48:34.0 +0100
@@ -87,9 +87,9 @@
Show the info of a btrfs filesystem. If no uuid or label\n
is passed, info of all the btrfs filesystem are shown.
},
-   { do_df_filesystem, 1,
- filesystem df, path\n
-   Show space usage information for a mount point\n.
+   { do_df_filesystem, -1,
+ filesystem df, [options] path\n
+   Show space usage information for a mount point.
},
{ do_balance, 1,
  filesystem balance, path\n
Index: btrfs-progs-unstable/btrfs_cmds.c
===
--- btrfs-progs-unstable.orig/btrfs_cmds.c  2010-10-20 19:19:20.0 
+0100
+++ btrfs-progs-unstable/btrfs_cmds.c   2010-10-20 19:58:48.0 +0100
@@ -14,7 +14,6 @@
  * Boston, MA 021110-1307, USA.
  */
 
-
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -28,6 +27,7 @@
 #include limits.h
 #include uuid/uuid.h
 #include ctype.h
+#include getopt.h
 
 #undef ULONG_MAX
 
@@ -835,13 +835,45 @@
return 0;
 }
 
+const struct option df_options[] = {
+   { human-readable, 0, NULL, 'h' },
+   { si, 0, NULL, 'H' },
+   { NULL, 0, NULL, 0 }
+};
+
 int do_df_filesystem(int nargs, char **argv)
 {
struct btrfs_ioctl_space_args *sargs;
u64 count = 0, i;
int ret;
int fd;
-   char *path = argv[1];
+   char *path;
+   int format = PRETTY_SIZE_RAW;
+
+   optind = 1;
+   while(1) {
+   int c = getopt_long(nargs, argv, hH, df_options, NULL);
+   if (c  0)
+   break;
+   switch(c) {
+   case 'h':
+   format = PRETTY_SIZE_BINARY;
+   break;
+   case 'H':
+   format = PRETTY_SIZE_ISO;
+   break;
+   default:
+   fprintf(stderr, Invalid arguments for df\n);
+   free(argv);
+   return 1;
+   }
+   }
+   if (nargs - optind != 1) {
+   fprintf(stderr, No path given for df\n);
+   free(argv);
+   return 1;
+   }
+   path = argv[optind];
 
fd = open_file_or_dir(path);
if (fd  0) {
@@ -914,10 +946,8 @@
written += 8;
}
 
-   total_bytes = pretty_sizes(sargs-spaces[i].total_bytes,
-   
PRETTY_SIZE_RAW);
-   used_bytes = pretty_sizes(sargs-spaces[i].used_bytes,
-   
PRETTY_SIZE_RAW);
+   total_bytes = pretty_sizes(sargs-spaces[i].total_bytes, 
format);
+   used_bytes = pretty_sizes(sargs-spaces[i].used_bytes, format);
printf(%s: total=%s, used=%s\n, description, total_bytes,
   used_bytes);
}
Index: btrfs-progs-unstable/man/btrfs.8.in
===
--- btrfs-progs-unstable.orig/man/btrfs.8.in2010-10-20 19:23:36.0 
+0100
+++ btrfs-progs-unstable/man/btrfs.8.in 2010-10-20 19:28:14.0 +0100
@@ -21,6 +21,8 @@
 .PP
 \fBbtrfs\fP \fBfilesystem resize\fP\fI [+/\-]size[gkm]|max filesystem\fP
 .PP
+\fBbtrfs\fP \fBfilesystem df\fP\fI [options] path\fP
+.PP
 \fBbtrfs\fP \fBdevice scan\fP\fI [device [device..]]\fP
 .PP
 \fBbtrfs\fP \fBdevice show\fP\fI dev|label [dev|label...]\fP
@@ -143,6 +145,12 @@
 passed, \fBbtrfs\fR show info of all the btrfs filesystem.
 .TP
 
+\fBfilesystem df\fR [options] path\fR
+Show the amount of space used on this filesystem, in bytes. Options:
+-h, --human-readable Use powers of 2^10 (1024) to report sizes.
+-H, --si Use powers of 10^3 (1000) to report sizes, in SI multiples.
+.TP
+
 \fBdevice balance\fR \fIpath\fR
 Balance the chunks of the filesystem identified by \fIpath\fR
 across the devices.

-- 
=== Hugo Mills: h...@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
   --- I spent most of my money on drink, women and fast cars. The ---   
  rest I wasted.  -- James Hunt  

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to 

[patch v2 4/4] Add an option to show ISO, binary or raw bytes counts using btrfs-show.

2010-10-21 Thread Hugo Mills
Change btrfs-show to allow the user to control the scales used for
sizes in the output.

Signed-off-by: Hugo Mills h...@carfax.org.uk
---
 btrfs-show.c|   27 +++
 man/btrfs-show.8.in |   10 --
 2 files changed, 27 insertions(+), 10 deletions(-)

Index: btrfs-progs-unstable/btrfs-show.c
===
--- btrfs-progs-unstable.orig/btrfs-show.c  2010-10-20 19:48:33.0 
+0100
+++ btrfs-progs-unstable/btrfs-show.c   2010-10-20 20:18:11.0 +0100
@@ -52,7 +52,7 @@
return 0;
 }
 
-static void print_one_uuid(struct btrfs_fs_devices *fs_devices)
+static void print_one_uuid(struct btrfs_fs_devices *fs_devices, int format)
 {
char uuidbuf[37];
struct list_head *cur;
@@ -69,8 +69,7 @@
else
printf(Label: none );
 
-   super_bytes_used = pretty_sizes(device-super_bytes_used,
-   
PRETTY_SIZE_RAW);
+   super_bytes_used = pretty_sizes(device-super_bytes_used, format);
 
total = device-total_devs;
printf( uuid: %s\n\tTotal devices %llu FS bytes used %s\n, uuidbuf,
@@ -82,8 +81,8 @@
char *total_bytes;
char *bytes_used;
device = list_entry(cur, struct btrfs_device, dev_list);
-   total_bytes = pretty_sizes(device-total_bytes, 
PRETTY_SIZE_RAW);
-   bytes_used = pretty_sizes(device-bytes_used, PRETTY_SIZE_RAW);
+   total_bytes = pretty_sizes(device-total_bytes, format);
+   bytes_used = pretty_sizes(device-bytes_used, format);
printf(\tdevid %4llu size %s used %s path %s\n,
   (unsigned long long)device-devid,
   total_bytes, bytes_used, device-name);
@@ -99,13 +98,18 @@
 
 static void print_usage(void)
 {
-   fprintf(stderr, usage: btrfs-show [search label or device]\n);
+   fprintf(stderr, usage: btrfs-show [options] [search label or 
device]\n);
+   fprintf(stderr, Options:\n);
+   fprintf(stderr, \t-h, --human-readable\tShow sizes in powers of 
2^10.\n);
+   fprintf(stderr, \t-s, --si\t\tShow sizes in powers of 10^3 (SI 
multiples).\n);
fprintf(stderr, %s\n, BTRFS_BUILD_VERSION);
exit(1);
 }
 
 static struct option long_options[] = {
/* { byte-count, 1, NULL, 'b' }, */
+   { human-readable, 0, NULL, 'h' },
+   { si, 0, NULL, 'H' },
{ 0, 0, 0, 0}
 };
 
@@ -117,14 +121,21 @@
char *search = NULL;
int ret;
int option_index = 0;
+   int format = PRETTY_SIZE_RAW;
 
while(1) {
int c;
-   c = getopt_long(ac, av, , long_options,
+   c = getopt_long(ac, av, hH, long_options,
option_index);
if (c  0)
break;
switch(c) {
+   case 'H':
+   format = PRETTY_SIZE_ISO;
+   break;
+   case 'h':
+   format = PRETTY_SIZE_BINARY;
+   break;
default:
print_usage();
}
@@ -144,7 +155,7 @@
list);
if (search  uuid_search(fs_devices, search) == 0)
continue;
-   print_one_uuid(fs_devices);
+   print_one_uuid(fs_devices, format);
}
printf(%s\n, BTRFS_BUILD_VERSION);
return 0;
Index: btrfs-progs-unstable/man/btrfs-show.8.in
===
--- btrfs-progs-unstable.orig/man/btrfs-show.8.in   2010-10-20 
20:15:29.0 +0100
+++ btrfs-progs-unstable/man/btrfs-show.8.in2010-10-20 20:17:30.0 
+0100
@@ -2,13 +2,19 @@
 .SH NAME
 btrfs-show \- scan the /dev directory for btrfs partitions and print results.
 .SH SYNOPSIS
-.B btrfs-show
+.B btrfs-show [options]
 .SH DESCRIPTION
 .B btrfs-show
 is used to scan the /dev directory for btrfs partitions and display brief
 information such as lable, uuid, etc of each btrfs partition.
 .SH OPTIONS
-none
+.TP
+\fB\-h\fR, \fB\-\-human\-readable\fR
+Show values in multiples of 2^10.
+.TP
+\fB\-H\fR, \fB\-\-si\fR
+Show values in multiples of 10^3 (SI multiples).
+
 .SH AVAILABILITY
 .B btrfs-show
 is part of btrfs-progs. Btrfs is currently under heavy development,

-- 
=== Hugo Mills: h...@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
   --- I spent most of my money on drink, women and fast cars. The ---   
  rest I wasted.  -- James Hunt  

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More 

[patch v2 3/4] Add an option to show ISO, binary or raw bytes counts using show.

2010-10-21 Thread Hugo Mills
Change btrfs filesystem show to allow the user to control the scales
used for sizes in the output.

Signed-off-by: Hugo Mills h...@carfax.org.uk
---
 btrfs.c|2 +-
 btrfs_cmds.c   |   45 ++---
 man/btrfs.8.in |   10 ++
 3 files changed, 49 insertions(+), 8 deletions(-)

Index: btrfs-progs-unstable/btrfs.c
===
--- btrfs-progs-unstable.orig/btrfs.c   2010-10-20 20:03:37.0 +0100
+++ btrfs-progs-unstable/btrfs.c2010-10-20 20:11:03.0 +0100
@@ -83,7 +83,7 @@
will occupe all available space on the device.
},
{ do_show_filesystem, 999,
- filesystem show, [uuid|label]\n
+ filesystem show, [options] [uuid|label]\n
Show the info of a btrfs filesystem. If no uuid or label\n
is passed, info of all the btrfs filesystem are shown.
},
Index: btrfs-progs-unstable/btrfs_cmds.c
===
--- btrfs-progs-unstable.orig/btrfs_cmds.c  2010-10-20 20:03:37.0 
+0100
+++ btrfs-progs-unstable/btrfs_cmds.c   2010-10-20 20:08:00.0 +0100
@@ -617,7 +617,7 @@
return 0;
 }
 
-static void print_one_uuid(struct btrfs_fs_devices *fs_devices)
+static void print_one_uuid(struct btrfs_fs_devices *fs_devices, int format)
 {
char uuidbuf[37];
struct list_head *cur;
@@ -634,8 +634,7 @@
else
printf(Label: none );
 
-   super_bytes_used = pretty_sizes(device-super_bytes_used,
-   
PRETTY_SIZE_RAW);
+   super_bytes_used = pretty_sizes(device-super_bytes_used, format);
 
total = device-total_devs;
printf( uuid: %s\n\tTotal devices %llu FS bytes used %s\n, uuidbuf,
@@ -647,8 +646,8 @@
char *total_bytes;
char *bytes_used;
device = list_entry(cur, struct btrfs_device, dev_list);
-   total_bytes = pretty_sizes(device-total_bytes, 
PRETTY_SIZE_RAW);
-   bytes_used = pretty_sizes(device-bytes_used, PRETTY_SIZE_RAW);
+   total_bytes = pretty_sizes(device-total_bytes, format);
+   bytes_used = pretty_sizes(device-bytes_used, format);
printf(\tdevid %4llu size %s used %s path %s\n,
   (unsigned long long)device-devid,
   total_bytes, bytes_used, device-name);
@@ -662,13 +661,45 @@
printf(\n);
 }
 
+const struct option show_options[] = {
+   { human-readable, 0, NULL, 'h' },
+   { si, 0, NULL, 'H' },
+   { NULL, 0, NULL, 0 }
+};
+
 int do_show_filesystem(int argc, char **argv)
 {
struct list_head *all_uuids;
struct btrfs_fs_devices *fs_devices;
struct list_head *cur_uuid;
-   char *search = argv[1];
+   char *search;
int ret;
+   int format = PRETTY_SIZE_RAW;
+
+   optind = 1;
+   while(1) {
+   int c = getopt_long(argc, argv, hH, show_options, NULL);
+   if (c  0)
+   break;
+   switch(c) {
+   case 'h':
+   format = PRETTY_SIZE_BINARY;
+   break;
+   case 'H':
+   format = PRETTY_SIZE_ISO;
+   break;
+   default:
+   fprintf(stderr, Invalid arguments for show\n);
+   free(argv);
+   return 1;
+   }
+   }
+   if (argc - optind  1) {
+   fprintf(stderr, Too many arguments for show\n);
+   free(argv);
+   return 1;
+   }
+   search = argv[optind];
 
ret = btrfs_scan_one_dir(/dev, 0);
if (ret){
@@ -682,7 +713,7 @@
list);
if (search  uuid_search(fs_devices, search) == 0)
continue;
-   print_one_uuid(fs_devices);
+   print_one_uuid(fs_devices, format);
}
printf(%s\n, BTRFS_BUILD_VERSION);
return 0;
Index: btrfs-progs-unstable/man/btrfs.8.in
===
--- btrfs-progs-unstable.orig/man/btrfs.8.in2010-10-20 20:03:53.0 
+0100
+++ btrfs-progs-unstable/man/btrfs.8.in 2010-10-20 20:08:15.0 +0100
@@ -23,6 +23,8 @@
 .PP
 \fBbtrfs\fP \fBfilesystem df\fP\fI [options] path\fP
 .PP
+\fBbtrfs\fP \fBfilesystem show\fP\fI [options] [uuid|label]\fP
+.PP
 \fBbtrfs\fP \fBdevice scan\fP\fI [device [device..]]\fP
 .PP
 \fBbtrfs\fP \fBdevice show\fP\fI dev|label [dev|label...]\fP
@@ -151,6 +153,14 @@
 -H, --si Use powers of 10^3 (1000) to report sizes, in SI multiples.
 .TP
 
+\fBfilesystem show\fR [options] [uuid|label]\fR
+Show the usage of each device in the btrfs filesystem with the given
+uuid or label, or all 

[patch v2 1/4] Update pretty-printer for different systems of counting multiples.

2010-10-21 Thread Hugo Mills
Make the pretty-printer for data sizes capable of printing in ISO
(powers of 10^3), binary (powers of 2^10) or raw (a simple byte
count).

Signed-off-by: Hugo Mills h...@carfax.org.uk
---
 btrfs-show.c |7 ---
 btrfs_cmds.c |   13 -
 mkfs.c   |3 ++-
 utils.c  |   48 +---
 utils.h  |7 ++-
 5 files changed, 53 insertions(+), 25 deletions(-)

Index: btrfs-progs-unstable/btrfs-show.c
===
--- btrfs-progs-unstable.orig/btrfs-show.c  2010-10-09 15:39:09.0 
+0100
+++ btrfs-progs-unstable/btrfs-show.c   2010-10-20 19:20:02.0 +0100
@@ -69,7 +69,8 @@
else
printf(Label: none );
 
-   super_bytes_used = pretty_sizes(device-super_bytes_used);
+   super_bytes_used = pretty_sizes(device-super_bytes_used,
+   
PRETTY_SIZE_RAW);
 
total = device-total_devs;
printf( uuid: %s\n\tTotal devices %llu FS bytes used %s\n, uuidbuf,
@@ -81,8 +82,8 @@
char *total_bytes;
char *bytes_used;
device = list_entry(cur, struct btrfs_device, dev_list);
-   total_bytes = pretty_sizes(device-total_bytes);
-   bytes_used = pretty_sizes(device-bytes_used);
+   total_bytes = pretty_sizes(device-total_bytes, 
PRETTY_SIZE_RAW);
+   bytes_used = pretty_sizes(device-bytes_used, PRETTY_SIZE_RAW);
printf(\tdevid %4llu size %s used %s path %s\n,
   (unsigned long long)device-devid,
   total_bytes, bytes_used, device-name);
Index: btrfs-progs-unstable/btrfs_cmds.c
===
--- btrfs-progs-unstable.orig/btrfs_cmds.c  2010-10-09 15:39:09.0 
+0100
+++ btrfs-progs-unstable/btrfs_cmds.c   2010-10-20 19:19:20.0 +0100
@@ -634,7 +634,8 @@
else
printf(Label: none );
 
-   super_bytes_used = pretty_sizes(device-super_bytes_used);
+   super_bytes_used = pretty_sizes(device-super_bytes_used,
+   
PRETTY_SIZE_RAW);
 
total = device-total_devs;
printf( uuid: %s\n\tTotal devices %llu FS bytes used %s\n, uuidbuf,
@@ -646,8 +647,8 @@
char *total_bytes;
char *bytes_used;
device = list_entry(cur, struct btrfs_device, dev_list);
-   total_bytes = pretty_sizes(device-total_bytes);
-   bytes_used = pretty_sizes(device-bytes_used);
+   total_bytes = pretty_sizes(device-total_bytes, 
PRETTY_SIZE_RAW);
+   bytes_used = pretty_sizes(device-bytes_used, PRETTY_SIZE_RAW);
printf(\tdevid %4llu size %s used %s path %s\n,
   (unsigned long long)device-devid,
   total_bytes, bytes_used, device-name);
@@ -913,8 +914,10 @@
written += 8;
}
 
-   total_bytes = pretty_sizes(sargs-spaces[i].total_bytes);
-   used_bytes = pretty_sizes(sargs-spaces[i].used_bytes);
+   total_bytes = pretty_sizes(sargs-spaces[i].total_bytes,
+   
PRETTY_SIZE_RAW);
+   used_bytes = pretty_sizes(sargs-spaces[i].used_bytes,
+   
PRETTY_SIZE_RAW);
printf(%s: total=%s, used=%s\n, description, total_bytes,
   used_bytes);
}
Index: btrfs-progs-unstable/mkfs.c
===
--- btrfs-progs-unstable.orig/mkfs.c2010-10-09 15:39:09.0 +0100
+++ btrfs-progs-unstable/mkfs.c 2010-10-17 19:35:08.0 +0100
@@ -524,7 +524,8 @@
printf(fs created label %s on %s\n\tnodesize %u leafsize %u 
sectorsize %u size %s\n,
label, first_file, nodesize, leafsize, sectorsize,
-   pretty_sizes(btrfs_super_total_bytes(root-fs_info-super_copy)));
+   
pretty_sizes(btrfs_super_total_bytes(root-fs_info-super_copy),
+   PRETTY_SIZE_BINARY));
 
printf(%s\n, BTRFS_BUILD_VERSION);
btrfs_commit_transaction(trans, root);
Index: btrfs-progs-unstable/utils.c
===
--- btrfs-progs-unstable.orig/utils.c   2010-10-09 15:39:09.0 +0100
+++ btrfs-progs-unstable/utils.c2010-10-17 19:35:08.0 +0100
@@ -966,30 +966,48 @@
return ret;
 }
 
-static char *size_strs[] = { , KB, MB, GB, TB,
+static char *bin_size_strs[] = { , KiB, MiB, GiB, TiB,
+   PiB, EiB, ZiB, YiB};
+static char *iso_size_strs[] = { , kB, MB, GB, TB,
PB, EB, ZB, YB};

Re: [PATCH] Btrfs: add support for mixed data+metadata block groups V3

2010-10-21 Thread Mitch Harder
On Thu, Oct 21, 2010 at 5:09 PM, Diego Calleja dieg...@gmail.com wrote:
 On Jueves, 21 de Octubre de 2010 17:46:58 David Nicol escribió:
 Does this mixing constitute a forbidden change of on-disk format, and
 if not how not?

 It doesn't need a format change. The difference between a data and
 a metadata block group is just an allocation hint AFAIK.
 --
 To unsubscribe from this list: send the line unsubscribe linux-btrfs in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html


Let me know if the problems with an un-patched kernel were un-expected.

I can provide more information on the crash when booting an older kernel.
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: add support for mixed data+metadata block groups V3

2010-10-21 Thread Josef Bacik
On Thu, Oct 21, 2010 at 05:21:06PM -0500, Mitch Harder wrote:
 On Thu, Oct 21, 2010 at 5:09 PM, Diego Calleja dieg...@gmail.com wrote:
  On Jueves, 21 de Octubre de 2010 17:46:58 David Nicol escribió:
  Does this mixing constitute a forbidden change of on-disk format, and
  if not how not?
 
  It doesn't need a format change. The difference between a data and
  a metadata block group is just an allocation hint AFAIK.
  --
  To unsubscribe from this list: send the line unsubscribe linux-btrfs in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
 
 Let me know if the problems with an un-patched kernel were un-expected.
 
 I can provide more information on the crash when booting an older kernel.

Nope they are expected, it's not a disk format change, but older kernels won't
deal with mixed block groups.  Thanks,

Josef
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: add support for mixed data+metadata block groups V3

2010-10-21 Thread C Anthony Risinger
On Thu, Oct 21, 2010 at 8:05 PM, Josef Bacik jo...@redhat.com wrote:
 On Thu, Oct 21, 2010 at 05:21:06PM -0500, Mitch Harder wrote:
 On Thu, Oct 21, 2010 at 5:09 PM, Diego Calleja dieg...@gmail.com wrote:
  On Jueves, 21 de Octubre de 2010 17:46:58 David Nicol escribió:
  Does this mixing constitute a forbidden change of on-disk format, and
  if not how not?
 
  It doesn't need a format change. The difference between a data and
  a metadata block group is just an allocation hint AFAIK.
  --
  To unsubscribe from this list: send the line unsubscribe linux-btrfs in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

 Let me know if the problems with an un-patched kernel were un-expected.

 I can provide more information on the crash when booting an older kernel.

 Nope they are expected, it's not a disk format change, but older kernels won't
 deal with mixed block groups.

When something like this goes mainline, is it used by default/automatically?

I ask because I maintain a btrfs-based rollback initramfs hook [1],
and am currently updating it for extlinux, enabling kernel-level
system rollbacks via `btrfs set-default` + reboot (or maybe
`kexec`)...

rolling back to an old kernel will then blow up my machine
(figuratively of course :-)?

C Anthony

[1] http://aur.archlinux.org/packages.php?ID=33376
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: add support for mixed data+metadata block groups V3

2010-10-21 Thread Josef Bacik
On Thu, Oct 21, 2010 at 08:32:12PM -0500, C Anthony Risinger wrote:
 On Thu, Oct 21, 2010 at 8:05 PM, Josef Bacik jo...@redhat.com wrote:
  On Thu, Oct 21, 2010 at 05:21:06PM -0500, Mitch Harder wrote:
  On Thu, Oct 21, 2010 at 5:09 PM, Diego Calleja dieg...@gmail.com wrote:
   On Jueves, 21 de Octubre de 2010 17:46:58 David Nicol escribió:
   Does this mixing constitute a forbidden change of on-disk format, and
   if not how not?
  
   It doesn't need a format change. The difference between a data and
   a metadata block group is just an allocation hint AFAIK.
   --
   To unsubscribe from this list: send the line unsubscribe linux-btrfs in
   the body of a message to majord...@vger.kernel.org
   More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
 
  Let me know if the problems with an un-patched kernel were un-expected.
 
  I can provide more information on the crash when booting an older kernel.
 
  Nope they are expected, it's not a disk format change, but older kernels 
  won't
  deal with mixed block groups.
 
 When something like this goes mainline, is it used by default/automatically?
 
 I ask because I maintain a btrfs-based rollback initramfs hook [1],
 and am currently updating it for extlinux, enabling kernel-level
 system rollbacks via `btrfs set-default` + reboot (or maybe
 `kexec`)...
 
 rolling back to an old kernel will then blow up my machine
 (figuratively of course :-)?


The only way you get this feature is if you mkfs with the feature enabled, and
is only meant for small filesystems (1 gig or smaller).  Thanks,

Josef
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: add support for mixed data+metadata block groups V3

2010-10-21 Thread C Anthony Risinger
On Thu, Oct 21, 2010 at 8:37 PM, Josef Bacik jo...@redhat.com wrote:
 On Thu, Oct 21, 2010 at 08:32:12PM -0500, C Anthony Risinger wrote:
 On Thu, Oct 21, 2010 at 8:05 PM, Josef Bacik jo...@redhat.com wrote:
  On Thu, Oct 21, 2010 at 05:21:06PM -0500, Mitch Harder wrote:
  On Thu, Oct 21, 2010 at 5:09 PM, Diego Calleja dieg...@gmail.com wrote:
   On Jueves, 21 de Octubre de 2010 17:46:58 David Nicol escribió:
   Does this mixing constitute a forbidden change of on-disk format, and
   if not how not?
  
   It doesn't need a format change. The difference between a data and
   a metadata block group is just an allocation hint AFAIK.
   --
   To unsubscribe from this list: send the line unsubscribe linux-btrfs 
   in
   the body of a message to majord...@vger.kernel.org
   More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
 
  Let me know if the problems with an un-patched kernel were un-expected.
 
  I can provide more information on the crash when booting an older kernel.
 
  Nope they are expected, it's not a disk format change, but older kernels 
  won't
  deal with mixed block groups.

 When something like this goes mainline, is it used by default/automatically?

 I ask because I maintain a btrfs-based rollback initramfs hook [1],
 and am currently updating it for extlinux, enabling kernel-level
 system rollbacks via `btrfs set-default` + reboot (or maybe
 `kexec`)...

 rolling back to an old kernel will then blow up my machine
 (figuratively of course :-)?


 The only way you get this feature is if you mkfs with the feature enabled, and
 is only meant for small filesystems (1 gig or smaller).

Ah right :-), thanks

C Anthony
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html