Re: how to check data and metadata type
On 30 Jan 2010, at 19:20, Josef Bacik wrote: On Sat, Jan 30, 2010 at 05:57:49PM +0100, Thomas Kupper wrote: On 30 Jan 2010, at 16:18, Josef Bacik wrote: On Fri, Jan 29, 2010 at 11:43:45PM +0100, Thomas Kupper wrote: Just a short question: How can I check the data and metadata modes of a multi-device btrfs device? btrfs-show is of no help and df is still not showing the correct size of it either (using latest btrfs kernel module and btrfs tools). There are patches to do this for you, look for the -i patch for btrfs-progs and the df patch for the kernel, that will give you the information you are looking for. Thanks, Josef Thanks Josef, I'm stuck with two problems : * found the df patch but it does not apply. The latest btrfs-unstable seems not have BTRFS_IOC_SNAP_LISTING, neither btrfs_ioctl_default_subvol. With what revision of btrfs do you work? Of course I could apply it manually but I'm interested in the snap listing, too :) Oh yeah sorry, there are other patches for snapshot listing and setting the default snapshot/subvol to mount and my df patch was done on top of those other patches. If you just fix the rejections from my df patch it will work fine since it doesn't depend on either of those patches. Chris is going to make a dangerous branch on his btrfs-unstable git tree that will have all of that work as well, so you should be able to use it shortly. * I did not succeed in finding the patch '-i'. If you would happen to know where I can find it? I was looking on linux-btrfs mailing list and asked the allknowing Google. This is the btrfs-progs patch http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg03808.html and this is the kernel patch you'll want http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg03807.html Thanks, Josef Josef, do you have a user space app which uses the new IOCTL? df is using, right? o/ Thomas-- 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: how to check data and metadata type
On 31 Jan 2010, at 09:46, Thomas Kupper wrote: On 30 Jan 2010, at 19:20, Josef Bacik wrote: On Sat, Jan 30, 2010 at 05:57:49PM +0100, Thomas Kupper wrote: On 30 Jan 2010, at 16:18, Josef Bacik wrote: On Fri, Jan 29, 2010 at 11:43:45PM +0100, Thomas Kupper wrote: Just a short question: How can I check the data and metadata modes of a multi-device btrfs device? btrfs-show is of no help and df is still not showing the correct size of it either (using latest btrfs kernel module and btrfs tools). There are patches to do this for you, look for the -i patch for btrfs-progs and the df patch for the kernel, that will give you the information you are looking for. Thanks, Josef [...] This is the btrfs-progs patch http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg03808.html and this is the kernel patch you'll want http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg03807.html Thanks, Josef Josef, do you have a user space app which uses the new IOCTL? df is using, right? Typo: it should have written - df isn't using it, right? o/ Thomas-- 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: panic during rebalance, and now upon mount
Yan, Zheng wrote: Please run btrfsck and mount the fs with the new patches attached below. Thank you Yan, Zheng, During my two runs of btrfsck, the machine froze in an odd way before it completed where the VTs were still accessible but wouldn't accept keystrokes. I at first suspected it ran out of memory+swap. I gave it more swap through temp swapfiles the second time around. During most of the fsck run, the process held onto 2.7 GB of RAM. Toward the end, it climbed all the way to 3.8 GB, and then the entire machine froze in this odd way again. This was the `vmstat 1` that was running as it froze. procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 2 8296 30128 4240 355200 2800 0 1833 3366 0 1 75 24 0 2 8296 29880 5204 320400 4028 0 2447 4554 0 1 74 24 0 2 8296 30508 4400 328800 168020 1855 2422 0 1 75 24 0 2 8296 30136 3720 310800 2464 0 2009 2672 0 1 73 25 0 2 8296 29392 4396 301200 5996 0 2346 4089 0 2 71 27 0 2 8296 29144 4076 259200 3952 0 4430 2910 0 1 77 21 0 2 8296 29764 2416 286800 216812 1750 2488 0 1 70 28 0 3 28900 25796 1804 18600 20604 3428 20660 1906 2766 0 2 75 23 1 3 109760 25796 1396 19920 80852 288 80852 7665 442 0 2 60 37 0 4 113096 25672 1396 19920 3332 0 3332 105 43 0 0 74 26 And the `top` top - 02:50:28 up 3:48, 8 users, load average: 2.52, 2.01, 1.72 Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie Cpu(s): 0.1%us, 0.6%sy, 0.0%ni, 59.5%id, 39.7%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 4050160k total, 4024488k used,25672k free, 1268k buffers Swap: 20978072k total, 119136k used, 20858936k free, 2072k cached PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND 5882 root 20 0 3840m 3.6g 220 D2 94.2 8:26.44 btrfsck This is as much from fsck as was available during both runs -[~:#]- ./btrfsck /dev/mapper/btra root 256 inode 356018 errors 2000 root 256 inode 356022 errors 2000 root 256 inode 356023 errors 2000 root 256 inode 356025 errors 2000 root 256 inode 356027 errors 2000 root 256 inode 356033 errors 2000 root 256 inode 356034 errors 2000 root 256 inode 356035 errors 2000 root 256 inode 356036 errors 2000 root 256 inode 356037 errors 2000 root 256 inode 356038 errors 2000 root 256 inode 356039 errors 2000 root 256 inode 356040 errors 2000 root 256 inode 356044 errors 2000 root 256 inode 356045 errors 2000 root 256 inode 356046 errors 2000 root 256 inode 356047 errors 2000 root 256 inode 356049 errors 2000 root 256 inode 356050 errors 2000 root 256 inode 356051 errors 2000 root 256 inode 356052 errors 2000 root 256 inode 356053 errors 2000 root 256 inode 356054 errors 2000 root 256 inode 356055 errors 2000 root 256 inode 356056 errors 2000 root 256 inode 356058 errors 2000 root 256 inode 356063 errors 2000 root 256 inode 640297 errors 2000 root 256 inode 640301 errors 2000 root 256 inode 640302 errors 2000 root 256 inode 640304 errors 2000 root 256 inode 640306 errors 2000 root 256 inode 640312 errors 2000 root 256 inode 640313 errors 2000 root 256 inode 640314 errors 2000 root 256 inode 640315 errors 2000 root 256 inode 640316 errors 2000 root 256 inode 640317 errors 2000 root 256 inode 640318 errors 2000 root 256 inode 640319 errors 2000 root 256 inode 640323 errors 2000 root 256 inode 640324 errors 2000 root 256 inode 640325 errors 2000 root 256 inode 640326 errors 2000 root 256 inode 640328 errors 2000 root 256 inode 640329 errors 2000 root 256 inode 640330 errors 2000 root 256 inode 640331 errors 2000 root 256 inode 640332 errors 2000 root 256 inode 640333 errors 2000 root 256 inode 640334 errors 2000 root 256 inode 640335 errors 2000 root 256 inode 640337 errors 2000 root 256 inode 640342 errors 2000 root 256 inode 831519 errors 2000 root 257 inode 272056 errors 2000 root 257 inode 272060 errors 2000 root 257 inode 272061 errors 2000 root 257 inode 272063 errors 2000 root 257 inode 272065 errors 2000 root 257 inode 272071 errors 2000 root 257 inode 272072 errors 2000 root 257 inode 272073 errors 2000 root 257 inode 272074 errors 2000 root 257 inode 272075 errors 2000 root 257 inode 272076 errors 2000 root 257 inode 272077 errors 2000 root 257 inode 272078 errors 2000 root 257 inode 272082 errors 2000 root 257 inode 272083 errors 2000 root 257 inode 272084 errors 2000 root 257 inode 272085 errors 2000 root 257 inode 272087 errors 2000 root 257 inode 272088 errors 2000 root 257 inode 272089 errors 2000 root 257 inode 272090 errors 2000 root 257 inode 272091 errors 2000 root 257 inode 272092 errors 2000 root 257 inode 272093 errors 2000 root 257 inode 272094 errors 2000 root 257 inode 272096 errors 2000 root 257 inode 272101
btrfs roadmap
Hello, how far or how close we are to some stable release (I assume that would be 1.0) ? I was looking for some detailed timeline, but I found only this link http://btrfs.wiki.kernel.org/index.php/Development_timeline ... but I was looking for something like ubuntu has https://wiki.ubuntu.com/LucidReleaseSchedule ...it would be great if ubuntu 10.04 ships with btrfs 1.0 ... If we manage to work fast enough to add installer support for Lucid, it will not be presented by default, as it is not clear that the filesystem is stable enough yet..., https://wiki.ubuntu.com/FoundationsTeam/BtrfsSupport cheers, rk -- 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
[RFC PATCH] Add debug-btrfs command to btrfs-progs
Hi, The below set of patches add debug-btrfs command to btrfs-progs package. The new command depends on the libss.a library provided e2fsprogs. To build one have to set E2FSPRGS_BUILD_DIR to point to the e2fsprogs build directory. Once we get e2fsprogs to create a proper libss package we should be able to remove the above export. Currently supported list of commands are listed below. It should be really easy to add new commands debug-btrfs: ? Available debug-btrfs requests: show_debugfs_params, params Show btrfs_debug parameters open_filesys, open Open the file system dump_treeShow full btrfs tree dump_root_tree Show root tree dump_chunk_tree Show btrfs chunk tree print_inode Print inode details help Display info on command or topic. list_requests, lr, ? List available commands. quit, q Leave the subsystem. You should be able to get the patches with --no-renames at http://www.kernel.org/pub/linux/kernel/people/kvaneesh/debug-btrfs/ -aneesh -- 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 1/4] btrfs-progs: Move files around
Build libbtrfs.a and link against that for the commands Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- Makefile| 72 +++ lib/Makefile| 47 bit-radix.c = lib/bit-radix.c |0 bit-radix.h = lib/bit-radix.h |0 crc32c.c = lib/crc32c.c|0 crc32c.h = lib/crc32c.h|0 ctree.c = lib/ctree.c |0 ctree.h = lib/ctree.h |0 dir-item.c = lib/dir-item.c|0 disk-io.c = lib/disk-io.c |0 disk-io.h = lib/disk-io.h |0 extent-cache.c = lib/extent-cache.c|0 extent-cache.h = lib/extent-cache.h|0 extent-tree.c = lib/extent-tree.c |0 extent_io.c = lib/extent_io.c |0 extent_io.h = lib/extent_io.h |0 file-item.c = lib/file-item.c |0 hash.h = lib/hash.h|0 inode-item.c = lib/inode-item.c|0 inode-map.c = lib/inode-map.c |0 ioctl.h = lib/ioctl.h |0 kerncompat.h = lib/kerncompat.h|0 list.h = lib/list.h|0 print-tree.c = lib/print-tree.c|0 print-tree.h = lib/print-tree.h|0 radix-tree.c = lib/radix-tree.c|0 radix-tree.h = lib/radix-tree.h|0 rbtree.c = lib/rbtree.c|0 rbtree.h = lib/rbtree.h|0 root-tree.c = lib/root-tree.c |0 transaction.h = lib/transaction.h |0 utils.c = lib/utils.c |0 utils.h = lib/utils.h |0 volumes.c = lib/volumes.c |0 volumes.h = lib/volumes.h |0 misc/Makefile | 79 bcp = misc/bcp |0 btrfs-image.c = misc/btrfs-image.c |0 btrfs-map-logical.c = misc/btrfs-map-logical.c |0 btrfs-show.c = misc/btrfs-show.c |0 btrfs-vol.c = misc/btrfs-vol.c |0 btrfsck.c = misc/btrfsck.c |0 btrfsctl.c = misc/btrfsctl.c |0 btrfstune.c = misc/btrfstune.c |0 convert.c = misc/convert.c |0 debug-tree.c = misc/debug-tree.c |0 mkfs.c = misc/mkfs.c |0 version.sh = misc/version.sh |0 tests/Makefile | 88 +++ dir-test.c = tests/dir-test.c |0 hasher.c = tests/hasher.c |0 quick-test.c = tests/quick-test.c |0 random-test.c = tests/random-test.c|0 show-blocks = tests/show-blocks|0 54 files changed, 223 insertions(+), 63 deletions(-) create mode 100644 lib/Makefile rename bit-radix.c = lib/bit-radix.c (100%) rename bit-radix.h = lib/bit-radix.h (100%) rename crc32c.c = lib/crc32c.c (100%) rename crc32c.h = lib/crc32c.h (100%) rename ctree.c = lib/ctree.c (100%) rename ctree.h = lib/ctree.h (100%) rename dir-item.c = lib/dir-item.c (100%) rename disk-io.c = lib/disk-io.c (100%) rename disk-io.h = lib/disk-io.h (100%) rename extent-cache.c = lib/extent-cache.c (100%) rename extent-cache.h = lib/extent-cache.h (100%) rename extent-tree.c = lib/extent-tree.c (100%) rename extent_io.c = lib/extent_io.c (100%) rename extent_io.h = lib/extent_io.h (100%) rename file-item.c = lib/file-item.c (100%) rename hash.h = lib/hash.h (100%) rename inode-item.c = lib/inode-item.c (100%) rename inode-map.c = lib/inode-map.c (100%) rename ioctl.h = lib/ioctl.h (100%) rename kerncompat.h = lib/kerncompat.h (100%) rename list.h = lib/list.h (100%) rename print-tree.c = lib/print-tree.c (100%) rename print-tree.h = lib/print-tree.h (100%) rename radix-tree.c = lib/radix-tree.c (100%) rename radix-tree.h = lib/radix-tree.h (100%) rename rbtree.c = lib/rbtree.c (100%) rename rbtree.h = lib/rbtree.h (100%) rename root-tree.c = lib/root-tree.c (100%) rename transaction.h = lib/transaction.h (100%) rename utils.c = lib/utils.c (100%) rename utils.h = lib/utils.h (100%) rename volumes.c = lib/volumes.c (100%) rename volumes.h = lib/volumes.h (100%) create mode 100644 misc/Makefile rename bcp = misc/bcp (100%) mode change 100755 = 100644 rename btrfs-image.c = misc/btrfs-image.c (100%) rename btrfs-map-logical.c = misc/btrfs-map-logical.c (100%) rename btrfs-show.c = misc/btrfs-show.c (100%) rename btrfs-vol.c = misc/btrfs-vol.c (100%) rename btrfsck.c =
[PATCH 3/4] debug-btrfs: Add open file system command
Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- debugbtrfs/cmds.c | 23 + debugbtrfs/debug_btrfs.c | 16 +-- debugbtrfs/debug_btrfs.h |1 + debugbtrfs/debug_btrfs_cmds.ct |3 ++ debugbtrfs/debug_tree.c| 54 --- 5 files changed, 56 insertions(+), 41 deletions(-) diff --git a/debugbtrfs/cmds.c b/debugbtrfs/cmds.c index f5ed877..cd2901b 100644 --- a/debugbtrfs/cmds.c +++ b/debugbtrfs/cmds.c @@ -18,6 +18,11 @@ */ #include stdio.h +#include stdlib.h +#include string.h + +#include ctree.h +#include disk-io.h #include debug_btrfs.h void do_show_debugfs_params(int argc, char *argv[]) @@ -25,3 +30,21 @@ void do_show_debugfs_params(int argc, char *argv[]) FILE *out = stdout; fprintf(out, Filesystem in use: %s\n, current_device); } + +void do_open_filesys(int argc, char *argv[]) +{ + if (argc != 1) { + free((void *)current_device); + current_device = strdup(argv[1]); + } + + if (current_fs_root) + close_ctree(current_fs_root); + + radix_tree_init(); + current_fs_root = open_ctree(current_device, 0, 0); + if (!current_fs_root) { + fprintf(stderr, unable to open %s\n, current_device); + return; + } +} diff --git a/debugbtrfs/debug_btrfs.c b/debugbtrfs/debug_btrfs.c index 44d6f64..d9f10e9 100644 --- a/debugbtrfs/debug_btrfs.c +++ b/debugbtrfs/debug_btrfs.c @@ -19,27 +19,25 @@ #include stdio.h #include stdlib.h +#include string.h #include ss/ss.h #include debug_btrfs.h extern ss_request_table btrfs_debug_cmds; const char *current_device; - -void usage(char *prg) -{ - fprintf(stderr, Usage: %s device\n, prg); - exit(1); -} +struct btrfs_root *current_fs_root; +extern void do_open_filesys(int argc, char *argv[]); int main(int argc, char *argv[]) { int sci_idx; int retval; - if (argc 2) - usage(argv[0]); + if (argc != 1) { + /* open the file system */ + do_open_filesys(argc, argv); + } - current_device = argv[1]; sci_idx = ss_create_invocation(debug-btrfs, 0.0, NULL, btrfs_debug_cmds, retval); if (retval) { diff --git a/debugbtrfs/debug_btrfs.h b/debugbtrfs/debug_btrfs.h index 55d7b17..1ea4fb2 100644 --- a/debugbtrfs/debug_btrfs.h +++ b/debugbtrfs/debug_btrfs.h @@ -22,6 +22,7 @@ #include getopt.h extern const char *current_device; +extern struct btrfs_root *current_fs_root; static inline void reset_getopt(void) { optind = 0; diff --git a/debugbtrfs/debug_btrfs_cmds.ct b/debugbtrfs/debug_btrfs_cmds.ct index bd2e479..a46dbde 100644 --- a/debugbtrfs/debug_btrfs_cmds.ct +++ b/debugbtrfs/debug_btrfs_cmds.ct @@ -20,6 +20,9 @@ command_table btrfs_debug_cmds; request do_show_debugfs_params, Show btrfs_debug parameters, show_debugfs_params, params; +request do_open_filesys, Open the file system, + open_filesys, open; + request do_dump_tree, Show full btrfs tree, dump_tree; diff --git a/debugbtrfs/debug_tree.c b/debugbtrfs/debug_tree.c index 1a1e5e2..820549d 100644 --- a/debugbtrfs/debug_tree.c +++ b/debugbtrfs/debug_tree.c @@ -35,36 +35,28 @@ static void print_dump_tree_usage(void) void do_dump_root_tree(int argc, char *argv[]) { - struct btrfs_root *root; - - radix_tree_init(); - root = open_ctree(current_device, 0, 0); - if (!root) { - fprintf(stderr, unable to open %s\n, current_device); + if (!current_fs_root) { + fprintf(stderr, File system not yet opened: %s\n, current_device); return; } printf(root tree\n); - btrfs_print_tree(root-fs_info-tree_root, -root-fs_info-tree_root-node); + btrfs_print_tree(current_fs_root-fs_info-tree_root, +current_fs_root-fs_info-tree_root-node); } void do_dump_chunk_tree(int argc, char *argv[]) { - struct btrfs_root *root; - radix_tree_init(); - root = open_ctree(current_device, 0, 0); - if (!root) { - fprintf(stderr, unable to open %s\n, current_device); + if (!current_fs_root) { + fprintf(stderr, File system not yet opened: %s\n, current_device); return; } printf(chunk tree\n); - btrfs_print_tree(root-fs_info-chunk_root, -root-fs_info-chunk_root-node); + btrfs_print_tree(current_fs_root-fs_info-chunk_root, +current_fs_root-fs_info-chunk_root-node); } void do_dump_tree(int argc, char *argv[]) { - struct btrfs_root *root; struct btrfs_path path; struct btrfs_key key; struct btrfs_root_item ri; @@ -77,7 +69,6 @@ void do_dump_tree(int argc, char *argv[]) int extent_only =
[PATCH 2/4] btrfs-progs: Add debug-btrfs command
Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- Makefile |3 + debugbtrfs/Makefile| 44 +++ debugbtrfs/cmds.c | 27 + debugbtrfs/debug_btrfs.c | 59 ++ debugbtrfs/debug_btrfs.h | 29 + debugbtrfs/debug_btrfs_cmds.ct | 33 ++ debugbtrfs/debug_tree.c| 243 7 files changed, 438 insertions(+), 0 deletions(-) create mode 100644 debugbtrfs/Makefile create mode 100644 debugbtrfs/cmds.c create mode 100644 debugbtrfs/debug_btrfs.c create mode 100644 debugbtrfs/debug_btrfs.h create mode 100644 debugbtrfs/debug_btrfs_cmds.ct create mode 100644 debugbtrfs/debug_tree.c diff --git a/Makefile b/Makefile index a30c212..3efd405 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,9 @@ bindir = $(prefix)/bin LIBS=-luuid SUBDIRS=lib misc man +ifneq ($(E2FSPRGS_BUILD_DIR),) + SUBDIRS += debugbtrfs +endif # make C=1 to enable sparse ifdef C diff --git a/debugbtrfs/Makefile b/debugbtrfs/Makefile new file mode 100644 index 000..d9d3720 --- /dev/null +++ b/debugbtrfs/Makefile @@ -0,0 +1,44 @@ +CC=gcc +AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 +CFLAGS = -g -Werror -Os -I$(E2FSPRGS_BUILD_DIR)/lib/ -I../lib/ + +# +CHECKFLAGS=-D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise \ + -Wuninitialized -Wshadow -Wundef +DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@ + +INSTALL= install +prefix ?= /usr/local +bindir = $(prefix)/bin +LIBS=-L$(E2FSPRGS_BUILD_DIR)/lib/ss -lss -ldl -lcom_err -luuid +TOPDIR=../ + +MK_CMDS= _SS_DIR_OVERRIDE=$(E2FSPRGS_BUILD_DIR)/lib/ss $(E2FSPRGS_BUILD_DIR)/lib/ss/mk_cmds + +progs = debug-btrfs + +# make C=1 to enable sparse +ifdef C + check=sparse $(CHECKFLAGS) +else + check=ls +endif + +.c.o: + $(check) $ + $(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $ + +all: $(progs) + +debug_btrfs_cmds.c: debug_btrfs_cmds.ct + $(MK_CMDS) debug_btrfs_cmds.ct + +debug-btrfs: $(TOPDIR)/lib/libbtrfs.a debug_btrfs.o cmds.o debug_btrfs_cmds.o debug_tree.o + $(CC) $(CFLAGS) -o debug-btrfs debug_btrfs.o cmds.o debug_btrfs_cmds.o debug_tree.o $(TOPDIR)/lib/libbtrfs.a $(LDFLAGS) $(LIBS) + +clean: + rm -f *.o debug_btrfs_cmds.c + rm -f .*.d + rm -f debug-btrfs + +-include .*.d diff --git a/debugbtrfs/cmds.c b/debugbtrfs/cmds.c new file mode 100644 index 000..f5ed877 --- /dev/null +++ b/debugbtrfs/cmds.c @@ -0,0 +1,27 @@ +/* + * Copyright IBM Corporation, 2010 + * Author Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + */ + +#include stdio.h +#include debug_btrfs.h + +void do_show_debugfs_params(int argc, char *argv[]) +{ +FILE *out = stdout; +fprintf(out, Filesystem in use: %s\n, current_device); +} diff --git a/debugbtrfs/debug_btrfs.c b/debugbtrfs/debug_btrfs.c new file mode 100644 index 000..44d6f64 --- /dev/null +++ b/debugbtrfs/debug_btrfs.c @@ -0,0 +1,59 @@ +/* + * Copyright IBM Corporation, 2010 + * Author Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + */ + +#include stdio.h +#include stdlib.h +#include ss/ss.h +#include debug_btrfs.h + +extern ss_request_table btrfs_debug_cmds; +const char *current_device; + +void usage(char *prg) +{ + fprintf(stderr, Usage: %s device\n, prg); + exit(1); +} + +int main(int argc, char *argv[]) +{ + int sci_idx; + int retval; + + if (argc 2) + usage(argv[0]); + + current_device = argv[1]; + sci_idx = ss_create_invocation(debug-btrfs, 0.0, NULL, + btrfs_debug_cmds, retval); + if (retval) { +
Re: panic during rebalance, and now upon mount
Yan, Zheng wrote: Please try the patch attached below. It should solve the bug during mounting that fs. But I don't know why there are so many link count errors in that fs. How old is that fs? what was that fs used for? Thank you very much. Yan, Zheng Good, so far. Thanks! The filesystem is less than 2 weeks old, created and managed exclusively with the unstable tools Btrfs v0.19-4-gab8fb4c-dirty I created the filesystem -d raid1 -m raid1. There are 14 dm-crypt mappings corresponding to 14 partitions on 14 drives. There's one filesystem made up from these devices with about 14 TB of space (a mixture of devices ranging from 500GB to 2TB) The filesystem is used for incremental backup from remote computers using rsync. The filesystem tree is as follows / /machine1 - normal directory /machine1/machine1 - a subvolume /machine1/machine1-20100120-1220 - a snapshot of the subvolume above ... /machine1/machine1-20100131-1220 - more snapshots of the subvolume above /machine2 - normal directory /machine2/machine1 - a subvolume /machine2/machine2-20100120-1020 - a snapshot of the subvolume above ... /machine2/machine2-20100131-1020 - more snapshots of the subvolume above ... The files are backed up with `rsync -aH --inplace` onto the subvolume for each machine. The only oddness I can think of is that during initial testing of this filesystem, I yanked a drive physically from the machine while it was writing. btrfs seemed to continue to try to write to the inaccessible device, and indeed, btrfs-show showed the used space on the missing drive increasing over time. Also, I was unable to remove the drive from the volume (ioctl returned -1), so it was in this state until I rebooted a couple hours later. I then did a btrfs-vol -r missing on the drive, and then added it back in as a new device. I did btrfs-vol -b which succeeded once. After adding more drives, I did btrfs-vol -b again, and that left me in the state where this thread began. As I understand it, a btrfs-vol -b is currently one of the only ways to reduplicate unmirrored chunks after a drive failure. (aside from rewriting the data or removing and readding devices). Is my understanding correct? Thanks -- Troy -- 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] btrfs: Fix oopsen when dropping empty tree.
When dropping a empty tree, walk_down_tree() skips checking extent information for the tree root. This will triggers a BUG_ON in walk_up_proc(). Signed-off-by: Yan Zheng zheng@oracle.com --- diff -urp 1/fs/btrfs/extent-tree.c 2/fs/btrfs/extent-tree.c --- 1/fs/btrfs/extent-tree.c2010-01-22 12:16:34.203525744 +0800 +++ 2/fs/btrfs/extent-tree.c2010-02-01 10:26:19.865562007 +0800 @@ -5402,10 +5402,6 @@ static noinline int walk_down_tree(struc int ret; while (level = 0) { - if (path-slots[level] = - btrfs_header_nritems(path-nodes[level])) - break; - ret = walk_down_proc(trans, root, path, wc, lookup_info); if (ret 0) break; @@ -5413,6 +5409,10 @@ static noinline int walk_down_tree(struc if (level == 0) break; + if (path-slots[level] = + btrfs_header_nritems(path-nodes[level])) + break; + ret = do_walk_down(trans, root, path, wc, lookup_info); if (ret 0) { path-slots[level]++; -- 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] btrfsck: Remove superfluous WARN_ON
Signed-off-by: Yan Zheng zheng@oracle.com --- diff -urp btrfs-progs-unstable/btrfsck.c btrfs-progs-2/btrfsck.c --- btrfs-progs-unstable/btrfsck.c 2009-09-28 15:54:55.980479398 +0800 +++ btrfs-progs-2/btrfsck.c 2010-01-31 09:46:24.645485459 +0800 @@ -581,7 +581,6 @@ again: } ret = insert_existing_cache_extent(dst, ins-cache); if (ret == -EEXIST) { - WARN_ON(src == src_node-root_cache); conflict = get_inode_rec(dst, rec-ino, 1); merge_inode_recs(rec, conflict, dst); if (rec-checked) { -- 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: panic during rebalance, and now upon mount
On Mon, Feb 1, 2010 at 3:33 AM, Troy Ablan tab...@gmail.com wrote: Yan, Zheng wrote: Please try the patch attached below. It should solve the bug during mounting that fs. But I don't know why there are so many link count errors in that fs. How old is that fs? what was that fs used for? Thank you very much. Yan, Zheng Good, so far. Thanks! The filesystem is less than 2 weeks old, created and managed exclusively with the unstable tools Btrfs v0.19-4-gab8fb4c-dirty I created the filesystem -d raid1 -m raid1. There are 14 dm-crypt mappings corresponding to 14 partitions on 14 drives. There's one filesystem made up from these devices with about 14 TB of space (a mixture of devices ranging from 500GB to 2TB) The filesystem is used for incremental backup from remote computers using rsync. The filesystem tree is as follows / /machine1 - normal directory /machine1/machine1 - a subvolume /machine1/machine1-20100120-1220 - a snapshot of the subvolume above /machine1/machine1-20100131-1220 - more snapshots of the subvolume above /machine2 - normal directory /machine2/machine1 - a subvolume /machine2/machine2-20100120-1020 - a snapshot of the subvolume above /machine2/machine2-20100131-1020 - more snapshots of the subvolume above The files are backed up with `rsync -aH --inplace` onto the subvolume for each machine. The only oddness I can think of is that during initial testing of this filesystem, I yanked a drive physically from the machine while it was writing. btrfs seemed to continue to try to write to the inaccessible device, and indeed, btrfs-show showed the used space on the missing drive increasing over time. Also, I was unable to remove the drive from the volume (ioctl returned -1), so it was in this state until I rebooted a couple hours later. I then did a btrfs-vol -r missing on the drive, and then added it back in as a new device. I did btrfs-vol -b which succeeded once. After adding more drives, I did btrfs-vol -b again, and that left me in the state where this thread began. As I understand it, a btrfs-vol -b is currently one of the only ways to reduplicate unmirrored chunks after a drive failure. (aside from rewriting the data or removing and readding devices). Is my understanding correct? Yes, Thanks again for helping debug. Yan, Zheng -- 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 5/6] debug-btrfs: Add command to dump each of the btrfs trees
Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- debugbtrfs/debug_btrfs_cmds.ct | 19 - debugbtrfs/debug_tree.c| 159 --- 2 files changed, 99 insertions(+), 79 deletions(-) diff --git a/debugbtrfs/debug_btrfs_cmds.ct b/debugbtrfs/debug_btrfs_cmds.ct index 98a7282..6b22bc1 100644 --- a/debugbtrfs/debug_btrfs_cmds.ct +++ b/debugbtrfs/debug_btrfs_cmds.ct @@ -23,17 +23,32 @@ request do_show_debugfs_params, Show btrfs_debug parameters, request do_open_filesys, Open the file system, open_filesys, open; +request do_print_inode, Print inode details, + print_inode; + request do_dump_tree, Show full btrfs tree, dump_tree; +request do_dump_extent_tree, Show Extent tree, + dump_extent_tree; + request do_dump_root_tree, Show root tree, dump_root_tree; request do_dump_chunk_tree, Show btrfs chunk tree, dump_chunk_tree; -request do_print_inode, Print inode details, - print_inode; +request do_dump_dev_tree, Show btrfs dev tree, + dump_dev_tree; + +request do_dump_fs_tree, Show btrfs fs tree, + dump_fs_tree; + +request do_dump_csum_tree, Show btrfs checksum tree, + dump_csum_tree; + +request do_dump_log_tree, Show btrfs log tree, + dump_log_tree; end; diff --git a/debugbtrfs/debug_tree.c b/debugbtrfs/debug_tree.c index 820549d..e92d6d0 100644 --- a/debugbtrfs/debug_tree.c +++ b/debugbtrfs/debug_tree.c @@ -28,9 +28,15 @@ #include transaction.h #include debug_btrfs.h -static void print_dump_tree_usage(void) +void do_dump_extent_tree(int argc, char *argv[]) { - fprintf(stderr, usage: dump-tree [ -e ] \n); + if (!current_fs_root) { + fprintf(stderr, File system not yet opened: %s\n, current_device); + return; + } + printf(Extent tree\n); + btrfs_print_tree(current_fs_root-fs_info-extent_root, +current_fs_root-fs_info-extent_root-node); } void do_dump_root_tree(int argc, char *argv[]) @@ -55,6 +61,54 @@ void do_dump_chunk_tree(int argc, char *argv[]) current_fs_root-fs_info-chunk_root-node); } +void do_dump_dev_tree(int argc, char *argv[]) +{ + if (!current_fs_root) { + fprintf(stderr, File system not yet opened: %s\n, current_device); + return; + } + printf(Device tree\n); + btrfs_print_tree(current_fs_root-fs_info-dev_root, +current_fs_root-fs_info-dev_root-node); +} + +void do_dump_fs_tree(int argc, char *argv[]) +{ + if (!current_fs_root) { + fprintf(stderr, File system not yet opened: %s\n, current_device); + return; + } + printf(FS tree\n); + btrfs_print_tree(current_fs_root-fs_info-fs_root, +current_fs_root-fs_info-fs_root-node); +} + +void do_dump_csum_tree(int argc, char *argv[]) +{ + if (!current_fs_root) { + fprintf(stderr, File system not yet opened: %s\n, current_device); + return; + } + printf(Checksum tree\n); + btrfs_print_tree(current_fs_root-fs_info-csum_root, +current_fs_root-fs_info-csum_root-node); +} + +void do_dump_log_tree(int argc, char *argv[]) +{ + if (!current_fs_root) { + fprintf(stderr, File system not yet opened: %s\n, current_device); + return; + } + printf(Log tree\n); + if (!current_fs_root-fs_info-log_root_tree) { + printf(Nothing to replay \n); + return; + } + btrfs_print_tree(current_fs_root-fs_info-log_root_tree, +current_fs_root-fs_info-log_root_tree-node); +} + void do_dump_tree(int argc, char *argv[]) { struct btrfs_path path; @@ -66,38 +120,20 @@ void do_dump_tree(int argc, char *argv[]) char uuidbuf[37]; int ret; int slot; - int extent_only = 0; struct btrfs_root *tree_root_scan; - reset_getopt(); - while(1) { - int c; - c = getopt(argc, argv, e); - if (c 0) - break; - switch(c) { - case 'e': - extent_only = 1; - break; - default: - print_dump_tree_usage(); - return; - } - } - if (!current_fs_root) { fprintf(stderr, File system not yet opened: %s\n, current_device); return; } - if (!extent_only) { - printf(root tree\n); - btrfs_print_tree(current_fs_root-fs_info-tree_root, + printf(root tree\n); + btrfs_print_tree(current_fs_root-fs_info-tree_root,
[PATCH 6/6] debug-btrfs: Add pager support
Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- debugbtrfs/Makefile |5 +- debugbtrfs/debug_btrfs.h |3 + debugbtrfs/debug_tree.c | 106 debugbtrfs/pager.c | 49 + lib/ctree.c | 22 ++-- lib/extent-tree.c| 10 +- lib/print-tree.c | 256 +++--- lib/print-tree.h |8 +- lib/root-tree.c | 11 +- misc/debug-tree.c|8 +- 10 files changed, 278 insertions(+), 200 deletions(-) create mode 100644 debugbtrfs/pager.c diff --git a/debugbtrfs/Makefile b/debugbtrfs/Makefile index d9d3720..8a7163c 100644 --- a/debugbtrfs/Makefile +++ b/debugbtrfs/Makefile @@ -33,8 +33,9 @@ all: $(progs) debug_btrfs_cmds.c: debug_btrfs_cmds.ct $(MK_CMDS) debug_btrfs_cmds.ct -debug-btrfs: $(TOPDIR)/lib/libbtrfs.a debug_btrfs.o cmds.o debug_btrfs_cmds.o debug_tree.o - $(CC) $(CFLAGS) -o debug-btrfs debug_btrfs.o cmds.o debug_btrfs_cmds.o debug_tree.o $(TOPDIR)/lib/libbtrfs.a $(LDFLAGS) $(LIBS) +debug-btrfs: $(TOPDIR)/lib/libbtrfs.a debug_btrfs.o cmds.o debug_btrfs_cmds.o debug_tree.o pager.o + $(CC) $(CFLAGS) -o debug-btrfs debug_btrfs.o cmds.o debug_btrfs_cmds.o debug_tree.o \ + pager.o $(TOPDIR)/lib/libbtrfs.a $(LDFLAGS) $(LIBS) clean: rm -f *.o debug_btrfs_cmds.c diff --git a/debugbtrfs/debug_btrfs.h b/debugbtrfs/debug_btrfs.h index 1ea4fb2..7f3b4b9 100644 --- a/debugbtrfs/debug_btrfs.h +++ b/debugbtrfs/debug_btrfs.h @@ -19,6 +19,7 @@ #ifndef DEBUG_BTRFS_H #define DEBUG_BTRFS_H +#include stdio.h #include getopt.h extern const char *current_device; @@ -27,4 +28,6 @@ static inline void reset_getopt(void) { optind = 0; } +extern FILE *open_pager(void); +extern void close_pager(FILE *); #endif diff --git a/debugbtrfs/debug_tree.c b/debugbtrfs/debug_tree.c index e92d6d0..f740b06 100644 --- a/debugbtrfs/debug_tree.c +++ b/debugbtrfs/debug_tree.c @@ -30,87 +30,109 @@ void do_dump_extent_tree(int argc, char *argv[]) { + FILE *fp; if (!current_fs_root) { fprintf(stderr, File system not yet opened: %s\n, current_device); return; } - printf(Extent tree\n); - btrfs_print_tree(current_fs_root-fs_info-extent_root, + fp = open_pager(); + fprintf(fp, Extent tree\n); + btrfs_print_tree(fp, current_fs_root-fs_info-extent_root, current_fs_root-fs_info-extent_root-node); + close_pager(fp); } void do_dump_root_tree(int argc, char *argv[]) { + FILE *fp; if (!current_fs_root) { fprintf(stderr, File system not yet opened: %s\n, current_device); return; } - printf(root tree\n); - btrfs_print_tree(current_fs_root-fs_info-tree_root, + fp = open_pager(); + fprintf(fp, root tree\n); + btrfs_print_tree(fp, current_fs_root-fs_info-tree_root, current_fs_root-fs_info-tree_root-node); + close_pager(fp); } void do_dump_chunk_tree(int argc, char *argv[]) { + FILE *fp; if (!current_fs_root) { fprintf(stderr, File system not yet opened: %s\n, current_device); return; } - printf(chunk tree\n); - btrfs_print_tree(current_fs_root-fs_info-chunk_root, + fp = open_pager(); + fprintf(fp, chunk tree\n); + btrfs_print_tree(fp, current_fs_root-fs_info-chunk_root, current_fs_root-fs_info-chunk_root-node); + close_pager(fp); } void do_dump_dev_tree(int argc, char *argv[]) { + FILE *fp; if (!current_fs_root) { fprintf(stderr, File system not yet opened: %s\n, current_device); return; } - printf(Device tree\n); - btrfs_print_tree(current_fs_root-fs_info-dev_root, + fp = open_pager(); + fprintf(fp, Device tree\n); + btrfs_print_tree(fp, current_fs_root-fs_info-dev_root, current_fs_root-fs_info-dev_root-node); + close_pager(fp); } void do_dump_fs_tree(int argc, char *argv[]) { + FILE *fp; if (!current_fs_root) { fprintf(stderr, File system not yet opened: %s\n, current_device); return; } - printf(FS tree\n); - btrfs_print_tree(current_fs_root-fs_info-fs_root, + fp = open_pager(); + fprintf(fp, FS tree\n); + btrfs_print_tree(fp, current_fs_root-fs_info-fs_root, current_fs_root-fs_info-fs_root-node); + close_pager(fp); } void do_dump_csum_tree(int argc, char *argv[]) { + FILE *fp; if (!current_fs_root) { fprintf(stderr, File system not yet opened: %s\n, current_device); return; } - printf(Checksum tree\n); -