[PATCH v2 0/3] btrfs-progs: prevent mkfs from aborting with small volume

2013-09-05 Thread Hidetoshi Seto
Here are 3 patches to avoid undesired aborts of mkfs.btrfs. These are based on top of Chris's btrfs-progs.git: git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git Thanks, H.Seto Hidetoshi Seto (3): btrfs-progs: error if device for mkfs is too small btrfs-progs:

[PATCH v2 1/3] btrfs-progs: error if device for mkfs is too small

2013-09-05 Thread Hidetoshi Seto
Eric pointed out that mkfs abort if specified volume is too small: # truncate --size=2m testfile # ./mkfs.btrfs testfile : SMALL VOLUME: forcing mixed metadata/data groups mkfs.btrfs: volumes.c:852: btrfs_alloc_chunk: Assertion `!(ret)' failed. Aborted (core dumped) As the first

[PATCH v2 2/3] btrfs-progs: error if device have no space to make primary chunks

2013-09-05 Thread Hidetoshi Seto
The previous patch works fine if the size of specified volume to mkfs is less than 4MB. However usually btrfs requires more than 4MB to work, and the minimum preferred size is depending on the raid setting etc. This patch let mkfs print error message if it cannot allocate one of chunks should be

[PATCH v2 3/3] btrfs-progs: calculate available blocks on device properly

2013-09-05 Thread Hidetoshi Seto
I found that mkfs.btrfs aborts when assigned multi volumes contain a small volume: # parted /dev/sdf p Model: LSI MegaRAID SAS RMB (scsi) Disk /dev/sdf: 72.8GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End SizeType File system Flags

Re: [PATCH 5/5] btrfs-progs:free strdup()s that are not freed

2013-09-05 Thread Stefan Behrens
On Thu, 5 Sep 2013 10:38:58 +0800, Gui Hecheng wrote: The strdup()s not freed are reported as memory leaks by valgrind. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- cmds-subvolume.c | 48 ++-- 1 file changed, 34 insertions(+), 14

Re: [PATCH 5/5] btrfs-progs:free strdup()s that are not freed

2013-09-05 Thread Stefan Behrens
On Thu, 05 Sep 2013 09:00:07 +0200, Stefan Behrens wrote: On Thu, 5 Sep 2013 10:38:58 +0800, Gui Hecheng wrote: The strdup()s not freed are reported as memory leaks by valgrind. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- cmds-subvolume.c | 48

Re: [PATCH 18/20] Btrfs-progs: fix magic return value in cmds-balance.c

2013-09-05 Thread Wang Shilong
Hi Illya, On 09/05/2013 12:26 AM, Ilya Dryomov wrote: Hi Wang, Thank you for doing the grunt work, it's been a long standing todo. See the comments below. On Wed, Sep 4, 2013 at 6:22 PM, Wang Shilong wangshilong1...@gmail.com wrote: From: Wang Shilong wangsl.f...@cn.fujitsu.com If there is

[PATCH V3 5/5] btrfs-progs:free strdup()s that are not freed

2013-09-05 Thread Gui Hecheng
The strdup()s not freed are reported as memory leaks by valgrind. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- Changelog V1 - V2: - remove the if decision before free() Changelog V2 - V3: - correct confusing subject and add changelog --- cmds-subvolume.c | 40

Re: [PATCH 5/5] btrfs-progs:free strdup()s that are not freed

2013-09-05 Thread Gui Hecheng
On Thu, 2013-09-05 at 09:10 +0200, Stefan Behrens wrote: On Thu, 05 Sep 2013 09:00:07 +0200, Stefan Behrens wrote: On Thu, 5 Sep 2013 10:38:58 +0800, Gui Hecheng wrote: The strdup()s not freed are reported as memory leaks by valgrind. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com

Re: [PATCH 5/5] btrfs-progs:free strdup()s that are not freed

2013-09-05 Thread Wang Shilong
On 09/05/2013 04:08 PM, Gui Hecheng wrote: On Thu, 2013-09-05 at 09:10 +0200, Stefan Behrens wrote: On Thu, 05 Sep 2013 09:00:07 +0200, Stefan Behrens wrote: On Thu, 5 Sep 2013 10:38:58 +0800, Gui Hecheng wrote: The strdup()s not freed are reported as memory leaks by valgrind. Signed-off-by:

Re: [PATCH 18/20] Btrfs-progs: fix magic return value in cmds-balance.c

2013-09-05 Thread Stefan Behrens
On Thu, 05 Sep 2013 15:44:11 +0800, Wang Shilong wrote: [..] @@ -297,9 +305,10 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args, DIR *dirstream = NULL; fd = open_file_or_dir(path, dirstream); + e = errno; if (fd 0) {

Re: [PATCH 18/20] Btrfs-progs: fix magic return value in cmds-balance.c

2013-09-05 Thread Wang Shilong
On 09/05/2013 04:21 PM, Stefan Behrens wrote: On Thu, 05 Sep 2013 15:44:11 +0800, Wang Shilong wrote: [..] @@ -297,9 +305,10 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args, DIR *dirstream = NULL; fd = open_file_or_dir(path, dirstream); +

Re: [PATCH 00/20] fix magic return value in btrfs-progs

2013-09-05 Thread Wang Shilong
On 09/05/2013 10:14 AM, Anand Jain wrote: On 09/04/2013 11:22 PM, Wang Shilong wrote: This patchset tries to fix all the magic return value in btrfs-progs. Most commands will have three kinds of return value: 0 success 1 usage of syntax errors Exceptions come from balance/scrub/replace. For

Re: [PATCH 3/3] Btrfs: fix several potential problems in copy_nocow_pages_for_inode

2013-09-05 Thread Stefan Behrens
On Thu, 27 Jun 2013 18:51:00 +0800, Miao Xie wrote: - It makes no sense that we deal with a inode in the dead tree. This caused that the replace procedure was not dealing with free space cache entries anymore (which have btrfs_root_refs() == 0). I accidentally fixed it as a side-effect of

btrfs-convert won't convert ext* - No valid Btrfs found on /dev/sdb1

2013-09-05 Thread Тимофей Титовец
Hello guys, i try to convert ext4 volume, but btrfs-convert show me error: No valid Btrfs found on file unable to open ctree conversion aborted. Ubuntu 13.04 Kernel: 3.11 btrfs-progs git version 0.20-git20130822~194aa4a13 way to reproduce error: $ truncate -s 4G file $ mkfs.ext4 file #say yes to

[PATCH] Btrfs: eliminate the exceptional root_tree refs=0

2013-09-05 Thread Stefan Behrens
The fact that btrfs_root_refs() returned 0 for the tree_root caused bugs in the past, therefore it is set to 1 with this patch and (hopefully) all affected code is adapted to this change. I verified this change by temporarily adding WARN_ON() checks everywhere where btrfs_root_refs() is used,

Re: btrfs-convert won't convert ext* - No valid Btrfs found on /dev/sdb1

2013-09-05 Thread Roman Mamedov
On Thu, 5 Sep 2013 15:54:07 +0100 Hugo Mills h...@carfax.org.uk wrote: On Thu, Sep 05, 2013 at 05:43:27PM +0300, Тимофей Титовец wrote: Hello guys, i try to convert ext4 volume, but btrfs-convert show me error: No valid Btrfs found on file unable to open ctree conversion aborted.

Re: btrfs-convert won't convert ext* - No valid Btrfs found on /dev/sdb1

2013-09-05 Thread Hugo Mills
On Thu, Sep 05, 2013 at 09:06:19PM +0600, Roman Mamedov wrote: On Thu, 5 Sep 2013 15:54:07 +0100 Hugo Mills h...@carfax.org.uk wrote: On Thu, Sep 05, 2013 at 05:43:27PM +0300, Тимофей Титовец wrote: Hello guys, i try to convert ext4 volume, but btrfs-convert show me error: No valid

Re: btrfs-convert won't convert ext* - No valid Btrfs found on /dev/sdb1

2013-09-05 Thread Roman Mamedov
On Thu, 5 Sep 2013 16:30:23 +0100 Hugo Mills h...@carfax.org.uk wrote: Nope, just today I saw someone report the same problem in a blog comment: http://popey.com/blog/2013/09/02/fun-with-btrfs-on-ubuntu/#comment-9704 It's the same person, in fact. FWIW both names are Cyrillic but they

Re: btrfs-convert won't convert ext* - No valid Btrfs found on /dev/sdb1

2013-09-05 Thread Hugo Mills
On Thu, Sep 05, 2013 at 05:43:27PM +0300, Тимофей Титовец wrote: Hello guys, i try to convert ext4 volume, but btrfs-convert show me error: No valid Btrfs found on file unable to open ctree conversion aborted. Ubuntu 13.04 Kernel: 3.11 btrfs-progs git version 0.20-git20130822~194aa4a13

Re: btrfs-convert won't convert ext* - No valid Btrfs found on /dev/sdb1

2013-09-05 Thread Eric Sandeen
On 9/5/13 9:43 AM, Тимофей Титовец wrote: Hello guys, i try to convert ext4 volume, but btrfs-convert show me error: No valid Btrfs found on file unable to open ctree conversion aborted. Ubuntu 13.04 Kernel: 3.11 btrfs-progs git version 0.20-git20130822~194aa4a13 way to reproduce error:

Re: btrfs-convert won't convert ext* - No valid Btrfs found on /dev/sdb1

2013-09-05 Thread Josef Bacik
On Thu, Sep 05, 2013 at 10:45:23AM -0500, Eric Sandeen wrote: On 9/5/13 9:43 AM, Тимофей Титовец wrote: Hello guys, i try to convert ext4 volume, but btrfs-convert show me error: No valid Btrfs found on file unable to open ctree conversion aborted. Ubuntu 13.04 Kernel: 3.11

Re: [PATCH] xfstests btrfs/309: test btrfs-convert

2013-09-05 Thread Josef Bacik
On Sun, Aug 04, 2013 at 03:12:31PM -0500, Eric Sandeen wrote: Turns out btrfs-convert broke on July 3, and lo! we do not have a regression test, and now we have one, and there was much rejoicing. Signed-off-by: Eric Sandeen sand...@redhat.com --- diff --git a/tests/btrfs/309

Re: [PATCH 3/3] Btrfs: fix several potential problems in copy_nocow_pages_for_inode

2013-09-05 Thread Miao Xie
On thu, 05 Sep 2013 16:27:44 +0200, Stefan Behrens wrote: On Thu, 27 Jun 2013 18:51:00 +0800, Miao Xie wrote: - It makes no sense that we deal with a inode in the dead tree. This caused that the replace procedure was not dealing with free space cache entries anymore (which have

Re: [PATCH] Btrfs: eliminate the exceptional root_tree refs=0

2013-09-05 Thread Miao Xie
On thu, 5 Sep 2013 16:58:43 +0200, Stefan Behrens wrote: The fact that btrfs_root_refs() returned 0 for the tree_root caused bugs in the past, therefore it is set to 1 with this patch and (hopefully) all affected code is adapted to this change. I verified this change by temporarily