Re: device delete, error removing device

2012-10-23 Thread Michael Kjörling
On 22 Oct 2012 18:18 +0100, from h...@carfax.org.uk (Hugo Mills): [root@f18v ~]# btrfs device delete /dev/sdb /mnt [root@f18v ~]# btrfs fi show failed to read /dev/sr0 Label: none uuid: 6e96a96e-3357-4f23-b064-0f0713366d45 Total devices 5 FS bytes used 7.52GB devid5 size

[PATCH] [btrfs-progs] Modify parse_size to remove the strdup/free

2012-10-23 Thread Rock Lee
Since the function atoi(l) series stop at the first non numeric chars, So there's no need to strdup the original s and modify s[len-1] = '\0' Signed-off-by: Rock Lee zim...@code-trick.com --- mkfs.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/mkfs.c b/mkfs.c

[PATCH] Btrfs-progs: fix resolving of loop devices

2012-10-23 Thread Hector Oron
From: Nirbheek Chauhan nirbheek.chauhan at collabora.co.uk If the path to a given loopback file is longer than 64 characters, none of the Btrfs-progs tools can use it. This is because the size of loopinfo.lo_name returned by the LOOP_GET_STATUS ioctl is 64. The attached patch fixes this by

[PATCH 2/6] Btrfs: fix a tree mod logging issue for root replacement operations

2012-10-23 Thread Jan Schmidt
Avoid the implicit free by tree_mod_log_set_root_pointer, which is wrong in two places. Where needed, we call tree_mod_log_free_eb explicitly now. Signed-off-by: Jan Schmidt list.bt...@jan-o-sch.net --- fs/btrfs/ctree.c | 10 ++ 1 files changed, 2 insertions(+), 8 deletions(-) diff

[PATCH 3/6] Btrfs: tree mod log's old roots could still be part of the tree

2012-10-23 Thread Jan Schmidt
Tree mod log treated old root buffers as always empty buffers when starting the rewind operations. However, the old root may still be part of the current tree at a lower level, with still some valid entries. Signed-off-by: Jan Schmidt list.bt...@jan-o-sch.net --- fs/btrfs/ctree.c | 16

[PATCH 1/6] Btrfs: don't put removals from push_node_left into tree mod log twice

2012-10-23 Thread Jan Schmidt
Independant of the check (push_items src_items) tree_mod_log_eb_copy did log the removal of the old data entries from the source buffer. Therefore, we must not call tree_mod_log_eb_move if the check evaluates to true, as that would log the removal twice, finally resulting in (rewinded) buffers

[PATCH 5/6] Btrfs: fix extent buffer reference for tree mod log roots

2012-10-23 Thread Jan Schmidt
In get_old_root we grab a lock on the extent buffer before we obtain a reference on that buffer. That order is changed now. Signed-off-by: Jan Schmidt list.bt...@jan-o-sch.net --- fs/btrfs/ctree.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/ctree.c

[PATCH 0/6] Btrfs: tree mod log fixes for 3.7-rc3

2012-10-23 Thread Jan Schmidt
Hi Chris, I've got 5 small fixes for the tree mod log and a comment fix, here. Each of them is making the overall situation a little better. I'm not sure whether these also fix the problems liubo was seeing, we're still sorting that out. So there's probably one more fix to come, but if so, I

Re: RAID 5/6

2012-10-23 Thread Michael
This is one of those features that I have been waiting for since I signed up for the mailing list last year. What source tree is that code contained in? I would like to start testing it out and helping out with bug reports(I am only going to use it in a testing VM, nothing important to work at

Re: [PATCH 1/6] Btrfs: don't put removals from push_node_left into tree mod log twice

2012-10-23 Thread Liu Bo
On 10/23/2012 09:55 PM, Jan Schmidt wrote: Independant of the check (push_items src_items) tree_mod_log_eb_copy did log the removal of the old data entries from the source buffer. Therefore, we must not call tree_mod_log_eb_move if the check evaluates to true, as that would log the removal

Re: [PATCH 3/6] Btrfs: tree mod log's old roots could still be part of the tree

2012-10-23 Thread Liu Bo
On 10/23/2012 09:55 PM, Jan Schmidt wrote: Tree mod log treated old root buffers as always empty buffers when starting the rewind operations. However, the old root may still be part of the current tree at a lower level, with still some valid entries. Reviewed-by: Liu Bo bo.li@oracle.com

Re: [PATCH 4/6] Btrfs: determine level of old roots

2012-10-23 Thread Liu Bo
On 10/23/2012 09:55 PM, Jan Schmidt wrote: In btrfs_find_all_roots' termination condition, we compare the level of the old buffer we got from btrfs_search_old_slot to the level of the current root node. We'd better compare it to the level of the rewinded root node. Reviewed-by: Liu Bo

Re: [PATCH 6/6] Btrfs: comment for loop in tree_mod_log_insert_move

2012-10-23 Thread Liu Bo
On 10/23/2012 09:55 PM, Jan Schmidt wrote: Emphasis the way tree_mod_log_insert_move avoids adding MOD_LOG_KEY_REMOVE_WHILE_MOVING operations, depending on the direction of the move operation. Good work. Reviewed-by: Liu Bo bo.li@oracle.com thanks, liubo Signed-off-by: Jan Schmidt

Re: [PATCH 2/6] Btrfs: fix a tree mod logging issue for root replacement operations

2012-10-23 Thread Jan Schmidt
On Tue, October 23, 2012 at 17:28 (+0200), Liu Bo wrote: On 10/23/2012 09:55 PM, Jan Schmidt wrote: Avoid the implicit free by tree_mod_log_set_root_pointer, which is wrong in two places. Where needed, we call tree_mod_log_free_eb explicitly now. Signed-off-by: Jan Schmidt

Re: [PATCH 2/6] Btrfs: fix a tree mod logging issue for root replacement operations

2012-10-23 Thread Liu Bo
On 10/23/2012 09:55 PM, Jan Schmidt wrote: Avoid the implicit free by tree_mod_log_set_root_pointer, which is wrong in two places. Where needed, we call tree_mod_log_free_eb explicitly now. Signed-off-by: Jan Schmidt list.bt...@jan-o-sch.net --- fs/btrfs/ctree.c | 10 ++ 1 files

Re: [PATCH 5/6] Btrfs: fix extent buffer reference for tree mod log roots

2012-10-23 Thread Liu Bo
On 10/23/2012 09:55 PM, Jan Schmidt wrote: In get_old_root we grab a lock on the extent buffer before we obtain a reference on that buffer. That order is changed now. Reviewed-by: Liu Bo bo.li@oracle.com thanks, liubo Signed-off-by: Jan Schmidt list.bt...@jan-o-sch.net ---

[PATCH][BTRFS-PROGS][V2] Update to parse_size()

2012-10-23 Thread Goffredo Baroncelli
Hi all, the following patches attempt to address some issues to the function parse_size(): - this function is defined both in mkfs.c and cmds-filesystem.c; I moved it in utils.c (which is already used in both mkfs.btrfs and btrfs) in order to avoid code duplication. - it used the function

[PATCH 2/5] parse_size(): replace atoll() with strtoull()

2012-10-23 Thread Goffredo Baroncelli
From: Goffredo Baroncelli kreij...@inwind.it Replace the function atoll with strtoull() --- utils.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.c b/utils.c index 705be7b..732c782 100644 --- a/utils.c +++ b/utils.c @@ -1243,6 +1243,6 @@ u64 parse_size(char *s)

[PATCH 5/5] Update the man page with the new prefixes.

2012-10-23 Thread Goffredo Baroncelli
From: Goffredo Baroncelli kreij...@inwind.it --- man/btrfs.8.in |3 +++ man/mkfs.btrfs.8.in |3 +++ 2 files changed, 6 insertions(+) diff --git a/man/btrfs.8.in b/man/btrfs.8.in index 9222580..33bd78d 100644 --- a/man/btrfs.8.in +++ b/man/btrfs.8.in @@ -184,6 +184,9 @@ defragment

[PATCH 4/5] parse_size(): add new suffixes

2012-10-23 Thread Goffredo Baroncelli
From: Goffredo Baroncelli kreij...@inwind.it Add new suffixes in parse_size() function. New suffixes are: T as terabyte, P as petabyte, E as exabyte. Note these units are multiply of 2 . --- utils.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/utils.c b/utils.c index

[PATCH 3/5] parse_size(): check for invalid suffix

2012-10-23 Thread Goffredo Baroncelli
From: Goffredo Baroncelli kreij...@inwind.it Check that the suffix for the parse_size() input is of only one character. --- utils.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/utils.c b/utils.c index 732c782..e61cdea 100644 --- a/utils.c +++

[PATCH 1/5] Move parse_size() to utils.[hc]

2012-10-23 Thread Goffredo Baroncelli
From: Goffredo Baroncelli kreij...@inwind.it Move the function from cmds-filesystem.c and mkfs.c to utils.c --- cmds-filesystem.c | 26 -- mkfs.c| 31 --- utils.c | 26 ++ utils.h |

Re: device delete, error removing device

2012-10-23 Thread Goffredo Baroncelli
On 2012-10-23 09:57, Michael Kjörling wrote: On 22 Oct 2012 18:18 +0100, from h...@carfax.org.uk (Hugo Mills): [root@f18v ~]# btrfs device delete /dev/sdb /mnt [root@f18v ~]# btrfs fi show failed to read /dev/sr0 Label: none uuid: 6e96a96e-3357-4f23-b064-0f0713366d45 Total devices 5 FS bytes

kernel BUG at fs/btrfs/extent_io.c:1901!

2012-10-23 Thread Lluís Batlle i Rossell
Hello, having troubles with a disk drive part of a raid1, I've hit that the repair code has to be run quite a lot... It seems that one hard disk fails writing when I resume the machine from suspend. On reboot, btrfs tries to repair all. In fact, btrfs reports all errors as corrected; I'm happy

Re: [PATCH][BTRFS-PROGS][V2] Update to parse_size()

2012-10-23 Thread Goffredo Baroncelli
Sorry the version is V1 and not V2 On Tue, Oct 23, 2012 at 7:51 PM, Goffredo Baroncelli kreij...@gmail.com wrote: Hi all, the following patches attempt to address some issues to the function parse_size(): - this function is defined both in mkfs.c and cmds-filesystem.c; I moved it in utils.c

Between single/dup and raid1/raid1

2012-10-23 Thread Lluís Batlle i Rossell
Hello, today I wanted to remove one drive from raid1, and people at #btrfs advised me to use '-dconvert=single' before 'btrfs device delete'. I thought of adding '-mconvert=dup' too, but the kernel does not let me do that. It looks like 'dup' is disallowed for an array of multiple devices. So,

Re: device delete, error removing device

2012-10-23 Thread Goffredo Baroncelli
On 2012-10-23 20:17, Chris Murphy wrote: On Oct 23, 2012, at 12:10 PM, Goffredo Baroncelli kreij...@gmail.com wrote: I think that what Chris [Murphy] was reported is a bug of the btrfs user space program (which is corrected in the latest git). Unfortunately we don't know which version Chris

Re: [PATCH] Btrfs-progs: add btrfs-show-super tool

2012-10-23 Thread Goffredo Baroncelli
Hi Stefan, On 2012-10-19 09:18, Stefan Behrens wrote: Just a small program to print the fields of a super block. Signed-off-by: Stefan Behrens sbehr...@giantdisaster.de --- [...] + + +static void print_usage(void) +{ + fprintf(stderr, usage: btrfs-show-super [-i super_mirror]

Questions about btrfs-convert code

2012-10-23 Thread Alex Lyakas
Greetings all, I am studying the conversion code, and maybe somebody can help me with these questions: # btrfs_make_block_groups() I see that this function uses some heuristics to create block groups for BTRFS_BLOCK_GROUP_METADATA and BTRFS_BLOCK_GROUP_DATA. Later, ext2 data blocks are mapped

Re: device delete, error removing device

2012-10-23 Thread Chris Murphy
On Oct 23, 2012, at 1:02 PM, Goffredo Baroncelli kreij...@inwind.it wrote: On 2012-10-23 20:17, Chris Murphy wrote: btrfs-progs-0.20.rc1.20121017git91d9eec-1.fc18.x86_64 Definitely this version contains my patch. Are you able to reproduce this bug (the missing device warning)? Yes.

Re: device delete, error removing device

2012-10-23 Thread Goffredo Baroncelli
Hi Chris, I was able to reproduce (partially) your behaviour. First I created 3 disk of 3GB. I formatted them, then I filled them with $ dd if=/dev/zero of=/mnt/btrfs1/bigfile bs=1M count=$((7*1024)) Then I got $ sudo /mnt/home-ghigo/btrfs/btrfs-progs/btrfs fi sh Label: 'test1' uuid:

Re: device delete, error removing device

2012-10-23 Thread Chris Murphy
On Oct 23, 2012, at 4:16 PM, Goffredo Baroncelli kreij...@inwind.it wrote: $ sudo /mnt/home-ghigo/btrfs/btrfs-progs/btrfs fi sh Label: 'test1' uuid: 7ba72d6f-d226-4e8c-9a9c-92a7fd89cd99 Total devices 4 FS bytes used 7.01GB devid4 size 12.00GB used 3.21GB path /dev/vdf

Re: Questions about mkfs -A option

2012-10-23 Thread Wang Sheng-Hui
On 2012年10月23日 01:49, Alex Lyakas wrote: Wang, I would say that zeroing is done to prevent from seeing some other superblock (besides btrfs) there. That make sense. Alex. But I still confused by the -A option? In mkfs, we always write the sb info into BTRFS_SUPER_INFO_OFFSET.

[BUG][BTRFS-PROGS] Fix Bug to corrupt the img file

2012-10-23 Thread Rock Lee
Fix Bug to corrupt the img file Reproduce steps: dd if=/dev/zero of=btrfs-small.img bs=1M count=1 ls -lh btrfs-small.img -rw-rw-r--. 1 rock rock 1.0M Oct 24 09:51 btrfs-small.img mkfs.btrfs btrfs-small.img -rw-rw-r--. 1 rock rock 2.0M Oct 24 09:53 btrfs-small.img Here you can see