[PATCH] Btrfs: fix possible memory leak in the find_parent_nodes()

2013-05-08 Thread Wang Shilong
In the find_parent_nodes(), if read_tree_block() fails, we can not return directly, we should free some allocated memory otherwise memory leak happens. Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com --- Since Chris has already setup his pull, we'd like to send another patch. --- fs/btrfs

Re: syslog message repeated 3x

2013-05-09 Thread Wang Shilong
Hi, I just try your steps, but only 1x log message. Anyway, i use the latest btrfs-progs. git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git Can you try this and see if it happens again? Thanks, Wang I'm just curious why the last of the following 3 commands : $ dd

Re: syslog message repeated 3x

2013-05-09 Thread Wang Shilong
Oh, My kernel version is btrfs-next. This message gets from kernel..so you can try this url: git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git Hi, I just try your steps, but only 1x log message. Anyway, i use the latest btrfs-progs.

[PATCH] Btrfs-progs: fix missing recow roots when making btrfs filesystem

2013-05-14 Thread Wang Shilong
into system block group which is wrong,csum root leaf should be in metadata block group. Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- mkfs.c | 71 ++ 1 file changed, 45

[PATCH V2] Btrfs-progs: fix missing recow roots when making btrfs filesystem

2013-05-18 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com When making btrfs filesystem. we firstly write root leaf to specified filed, and then we recow the root. If we don't recow, some trees are not in the correct block group. Steps to reproduce: dd if=/dev/zero of=test.img bs=1M count=100

[PATCH] Btrfs-progs: fix compile warning in btrfs_free_block_groups()

2013-05-18 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com See the warning in i386 machine: extent-tree.c: In function ‘btrfs_free_block_groups’: extent-tree.c:3190:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com

[PATCH V2] Btrfs-progs: fix compile warning in btrfs_free_block_groups()

2013-05-18 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com extent-tree.c: In function 'btrfs_free_block_groups': extent-tree.c:3190:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com --- v1-v2: fix encoding error

Re: [PATCH] Btrfs: fix estale with btrfs send

2013-05-20 Thread Wang Shilong
Hello Josef, It seems you missed Reported-by in changelog~_~ Thanks, Wang Josef Bacik jba...@fusionio.com编写: This fixes bugzilla 57491. If we take a snapshot of a fs with a unlink ongoing and then try to send that root we will run into problems. When comparing with a parent root we will

Re: [PATCH 0/3] Btrfs: qgroup rescan fixes for next rc

2013-05-29 Thread Wang Shilong
Hello Jan, Patch 1 and 2 look good to me, thanks very much! Thanks, Wang Hi Wang, Please have a look at these patches, you should have been CCed but I just realized git send-email doesn't care about Cc lines in the patch file. Sigh. Thanks, -Jan -- To unsubscribe from this list: send

Re: btrfs quota examples?

2013-06-10 Thread Wang Shilong
Hello, On 10.06.2013 08:21, Tomasz Chmielewski wrote: I'm trying to use btrfs quotas, but I'm unable to find reliable documentation on its usage. Let's start with an empty subvolume: - assign 200 MB space to it: # btrfs qgroup limit 200m /mnt/btrfs-backup/tester/ - see the usage:

[PATCH] Btrfs-progs: do not print uuid 0 when printing root item

2013-06-17 Thread Wang Shilong
Signed-off-by: Wang Shilong wangshilong1...@gmail.com --- print-tree.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/print-tree.c b/print-tree.c index aae47a9..c1d8d18 100644 --- a/print-tree.c +++ b/print-tree.c @@ -355,8 +355,10 @@ static void print_root(struct

Re: [PATCH v2] Btrfs: fix crash regarding to ulist_add_merge

2013-06-27 Thread Wang Shilong
in ulist_add_merge() we have a possible memory leak: if krealloc() fails, we return -ENOMEM directly, this is wrong. ulist_free(ulist) should be called. You can fold this into your this patch. Otherwise, thanks very much for fixing this issue! Reviewed-by: Wang Shilong wangsl-f...@cn.fujitsu.com

Re: [RFC PATCH] Btrfs: rework ulist with list operation

2013-07-01 Thread Wang Shilong
Hello Liu, This is actually from Zach Brown's idea. Instead of ulist of array+rbtree, here we introduce ulist of list+rbtree, memory is dynamic allocation and we can get rid of memory re-allocation dance and special care for rbtree node's insert/delete for inline array, so it's

[PATCH 1/2] Btrfs-progs: make pretty_sizes() works less error prone

2013-07-03 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com In the original code, pretty_sizes() may return NULL in two cases: 1 Allocating memory dynamically fails 2 Overflow happens(size exceeds YB) The original codes don't handle error gracefully and some places forget to free memory. However, just

[PATCH RESEND] Btrfs-progs: fix compile warning in btrfs_free_block_groups()

2013-07-03 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com extent-tree.c: In function 'btrfs_free_block_groups': extent-tree.c:3189:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com --- extent-tree.c | 3 ++- 1 file

[PATCH V2 1/2] Btrfs-progs: make pretty_sizes() work less error prone

2013-07-07 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com In the original code, pretty_sizes() may return NULL in two cases: 1 Allocating memory dynamically fails 2 Overflow happens(size exceeds YB) Since we are limited to 16EB both theoretically and practically due to everything being 64bit, we can just

[PATCH V2] Btrfs-progs: fix compile warning in btrfs_free_block_groups()

2013-07-07 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com extent-tree.c: In function 'btrfs_free_block_groups': extent-tree.c:3189:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com --- V1-V2: use 'uintptr_t' instead

[PATCH] Btrfs-progs: fix memory leak in open_file_or_dir()

2013-07-09 Thread Wang Shilong
From: Wang Shilong wangsl.f...@cn.fujitsu.com After calling opendir() successfully, closedir() should be also called to free memory. Otherwise, memory leak happens. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com --- utils.c | 9 + 1 file changed, 5 insertions(+), 4 deletions

Re: [PATCH V2 1/2] Btrfs-progs: make pretty_sizes() work less error prone

2013-07-09 Thread Wang Shilong
have to know to free allocated memory. But I think that we can do better and not have callers need to worry about per-call string storage at all. How about something like this? Yeah, much better than mine! Acked-by: Wang Shilong wangsl.f...@cn.fujitsu.com Thanks, Wang - z From

Re: [PATCH] btrfs-progs: per-thread, per-call pretty buffer

2013-07-10 Thread Wang Shilong
format specifier macros. Signed-off-by: Zach Brown z...@redhat.com Signed-off-by: David Sterba dste...@suse.cz OK. please add my tag: Acked-by: Wang Shilong wangs.f...@cn.fujitsu.com (I have given my tag in the previous thread to Zach and cc to you!) Zach gives a better solution,but i

[PATCH] Btrfs: set qgroup_ulist to be null after calling ulist_free()

2013-07-13 Thread Wang Shilong
From: Wang Shilong wangsl.f...@cn.fujitsu.com We call ulist_free(qgroup_ulist) in btrfs_free_qgroup_config(), and btrfs_free_qgroup_config() may be called in two cases: (1)umount filesystem (2)disabling quota However, if we firstly disable quota and then umount filesystem, a double free happens

Re: [PATCH v2] Btrfs-progs: fix memory leak in open_file_or_dir()

2013-07-14 Thread Wang Shilong
) can not just finish this work…… Thanks, Wang From: Wang Shilong wangsl.f...@cn.fujitsu.com After calling opendir() successfully, closedir() should be also called to free memory. Otherwise, memory leak happens. Signed-off-by: Anand Jain anand.j...@oracle.com Signed-off-by: Wang Shilong

Re: Need help mounting broken btrfs Fedora 19

2013-07-14 Thread Wang Shilong
Hello, You call pull from: git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git Miao implement chunk tree recover function, you can try it with like. btrfs chunk-recover /dev Maybe this can help you. Thanks, Wang I need some help as may have lost some number of

[PATCH] Btrfs-progs: listing subvols and getting default subvol don't need a subv path

2013-07-14 Thread Wang Shilong
From: Wang Shilong wangsl.f...@cn.fujitsu.com Listing subvolumes and getting default subvol in the filesystem don't need a subv path,Any valid path related to Btrfs filesystem is ok to finish the work. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com --- cmds-subvolume.c | 23

Re: [PATCH v2] Btrfs-progs: fix memory leak in open_file_or_dir()

2013-07-14 Thread Wang Shilong
On 14/07/2013 21:58, Wang Shilong wrote: Hello Anand and David, I use the tool valgrind to whether there exists memory leak: valgrind --tool=memcheck --trace-origins=yes --leak-chek=full btrfs sub list /mnt There still exists memory leak related to open_file_or_dir() (After

[PATCH] Btrfs-progs: fix closing of opendir()

2013-07-15 Thread Wang Shilong
From: Wang Shilong wangsl.f...@cn.fujitsu.com valgrind complains open_file_or_dir() causes a memory leak.That is because if we open a directoy by opendir(), and then we should call closedir() to free memory. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com --- btrfs-fragments.c | 4

[PATCH] Btrfs-progs: fix wrong arg sb_bytenr for btrfs_scan_fs_devices()

2013-07-17 Thread Wang Shilong
From: Wang Shilong wangsl.f...@cn.fujitsu.com For most time, In open_ctree_*(), we use the first superblock (BTRFS_SUPER_INFO_OFFSET). However, for btrfs-convert, we don't, we should pass the correct sb_bytenr to btrfs_scan_fs_devices() rather than always use BTRFS_SUPER_INFO_OFFSET.This patch

[PATCH] Btrfs-progs: make btrfs-map-logical handle error gracefully

2013-07-19 Thread Wang Shilong
If an overflow logical address is passed(for example),the original code will cause segmentation, this is unfriendly to users,fix it. Signed-off-by: Wang Shilongwangsl.f...@cn.fujitsu.com --- btrfs-map-logical.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git

[PATCH 3/3] Btrfs: add missing mounting options in btrfs_show_options()

2013-07-22 Thread Wang Shilong
Some options are missing in btrfs_show_options(), this patch adds them. Signed-off-by: Wang Shilongwangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xiemi...@cn.fujitsu.com --- fs/btrfs/super.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c

[PATCH 2/3] Btrfs: use u64 for subvolid when parsing mount options

2013-07-22 Thread Wang Shilong
Although for most time, int is enough for subvolid, we should ensure safety in theory. Signed-off-by: Wang Shilongwangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xiemi...@cn.fujitsu.com --- fs/btrfs/super.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git

[PATCH 1/3] Btrfs: add sanity checks regarding to parsing mount options

2013-07-22 Thread Wang Shilong
I just notice the following commands succeed: mount dev mnt -o thread_pool=-1 This is ridiculous, only positive thread_pool makes sense,this patch adds sanity checks for them, and also catches the error of ENOMEM if allocating memory fails. Signed-off-by: Wang

Re: [PATCH 3/3] Btrfs: add missing mounting options in btrfs_show_options()

2013-07-23 Thread Wang Shilong
On 07/23/2013 03:43 PM, Stefan Behrens wrote: On Tue, 23 Jul 2013 13:22:18 +0800, Wang Shilong wrote: +if (btrfs_test_opt(root, RECOVERY)) +seq_puts(seq, ,auto_recovery); recovery without the auto_ Thanks, i will update the patch ^_^ Wang, -- To unsubscribe from this list

[PATCH RESEND 1/3] Btrfs: add sanity checks regarding to parsing mount options

2013-07-23 Thread Wang Shilong
I just notice the following commands succeed: mount dev mnt -o thread_pool=-1 This is ridiculous, only positive thread_pool makes sense,this patch adds sanity checks for them, and also catches the error of ENOMEM if allocating memory fails. Signed-off-by: Wang Shilong wangsl.f

[PATCH RESEND 2/3] Btrfs: use u64 for subvolid when parsing mount options

2013-07-23 Thread Wang Shilong
Although for most time, int is enough for subvolid, we should ensure safety in theory. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/super.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/fs

[PATCH V2 3/3] Btrfs: add missing mounting options in btrfs_show_options()

2013-07-23 Thread Wang Shilong
Some options are missing in btrfs_show_options(), this patch adds them. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- V1-V2: s/auto_recovery/recovery(Thanks to Stefan) --- fs/btrfs/super.c | 14 ++ 1 file changed, 14 insertions

Re: Recovering from btrfs error Couldn't read chunk root.

2013-07-27 Thread Wang Shilong
Hello, It seems Btrfs Chunk Tree is damaged, so you can not mount Btrfs filesystem any more. However, you can try the latest Btrfs-progs, Miao Xie implements chunk tree recover function. The url is: git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git you can try

Re: Recovering from btrfs error Couldn't read chunk root.

2013-07-29 Thread Wang Shilong
this is unrecoverable ~_~ Wang, Any thoughts? On 28 July 2013 08:17, Wang Shilong wangshilong1...@gmail.com wrote: Hello, It seems Btrfs Chunk Tree is damaged, so you can not mount Btrfs filesystem any more. However, you can try the latest Btrfs-progs, Miao Xie implements chunk tree

Re: Recovering from btrfs error Couldn't read chunk root.

2013-07-30 Thread Wang Shilong
http://bpaste.net/show/118112/ On 29 July 2013 15:06, Wang Shilong wangshilong1...@gmail.com wrote: 在 2013-7-29,上午2:12,Kyriakos kyriakosbrastia...@gmail.com 写道: Just tried it as you said with the -v option enabled This is my output: http://bpaste.net/show/118112/ This is a *long

Re: btrfs qgroup assign - ERROR: bad relation requested

2013-07-30 Thread Wang Shilong
On 07/31/2013 11:46 AM, Tomasz Chmielewski wrote: On Tue, 30 Jul 2013 21:06:32 +0800 Wang Shilong wangshilong1...@gmail.com wrote: I have implemented the above function, but they haven't gone into upstream Btrfs-progs. You can try this: http://github.com/miaoxie/btrfs-progs.git

Re: btrfs qgroup assign - ERROR: bad relation requested

2013-07-30 Thread Wang Shilong
On 07/31/2013 12:36 PM, Tomasz Chmielewski wrote: On Wed, 31 Jul 2013 12:19:36 +0800 Wang Shilong wangsl.f...@cn.fujitsu.com wrote: I have tried it and it works, you can do like the following to try it. #git clone http://github.com/miaoxie/btrfs-progs.git #cd btrfs-progs #git pull

Re: btrfs qgroup assign - ERROR: bad relation requested

2013-07-31 Thread Wang Shilong
Hello, On 07/31/2013 01:39 PM, Tomasz Chmielewski wrote: On Wed, 31 Jul 2013 13:13:37 +0800 Wang Shilong wangsl.f...@cn.fujitsu.com wrote: # git pull origin master Oops, i am sorry, here should: git pull origin qgroup would you please try it again Excellent, it works: # btrfs

[PATCH 05/10] Btrfs-progs: add man page information for btrfs-convert

2013-07-31 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- man/Makefile | 3 ++- man/btrfs-convert.8.in | 39 +++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 man/btrfs-convert

[PATCH 09/10] btrfs-progs: Fix the return value of btrfs-map-logical

2013-07-31 Thread Wang Shilong
From: Qu Wenruo quwen...@cn.fujitsu.com The ret variant in the main function is not changed so even problems happen, return value is still 0. The patch fixs the minor bug and return 1 if any problems happen. Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- btrfs-map-logical.c | 11

[PATCH 01/10] Btrfs-progs: add missing man page information for btrfsck

2013-07-31 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- man/btrfsck.8.in | 35 ++- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/man/btrfsck.8.in b/man/btrfsck.8.in index 5004ba0..6087c14 100644

[PATCH 04/10] Btrfs-progs: add man page information for btrfs-find-root

2013-07-31 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- man/Makefile | 2 +- man/btrfs-find-root.8.in | 36 man/btrfs-show-super.8.in | 4 ++-- 3 files changed, 39 insertions(+), 3 deletions

[PATCH 08/10] btrfs-progs: Update usage string of btrfs-map-logical

2013-07-31 Thread Wang Shilong
btrfs-map-logical supports both short and long options, and also every option should follow an arg,fix it. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- btrfs-map-logical.c | 12 1 file changed, 8 insertions(+), 4

[PATCH 10/10] Btrfs-progs: add missing man page for btrfs-map-logical

2013-07-31 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- man/Makefile | 2 +- man/btrfs-map-logical.8.in | 39 +++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 man/btrfs

[PATCH 03/10] Btrfs-progs: add missing man page for btrfs-show-super

2013-07-31 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- man/Makefile | 2 +- man/btrfs-show-super.8.in | 36 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 man/btrfs-show

[PATCH 02/10] Btrfs-progs: add missing man information for btrfs-debug-tree

2013-07-31 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- btrfs-debug-tree.c| 2 +- man/Makefile | 3 ++- man/btrfs-debug-tree.8.in | 41 + 3 files changed, 44 insertions(+), 2

[PATCH 06/10] Btrfs-progs: add missing man page for btrfstune

2013-07-31 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- man/Makefile | 2 +- man/btrfstune.8.in | 37 + 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 man/btrfstune.8.in diff

[PATCH 07/10] Btrfs-progs: add missing man page information for btrfs-zero-log

2013-07-31 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- man/Makefile| 2 +- man/btrfs-zero-log.8.in | 29 + 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 man/btrfs-zero-log.8

Re: [PATCH 04/12] Btrfs-progs: cleanup similar code in open_ctree_* and close_ctree

2013-08-04 Thread Wang Shilong
Hello Eric, I have sent a patch to fix up this regression: https://patchwork.kernel.org/patch/2828820/ Would you please try and see if this can solve problems. Thanks, Wang On 7/3/13 8:25 AM, Miao Xie wrote: Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- btrfs-find-root.c | 137

Re: Heavy memory leak when using quota groups

2013-08-05 Thread Wang Shilong
Hello. I am trying to use qgroups functionality with a basic random-write workload, it constantly keeps leaking memory within few minutes of IO, there is either out-of-memory killer trying to kill some tasks or there are page-allocation failures that btrfs or other kernel module

[PATCH] Btrfs: pass gfp_t to __add_prelim_ref() to avoid always using GFP_ATOMIC

2013-08-05 Thread Wang Shilong
Currently, only add_delayed_refs have to allocate with GFP_ATOMIC, So just pass arg 'gfp_t' to decide which allocation mode. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/backref.c | 30 +++--- 1 file

Re: [PATCH 09/10] btrfs-progs: Fix the return value of btrfs-map-logical

2013-08-06 Thread Wang Shilong
On Thu, Aug 01, 2013 at 01:35:33PM +0800, Wang Shilong wrote: From: Qu Wenruo quwen...@cn.fujitsu.com The ret variant in the main function is not changed so even problems happen, return value is still 0. The patch fixs the minor bug and return 1 if any problems happen. Please don't mix

[PATCH 3/3] Btrfs: remove reduplicate check when disabling quota

2013-08-06 Thread Wang Shilong
We have checked 'quota_root' with qgroup_ioctl_lock held before,So here the check is reduplicate, remove it. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/qgroup.c | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/btrfs

[PATCH 2/3] Btrfs: move btrfs_free_qgroup_config() out of spin_lock and fix comments

2013-08-06 Thread Wang Shilong
btrfs_free_qgroup_config() is not only called by open/close_ctree(),but also btrfs_disable_quota().And for btrfs_disable_quota(),we have set 'quota_root' to be null before calling btrfs_free_qgroup_config(),so it is safe to cleanup in-memory structures without lock held. Signed-off-by: Wang

[PATCH 1/3] Btrfs: fix oops when writing dirty qgroups to disk

2013-08-06 Thread Wang Shilong
When disabling quota, we should clear out list 'dirty_qgroups',otherwise, we will get oops if enabling quota again. Fix this by abstracting similar code from del_qgroup_rb(). Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/qgroup.c

Re: [PATCH 1/3] Btrfs: fix oops when writing dirty qgroups to disk

2013-08-06 Thread Wang Shilong
On 08/07/2013 01:12 PM, Wang Shilong wrote: When disabling quota, we should clear out list 'dirty_qgroups',otherwise, we will get oops if enabling quota again. Fix this by abstracting similar code from del_qgroup_rb(). Hello Arne, Would you pleae review this patch and other cleanup patches, i

[v2 1/8] Btrfs-progs: add missing man page information for btrfsck

2013-08-06 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- V1-V2: remove wrong copyright information --- man/btrfsck.8.in | 29 - 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/man/btrfsck.8.in b/man

[v2 5/8] Btrfs-progs: add man page information for btrfs-convert

2013-08-06 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- V1-V2: GPLv3-GPLv2 --- man/Makefile | 3 ++- man/btrfs-convert.8.in | 39 +++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode

[v2 6/8] Btrfs-progs: add missing man page for btrfstune

2013-08-06 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- V1-V2: GPLv3-GPLv2 --- man/Makefile | 2 +- man/btrfstune.8.in | 37 + 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 man

[v2 4/8] Btrfs-progs: add man page information for btrfs-find-root

2013-08-06 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- V1-V2: GPLv3-GPLv2 --- man/Makefile | 2 +- man/btrfs-find-root.8.in | 36 man/btrfs-show-super.8.in | 4 ++-- 3 files changed, 39

[v2 8/8] Btrfs-progs: add missing man page for btrfs-map-logical

2013-08-06 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- V1-V2: GPLv3-GPLv2 --- man/Makefile | 2 +- man/btrfs-map-logical.8.in | 39 +++ 2 files changed, 40 insertions(+), 1 deletion(-) create

[v2 3/8] Btrfs-progs: add missing man page for btrfs-show-super

2013-08-06 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- V1-V2: GPLv3-GPLv2 --- man/Makefile | 2 +- man/btrfs-show-super.8.in | 36 2 files changed, 37 insertions(+), 1 deletion(-) create mode

[v2 7/8] Btrfs-progs: add missing man page information for btrfs-zero-log

2013-08-06 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- V1-V2: GPLv3-GPLv2 --- man/Makefile| 2 +- man/btrfs-zero-log.8.in | 29 + 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 man

[v2 2/8] Btrfs-progs: add missing man information for btrfs-debug-tree

2013-08-06 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- V1-V2: GPLv3-GPLv2 --- btrfs-debug-tree.c| 2 +- man/Makefile | 3 ++- man/btrfs-debug-tree.8.in | 41 + 3 files changed, 44

[patch v2 resend 4/8] Btrfs-progs: add man page information for btrfs-find-root

2013-08-07 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- V1-V2: GPLv3-GPLv2 Thanks to Stefan Behrens --- man/Makefile | 2 +- man/btrfs-find-root.8.in | 36 2 files changed, 37 insertions(+), 1

Re: [v2 4/8] Btrfs-progs: add man page information for btrfs-find-root

2013-08-07 Thread Wang Shilong
many thanks to Stefan,you are always so helpful.~_~ David, please ignore this patch, i will resend. Thanks, Wang On 08/07/2013 02:46 PM, Stefan Behrens wrote: On Wed, 7 Aug 2013 13:54:05 +0800, Wang Shilong wrote: --- V1-V2: GPLv3-GPLv2 --- [...] .SH COPYRIGHT Copyright \(co 2013

[PATCH 2/3] Btrfs: catch error return value from find_extent_in_eb()

2013-08-07 Thread Wang Shilong
find_extent_in_eb() may return ENOMEM, catch this error return value. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/backref.c | 4 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index

[PATCH 1/3] Btrfs: fix possible memory leak in find_parent_nodes()

2013-08-07 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/backref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index cb73a12..54e7610 100644 --- a/fs/btrfs/backref.c +++ b/fs

[PATCH 3/3] Btrfs: allocate prelim_ref with a slab allocater

2013-08-07 Thread Wang Shilong
struct __prelim_ref is allocated and freed frequently when walking backref tree, using slab allocater can not only speed up allocating but also detect memory leaks. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/backref.c | 30

Re: [PATCH 1/3] Btrfs: fix possible memory leak in find_parent_nodes()

2013-08-08 Thread Wang Shilong
On 08/08/2013 07:02 PM, Jan Schmidt wrote: On Thu, August 08, 2013 at 07:04 (+0200), Wang Shilong wrote: Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/backref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

Re: [PATCH 2/3] Btrfs: catch error return value from find_extent_in_eb()

2013-08-08 Thread Wang Shilong
On 08/08/2013 06:24 PM, Filipe David Manana wrote: On Thu, Aug 8, 2013 at 6:04 AM, Wang Shilong wangsl.f...@cn.fujitsu.com wrote: find_extent_in_eb() may return ENOMEM, catch this error return value. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi

Re: [PATCH 3/3] Btrfs: allocate prelim_ref with a slab allocater

2013-08-08 Thread Wang Shilong
On Thu, August 08, 2013 at 07:04 (+0200), Wang Shilong wrote: struct __prelim_ref is allocated and freed frequently when walking backref tree, using slab allocater can not only speed up allocating but also detect memory leaks. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com

[patch v2 1/2] Btrfs: fix possible memory leak in find_parent_nodes()

2013-08-08 Thread Wang Shilong
the problem. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- V1-V2: add explanations to changelog --- fs/btrfs/backref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 68048d6

[patch v2 2/2] Btrfs: allocate prelim_ref with a slab allocater

2013-08-08 Thread Wang Shilong
struct __prelim_ref is allocated and freed frequently when walking backref tree, using slab allocater can not only speed up allocating but also detect memory leaks. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- V1-V2: 1.fix

Re: btrfs qgroup destroy - ERROR: unable to create quota group: Device or resource busy

2013-08-08 Thread Wang Shilong
Hello, On 08/09/2013 01:39 PM, Tomasz Chmielewski wrote: I'm using qgroups and have created a few hundreds of subvolumes in the past. It seems that btrfs automatically assigns a qgroup to newly created snapshot/subvolume, but does not destroy the qgroup when the subvolume is deleted. This

Re: btrfs qgroup destroy - ERROR: unable to create quota group: Device or resource busy

2013-08-09 Thread Wang Shilong
On 08/09/2013 02:42 PM, Tomasz Chmielewski wrote: On Fri, 09 Aug 2013 14:08:48 +0800 Wang Shilong wangsl.f...@cn.fujitsu.com wrote: 0/4494 839516160 18446744073709481984 --- -- want to remove only this one 13/1 2142674944 2142674944 0/3973,0/3974,0/3978,0/3981,0/4355,0/4373,0/4398,0

[PATCH V3 1/2] Btrfs: fix possible memory leak in find_parent_nodes()

2013-08-09 Thread Wang Shilong
'.The cleanup code would also not free it, because it has been removed from list. We fix the problem by calling list_del() after operations, so it is still in the list even if operations fail, and then the cleanup code can get and free it. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed

Re: [PATCH 1/3] Btrfs: fix oops when writing dirty qgroups to disk

2013-08-09 Thread Wang Shilong
On 08/08/2013 09:20 PM, Josef Bacik wrote: On Wed, Aug 07, 2013 at 01:12:29PM +0800, Wang Shilong wrote: When disabling quota, we should clear out list 'dirty_qgroups',otherwise, we will get oops if enabling quota again. Fix this by abstracting similar code from del_qgroup_rb(). Signed-off

Re: btrfs qgroup destroy - ERROR: unable to create quota group: Device or resource busy

2013-08-09 Thread Wang Shilong
Hello, just add my answer for a missing question. On Fri, 09 Aug 2013 13:56:19 +0800 Wang Shilong wangsl.f...@cn.fujitsu.com wrote: It seems that btrfs automatically assigns a qgroup to newly created snapshot/subvolume, but does not destroy the qgroup when the subvolume is deleted

[PATCH v2 1/3] Btrfs: fix oops when writing dirty qgroups to disk

2013-08-13 Thread Wang Shilong
When disabling quota, we should clear out list 'dirty_qgroups',otherwise, we will get oops if enabling quota again. Fix this by abstracting similar code from del_qgroup_rb(). Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com Reviewed-by: Arne Jansen

[PATCH v2 3/3] Btrfs: remove reduplicate check when disabling quota

2013-08-13 Thread Wang Shilong
We have checked 'quota_root' with qgroup_ioctl_lock held before,So here the check is reduplicate, remove it. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com Reviewed-by: Arne Jansen sensi...@gmx.net --- v1-v2: nothing(except adding Arne's reviewed

[PATCH v3 1/8] Btrfs-progs: add missing man page information for btrfsck

2013-08-13 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- v2-v3: availiable parts is not true anymore,remove it. v1-v2: remove wrong copyrights. --- man/btrfsck.8.in | 35 --- 1 file changed, 24 insertions(+), 11

[PATCH v3 5/8] Btrfs-progs: add man page information for btrfs-convert

2013-08-13 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- v2-v3: remove 'AVAILIABLE' parts. v1-v2: GPLv3-GPLv2 --- man/Makefile | 3 ++- man/btrfs-convert.8.in | 33 + 2 files changed, 35 insertions(+), 1

[PATCH v3 7/8] Btrfs-progs: add missing man page information for btrfs-zero-log

2013-08-13 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- v2-v3: remove 'AVAILIABLE' parts. v1-v2: GPLv3-GPLv2 --- man/Makefile| 2 +- man/btrfs-zero-log.8.in | 23 +++ 2 files changed, 24 insertions(+), 1 deletion

[PATCH v3 8/8] Btrfs-progs: add missing man page for btrfs-map-logical

2013-08-13 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- v2-v3: remove 'AVAILIABLE' parts. v1-v2: GPLv3-GPLv2 --- man/Makefile | 2 +- man/btrfs-map-logical.8.in | 33 + 2 files changed, 34

[PATCH v3 6/8] Btrfs-progs: add missing man page for btrfstune

2013-08-13 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- v2-v3: remove 'AVAILIABLE' parts. v1-v2: GPLv3-GPLv2 --- man/Makefile | 2 +- man/btrfstune.8.in | 31 +++ 2 files changed, 32 insertions(+), 1 deletion

[PATCH v3 3/8] Btrfs-progs: add missing man page for btrfs-show-super

2013-08-13 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- v2-v3: remove 'AVAILIABLE' parts v1-v2: GPLv3-GPLv2 --- man/Makefile | 2 +- man/btrfs-show-super.8.in | 30 ++ 2 files changed, 31 insertions

[PATCH v3 2/8] Btrfs-progs: add missing man information for btrfs-debug-tree

2013-08-13 Thread Wang Shilong
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com --- v2-v3: remove 'AVAILIABLE' parts. v1-v2: GPLv3-GPLv2 --- btrfs-debug-tree.c| 2 +- man/Makefile | 3 ++- man/btrfs-debug-tree.8.in | 35

Re: [PATCH] btrfs-progs: restore passing of super_bytenr to device scan

2013-08-15 Thread Wang Shilong
add to the list Helo, I have sent a patch for this before: https://patchwork.kernel.org/patch/2828820/ Thanks, Wang Commit 615f2867 (Btrfs-progs: cleanup similar code in open_ctree_* and close_ctree) introduced a regression in btrfs-convert. open_ctree takes a sb_bytenr argument

Re: [PATCH] Btrfs: separate out tests into their own directory V2

2013-08-29 Thread Wang Shilong
On 08/30/2013 03:29 AM, Josef Bacik wrote: The plan is to have a bunch of unit tests that run when btrfs is loaded when you build with the appropriate config option. My ultimate goal is to have a test for every non-static function we have, but at first I'm going to focus on the things that

Re: [PATCH 1/3] btrfs-progs: move out print in cmd_df to another function

2013-08-29 Thread Wang Shilong
On 08/16/2013 08:48 PM, Anand Jain wrote: Hello Anand, We'd appreciate you use checkpatch.pl to check coding style before sending patches. For this patch: ERROR: foo * bar should be foo *bar #35: FILE: cmds-filesystem.c:47: +static char * group_type_str(u64 flag) ERROR: foo * bar should be

Re: [PATCH 2/3] btrfs-progs: read from the kernel when disk is mounted

2013-08-29 Thread Wang Shilong
On 08/16/2013 08:48 PM, Anand Jain wrote: ERROR: spaces required around that '?' (ctx:VxV) #63: FILE: cmds-filesystem.c:279: +strlen(label)?label:none, uuidbuf, path); ^ ERROR: spaces required around that ':' (ctx:VxV) #63: FILE: cmds-filesystem.c:279: +

Re: [PATCH] Btrfs: fix printing of non NULL terminated string

2013-08-29 Thread Wang Shilong
On 08/21/2013 12:51 AM, Filipe David Borba Manana wrote: please use checkpatch.pl to check coding styles before sending patch ERROR: code indent should use tabs where possible #37: FILE: fs/btrfs/delayed-inode.c:1477: +^I^Iname_len, name,$ total: 1 errors, 0 warnings, 13 lines

Re: [PATCH] Btrfs: fix send to deal with sparse files properly V2

2013-08-29 Thread Wang Shilong
On 08/22/2013 11:47 PM, Josef Bacik wrote: please use checkpatch.pl to check coding styles before sending patches: WARNING: line over 80 characters #86: FILE: fs/btrfs/send.c:4051: +if (btrfs_file_extent_disk_bytenr(path-nodes[0], ei) == 0) { total: 0 errors, 1 warnings, 59 lines

Re: Btrfs-progs: allow fsck to fix directory isize errors

2013-09-01 Thread Wang Shilong
Hello, Using checkpatch.pl, i get the following warnings(errors): WARNING: %Ld/%Lu are not-standard C, use %lld/%llu #87: FILE: cmds-check.c:1389: + printf(reset isize for dir %Lu root %Lu\n, rec-ino, total: 0 errors, 1 warnings, 141 lines checked patch has style problems, please review.

Re: btrfs-progs: replace fails start but in the background

2013-09-01 Thread Wang Shilong
Hello, Using checkpatch.pl, i get the following warnings(errors): WARNING: please, no space before tabs #83: FILE: utils.c:1999: + * ^Ifrom the user cli like device add remove replace balance etc..$ total: 0 errors, 1 warnings, 50 lines checked patch has style problems, please review. If any of

Re: Notify caching_thread()s to give up on extent_commit_sem when needed.

2013-09-01 Thread Wang Shilong
Hello, Using checkpatch.pl, i get the following warnings(errors): WARNING: please, no spaces at the start of a line #49: FILE: fs/btrfs/ctree.h:1431: +atomic_t extent_commit_sem_give_up_read;$ WARNING: please, no spaces at the start of a line #51: FILE: fs/btrfs/ctree.h:1433: +do {

  1   2   3   4   5   6   7   8   >