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

2013-09-04 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 --- cmds-subvolume.c | 48 ++-- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c

[PATCH 4/5] btrfs-progs:free the local list pending_list in btrfs_scan_one_dir

2013-09-04 Thread Gui Hecheng
Originally the local pending_list is not guaranteed to be freed upon fails, it should be emptyed and the elements should be freed. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- utils.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/utils.c b/utils.c

[PATCH 2/5] btrfs-progs:local variable memory freed

2013-09-04 Thread Gui Hecheng
The local probe variable in is_ssd() freed upon unsuccessful return; The local dir_head list in make_image() freed upon unsuccessful return. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- mkfs.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mkfs.c b

[PATCH 3/5] btrfs-progs: missing tree-freeing statements added

2013-09-04 Thread Gui Hecheng
The seen cache_tree in run_next_block freed. Originally, this missing causes memory leaks, reported by valgrind. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- cmds-check.c | 5 + 1 file changed, 5 insertions(+) diff --git a/cmds-check.c b/cmds-check.c index 6cbd5a6..0cba4cc

[PATCH 0/5] Memory leaks amended

2013-09-04 Thread Gui Hecheng
Memory leaks found by the tool--valgrind along with static reviewing. Based on Daivd's branch 'integration-20130903'. Gui Hecheng (5): btrfs-progs:free local variable buf upon unsuccessful returns btrfs-progs:local variable memory freed btrfs-progs: missing tree-freeing statements added

[PATCH 1/5] btrfs-progs:free local variable buf upon unsuccessful returns

2013-09-04 Thread Gui Hecheng
The variable buf passed into find_collision() as parameter name should be freed on unsuccessful returns. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-image.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/btrfs-image.c b/btrfs-image.c index 3ea3730..1a52aa6 100644

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

2013-09-04 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: - None --- cmds-subvolume.c | 40 ++-- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/cmds

[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

[PATCH] xfstest: an regression test for btrfs balance

2013-10-07 Thread Gui Hecheng
(in kernel/git/torvalds/linux.git) handled by the patch: [PATCH 2/3] Btrfs: fix oops caused by the space balance and dead roots Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- tests/btrfs/319 | 71 + tests/btrfs/319.out | 2 ++ tests

Re: [PATCH] xfstest: an regression test for btrfs balance

2013-10-08 Thread Gui Hecheng
On Tue, 2013-10-08 at 13:21 -0400, Josef Bacik wrote: On Tue, Oct 08, 2013 at 09:21:15AM +0800, Gui Hecheng wrote: Originally, when executing btrfs balance right after btrfs subvolume snaphot btrfs subvolume delete, a kernel BUG arises. This problem is caused by the patch: [PATCH 1

[PATCH V2] xfstest: an regression test for btrfs balance

2013-10-08 Thread Gui Hecheng
(in kernel/git/torvalds/linux.git) handled by the patch: [PATCH 2/3] Btrfs: fix oops caused by the space balance and dead roots Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com Reviewed-by: Josef Bacik jba...@fusionio.com --- Changelog V1-V2 change test number 319 - 012 --- tests/btrfs/012

Re: [PATCH 4/4] btrfs-progs: fix fsck leaks on error returns

2014-02-16 Thread Gui Hecheng
On Fri, 2014-02-14 at 18:30 +0100, David Sterba wrote: On Thu, Feb 13, 2014 at 11:16:38AM +0800, Gui Hecheng wrote: @@ -6460,6 +6460,7 @@ int cmd_check(int argc, char **argv) !extent_buffer_uptodate(info-dev_root-node) || !extent_buffer_uptodate(info-chunk_root-node

[PATCH v2 4/4] btrfs-progs: fix fsck leaks on error returns

2014-02-17 Thread Gui Hecheng
Add close_ctree()s before the returns on errors after open_ctree() Also merge the err returns into the goto + single return pattern. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog: v1-v2: merge err returns into goto + single return pattern --- cmds-check.c | 32

[PATCH 2/4] btrfs-progs: fix segment fault when exec btrfs-debug-tree as non-root

2014-02-19 Thread Gui Hecheng
When exec btrfs-debug-tree as non-root user, we get a segment fault. Because the btrfs_scan_block_devices return a success 0 when we fail to open a device. Now we just return the errno if this case happens. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- utils.c | 3 ++- 1 file changed

[PATCH 3/4] btrfs-progs: fix wrong error msg for exec btrfsck as non-root

2014-02-19 Thread Gui Hecheng
-ENOENT. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.c b/utils.c index 1878abc..12ed2f4 100644 --- a/utils.c +++ b/utils.c @@ -1114,7 +1114,7 @@ again: dirp = opendir(dirname); if (!dirp

[PATCH 4/4] btrfs-progs: clean the unnecessary error msg of btrfs-file-show

2014-02-19 Thread Gui Hecheng
outputs. Showing an error msg together with the right result is really awkward. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- utils.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/utils.c b/utils.c index 12ed2f4..9408885 100644 --- a/utils.c +++ b/utils.c @@ -2206,8 +2206,6 @@ again

[PATCH 1/4] btrfs-progs: judge the return value of check_mounted more accurately

2014-02-19 Thread Gui Hecheng
of check_mounted. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-convert.c | 7 ++- btrfstune.c | 7 ++- cmds-rescue.c | 14 +++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/btrfs-convert.c b/btrfs-convert.c index 1b66de7..a8b2c51 100644

[PATCH 2/3] btrfs-progs: cleanup device stat usage prompt

2014-03-05 Thread Gui Hecheng
1. use usage() to replace the fprintf() 2. use check_argc_exact() to replace argc != ... Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- cmds-device.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index ad59600..5009d9a

[PATCH 1/3] btrfs-progs: cleanup dead return after usage() for fi-disk_usage

2014-03-05 Thread Gui Hecheng
The usage() calls exit() internally, so remove the return after it. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- cmds-fi-disk_usage.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c index e4eb72b..a3b06be

[PATCH 3/3] btrfs-progs: make the device scan logic more clear

2014-03-05 Thread Gui Hecheng
seems a little confusing. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- cmds-device.c | 61 ++- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index 5009d9a..d79732f 100644 --- a/cmds

Re: Building a brtfs filesystem 70M?

2014-03-10 Thread Gui Hecheng
On Mon, 2014-03-10 at 16:25 -0700, Saul Wold wrote: Hi There There seems to be an issue if we try to build a btrfs based FS that is less than 70M, we get the following assertion failure: mkfs.btrfs: extent-tree.c:2682: btrfs_reserve_extent: Assertion `!(ret)' failed. I tried to do a

Re: Building a brtfs filesystem 70M?

2014-03-10 Thread Gui Hecheng
On Mon, 2014-03-10 at 20:16 -0700, Saul Wold wrote: On 03/10/2014 07:38 PM, Gui Hecheng wrote: On Mon, 2014-03-10 at 16:25 -0700, Saul Wold wrote: Hi There There seems to be an issue if we try to build a btrfs based FS that is less than 70M, we get the following assertion failure

Re: Building a brtfs filesystem 70M?

2014-03-11 Thread Gui Hecheng
On Mon, 2014-03-10 at 23:41 -0700, Saul Wold wrote: On 03/10/2014 10:47 PM, Gui Hecheng wrote: On Mon, 2014-03-10 at 20:16 -0700, Saul Wold wrote: On 03/10/2014 07:38 PM, Gui Hecheng wrote: On Mon, 2014-03-10 at 16:25 -0700, Saul Wold wrote: Hi There There seems to be an issue if we

[PATCH] btrfs-progs: fix bug on mkfs with relative path specified

2014-03-11 Thread Gui Hecheng
Wold s...@linux.intel.com Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- mkfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mkfs.c b/mkfs.c index 2dc90c2..1bd3069 100644 --- a/mkfs.c +++ b/mkfs.c @@ -756,6 +756,7 @@ static int traverse_directory(struct

[PATCH] btrfs-progs: skip erroneous free before initialization

2014-03-12 Thread Gui Hecheng
If the list is not initialized, don't try to free it. Otherwise it will cause segmentfault. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- mkfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkfs.c b/mkfs.c index d7049c9..df22c3a 100644 --- a/mkfs.c +++ b

[PATCH v2] btrfs-progs: fix bug on mkfs with relative path specified

2014-03-12 Thread Gui Hecheng
and adopt the single return + goto out pattern Reported-by: Saul Wold s...@linux.intel.com Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- change log v1-v2: 1. add check for realpath() return value 2. fix memory leaks for dir_entry 3. adopt single

Re: [PATCH] btrfs: add btrfs resize unit t/p/e support

2014-03-27 Thread Gui Hecheng
On Thu, 2014-03-27 at 16:27 +0100, David Sterba wrote: On Thu, Mar 27, 2014 at 09:35:41AM +0200, Brendan Hide wrote: On 2014/03/27 04:51 AM, Gui Hecheng wrote: [snip] We add t/p/e support by replacing lib/cmdline.c:memparse with btrfs_memparse. The btrfs_memparse copies memparse's code

[PATCH] lib: add size unit t/p/e to memparse

2014-03-31 Thread Gui Hecheng
For modern filesystems such as btrfs, t/p/e size level operations are common. add size unit t/p/e parsing to memparse Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- lib/cmdline.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/cmdline.c

[PATCH] btrfs-progs: update manpage for btrfs resize support size unit t/p/e

2014-03-31 Thread Gui Hecheng
btrfs resize now support size unit parse of k/m/g/t/p/e in kernel space, adopt the changes in userspace manpage. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- cmds-filesystem.c | 3 ++- man/btrfs.8.in| 9 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git

[PATCH] btrfs: filter invalid arg for btrfs resize

2014-03-31 Thread Gui Hecheng
Originally following cmds will work: # btrfs fi resize -10A mnt # btrfs fi resize -10Gaha mnt Filter the arg by checking the return pointer of memparse. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2

Re: [PATCH] lib: add size unit t/p/e to memparse

2014-03-31 Thread Gui Hecheng
On Mon, 2014-03-31 at 13:17 +0200, Brendan Hide wrote: On 31/03/14 12:03, Gui Hecheng wrote: - * potentially suffixed with %K (for kilobytes, or 1024 bytes), - * %M (for megabytes, or 1048576 bytes), or %G (for gigabytes, or - * 1073741824). If the number is suffixed with K, M, or G

[PATCH v2] lib: add size unit t/p/e to memparse

2014-04-01 Thread Gui Hecheng
For modern filesystems such as btrfs, t/p/e size level operations are common. add size unit t/p/e parsing to memparse Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog v1-v2: replace kilobyte with kibibyte, and others --- lib/cmdline.c | 25 - 1

[PATCH v2] btrfs-progs: update manpage for btrfs resize support size unit t/p/e

2014-04-01 Thread Gui Hecheng
btrfs resize now support size unit parse of k/m/g/t/p/e in kernel space, adopt the changes in userspace manpage. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog v1-v2: replace kilobyte with kibibyte, and others --- cmds-filesystem.c | 3 ++- man/btrfs.8.in| 9

[PATCH v3] lib: add size unit t/p/e to memparse

2014-04-02 Thread Gui Hecheng
For modern filesystems such as btrfs, t/p/e size level operations are common. add size unit t/p/e parsing to memparse Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog v1-v2: replace kilobyte with kibibyte, and others v2-v3: add missing unit bytes in comment

[PATCH] btrfs-progs: correct prompt of minimal num of devs for raid56

2014-04-09 Thread Gui Hecheng
For btrfs, Raid5 can't go below 2 devs, not 3; Raid6 can't go below 3 devs, not 4. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- ioctl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ioctl.h b/ioctl.h index c3ee270..6742ba6 100644 --- a/ioctl.h +++ b/ioctl.h

[PATCH 1/2] btrfs-progs: fix wrong max system array size check in user space

2014-04-21 Thread Gui Hecheng
For system chunk array, We copy a disk_key and an chunk item each time, so there should be enough space to hold both of them, not only the chunk item. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- volumes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH 2/2] btrfs: add dev maxs limit for __btrfs_alloc_chunk in kernel space

2014-04-21 Thread Gui Hecheng
For RAID0,5,6,10, For system chunk, there shouldn't be too many stripes to make a btrfs_chunk that exceeds BTRFS_SYSTEM_CHUNK_ARRAY_SIZE For data/meta chunk, there shouldn't be too many stripes to make a btrfs_chunk that exceeds a leaf. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- fs

[PATCH 2/2] btrfs-progs: add dev maxs limit for btrfs_alloc_chunk in user space

2014-04-21 Thread Gui Hecheng
For RAID0,5,6,10, For system chunk, there shouldn't be too many stripes to make a btrfs_chunk that exceeds BTRFS_SYSTEM_CHUNK_ARRAY_SIZE For data/meta chunk, there shouldn't be too many stripes to make a btrfs_chunk that exceeds a leaf. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com

[PATCH 1/2] btrfs: fix wrong max system array size check in kernel space

2014-04-21 Thread Gui Hecheng
For system chunk array, We copy a disk_key and an chunk item each time, so there should be enough space to hold both of them, not only the chunk item. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- fs/btrfs/volumes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH] btrfs-progs: prevent close_root if the root to close is potentially NULL

2014-04-23 Thread Gui Hecheng
Originally only if 'block_only' is specified, the 'fs_root == NULL' will be checked. But if 'block_only' is not specified and close_root will be called blindly without checking 'fs_root == NULL', which is unsafe. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-debug-tree.c | 9

[PATCH 2/2] btrfs-progs: update man page for btrfs-show-super

2014-05-07 Thread Gui Hecheng
Add '-f' option for btrfs-show-super manpage, This option implies that sys chunk array and backup roots info will show up. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- Documentation/btrfs-show-super.txt | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[PATCH 2/3] btrfs-progs: add missing help option for rescue super-recover

2014-05-14 Thread Gui Hecheng
Add '-h' option for help for super-recover, update the manpage at the same time. --- Documentation/btrfs-rescue.txt | 2 ++ cmds-rescue.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/btrfs-rescue.txt b/Documentation/btrfs-rescue.txt index

[PATCH 3/3] btrfs-progs: use check_argc_exact to check arg number of btrfs-rescue

2014-05-14 Thread Gui Hecheng
The btrfs-rescue accepts exactly one arg for both chunk-recover super-recover, use check_argc_exact clearly. --- cmds-rescue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-rescue.c b/cmds-rescue.c index 9491d0c..3629141 100644 --- a/cmds-rescue.c +++

Re: [ping][PATCH v3] lib: add size unit t/p/e to memparse

2014-05-14 Thread Gui Hecheng
On Wed, 2014-04-02 at 16:54 +0800, Gui Hecheng wrote: For modern filesystems such as btrfs, t/p/e size level operations are common. add size unit t/p/e parsing to memparse Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog v1-v2: replace kilobyte with kibibyte

Re: [PATCH 1/2] btrfs-progs: add sys_chunk_array and backup roots info to show-super

2014-05-15 Thread Gui Hecheng
On Thu, 2014-05-15 at 18:35 +0200, David Sterba wrote: On Thu, May 08, 2014 at 11:03:57AM +0800, Gui Hecheng wrote: Add sys chunk array and backup roots info if the new option '-f' if specified. This may be useful for debugging sys_chunk related issues. Sounds useful. One comment below

[PATCH v2] btrfs-progs: add sys_chunk_array and backup roots info to show-super

2014-05-15 Thread Gui Hecheng
Add sys chunk array and backup roots info if the new option '-f' if specified. This may be useful for debugging sys_chunk related issues. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- Changelog: v1-v2: add malloc failure check --- btrfs-show-super.c | 142

Re: [PATCH 2/3] btrfs-progs: add missing help option for rescue super-recover

2014-05-18 Thread Gui Hecheng
On Fri, 2014-05-16 at 18:41 +0200, David Sterba wrote: On Fri, May 16, 2014 at 06:37:27PM +0200, David Sterba wrote: On Thu, May 15, 2014 at 09:29:08AM +0800, Gui Hecheng wrote: Add '-h' option for help for super-recover, update the manpage at the same time. We don't have the short

[PATCH] btrfs-progs: clarify manpage for btrfstune seeding option

2014-05-21 Thread Gui Hecheng
The btrfstune -S option accepts a positive value to enable seeding, and a zero to disable seeding, negtive is not allowed. Add positive, zero, negative sentences to btrfstune manpage. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- Documentation/btrfstune.txt | 5 +++-- btrfstune.c

[PATCH 1/2] btrfs-progs: fix uninitialized number count in chunk-recover

2014-05-28 Thread Gui Hecheng
When count the number of unordered device extents in chunk-recover, the counter should be reinitialized to be used. Also, introduce a new function for the counting job. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- chunk-recover.c | 20 ++-- 1 file changed, 14

[PATCH] btrfs: replace EINVAL with ERANGE for resize when ULLONG_MAX

2014-05-28 Thread Gui Hecheng
To be accurate about the error case, if the new size is beyond ULLONG_MAX, return ERANGE instead of EINVAL. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index

Re: [PATCH 1/3] btrfs-progs: cleanup btrfs-rescue output msgs

2014-05-28 Thread Gui Hecheng
On Wed, 2014-05-28 at 18:24 +0200, David Sterba wrote: On Thu, May 15, 2014 at 09:29:07AM +0800, Gui Hecheng wrote: Use enum defined error codes to represent different kinds of errs for super-recover and chunk-recover. I think this change hides the low-level errors (like ENOMEM) that can

[PATCH] btrfs: replace EINVAL with EOPNOTSUPP for dev_replace raid56

2014-06-04 Thread Gui Hecheng
To return EOPNOTSUPP is more user friendly than to return EINVAL, and then user-space tool will show that the dev_replace operation for raid56 is not currently supported rather than showing that there is an invalid argument. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- fs/btrfs/dev

[PATCH] btrfs-progs: show meaningful msgs for replace cmd upon raid56

2014-06-04 Thread Gui Hecheng
-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- cmds-replace.c | 4 1 file changed, 4 insertions(+) diff --git a/cmds-replace.c b/cmds-replace.c index 9eb981b..8b18110 100644 --- a/cmds-replace.c +++ b/cmds-replace.c @@ -301,6 +301,10 @@ static int cmd_start_replace(int argc, char **argv

[PATCH] mount: add btrfs to mount.8

2014-06-04 Thread Gui Hecheng
Based on Documentation/filesystems/btrfs.txt Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- sys-utils/mount.8 | 186 ++ 1 file changed, 186 insertions(+) diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 index efa1ae8..ec8eab3

Re: ยท[ping][PATCH v3] lib: add size unit t/p/e to memparse

2014-06-05 Thread Gui Hecheng
On Wed, 2014-04-02 at 16:54 +0800, Gui Hecheng wrote: For modern filesystems such as btrfs, t/p/e size level operations are common. add size unit t/p/e parsing to memparse Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog v1-v2: replace kilobyte with kibibyte

Re: [PATCH] mount: add btrfs to mount.8

2014-06-06 Thread Gui Hecheng
On Thu, 2014-06-05 at 10:03 +0200, Karel Zak wrote: On Thu, Jun 05, 2014 at 10:05:19AM +0800, Gui Hecheng wrote: Based on Documentation/filesystems/btrfs.txt Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- sys-utils/mount.8 | 186

Re: [PATCH] mount: add btrfs to mount.8

2014-06-06 Thread Gui Hecheng
On Fri, 2014-06-06 at 11:44 +0200, Karel Zak wrote: On Fri, Jun 06, 2014 at 02:32:39PM +0800, Gui Hecheng wrote: But for now, there are btrfs *users* complaining that they cannot find any help by refering to the mount manpage when they want to mount their btrfs. Actually, not every btrfs

Re: [PATCH] mount: add btrfs to mount.8

2014-06-06 Thread Gui Hecheng
On Fri, 2014-06-06 at 12:03 +0200, Karel Zak wrote: On Fri, Jun 06, 2014 at 11:44:28AM +0200, Karel Zak wrote: I personally have no problem to maintain information about arbitrary FS in mount.8, the problem are updates. Unfortunately, kernel FS developers don't care about the man page at

[PATCH 2/3] btrfs-progs: fix max mirror number error for chunk-recover

2014-06-11 Thread Gui Hecheng
chunk-recover.c : BTRFS_NUM_MIRRORS 2 just change BTRFS_NUM_MIRRORS to 3, and everything goes well. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- chunk-recover.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chunk-recover.c b/chunk-recover.c index

[PATCH 1/3] btrfs-progs: fix missing parity stripe for raid6 in chunk-recover

2014-06-11 Thread Gui Hecheng
When deal with the p q stripes for data profile raid6, chunk-recover forgets to insert them into the chunk record. Just insert them back freely. Also wrap the inert procedure into a new function, fill_chunk_up. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- chunk-recover.c | 30

[PATCH 3/3] btrfs-progs: cleanup unused assignment for chunk-recover

2014-06-11 Thread Gui Hecheng
The 'num_unordered' will be recounted after 'goto out', just remove it. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- chunk-recover.c | 1 - 1 file changed, 1 deletion(-) diff --git a/chunk-recover.c b/chunk-recover.c index d5a688e..8bc5bc3 100644 --- a/chunk-recover.c +++ b/chunk

[PATCH v2 1/3] btrfs-progs: fix missing parity stripe for raid6 in chunk-recover

2014-06-12 Thread Gui Hecheng
When deal with the p q stripes for data profile raid6, chunk-recover forgets to insert them into the chunk record. Just insert them back freely. Also wrap the insert procedure into a new function, fill_chunk_up. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog: v1-v2

Re: [PATCH v3] lib: add size unit t/p/e to memparse

2014-06-12 Thread Gui Hecheng
On Thu, 2014-06-12 at 14:15 -0700, Andrew Morton wrote: On Wed, 2 Apr 2014 16:54:37 +0800 Gui Hecheng guihc.f...@cn.fujitsu.com wrote: For modern filesystems such as btrfs, t/p/e size level operations are common. add size unit t/p/e parsing to memparse Signed-off-by: Gui Hecheng

Re: [PATCH v4] lib: add size unit t/p/e to memparse

2014-06-13 Thread Gui Hecheng
On Fri, 2014-06-13 at 07:55 +0200, Brendan Hide wrote: On 13/06/14 03:42, Gui Hecheng wrote: For modern filesystems such as btrfs, t/p/e size level operations are common. add size unit t/p/e parsing to memparse Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog

Re: [PATCH v4] lib: add size unit t/p/e to memparse

2014-06-16 Thread Gui Hecheng
On Fri, 2014-06-13 at 14:58 -0700, David Rientjes wrote: On Fri, 13 Jun 2014, Gui Hecheng wrote: diff --git a/lib/cmdline.c b/lib/cmdline.c index d4932f7..76a712e 100644 --- a/lib/cmdline.c +++ b/lib/cmdline.c @@ -121,11 +121,7 @@ EXPORT_SYMBOL(get_options); * @retptr: (output

Re: [PATCH v4] lib: add size unit t/p/e to memparse

2014-06-16 Thread Gui Hecheng
On Mon, 2014-06-16 at 18:29 -0700, David Rientjes wrote: On Tue, 17 Jun 2014, Gui Hecheng wrote: diff --git a/lib/cmdline.c b/lib/cmdline.c index d4932f7..76a712e 100644 --- a/lib/cmdline.c +++ b/lib/cmdline.c @@ -121,11 +121,7 @@ EXPORT_SYMBOL(get_options

[PATCH] btrfs-progs: clean fsck noise for free inode generation 0

2014-06-17 Thread Gui Hecheng
normally, the free inode generation will be 0. In this condition, no noise should be outputed. Also, check 0-sized inode eariler together with 0-generationed inode. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- free-space-cache.c | 10 +++--- 1 file changed, 7 insertions(+), 3

[PATCH 1/4] btrfs-progs: cleanup duplicate assignment of variable leaf for btrfs-image

2014-06-18 Thread Gui Hecheng
The value of variable leaf in while loop don't have to be set for every round. Just move it outside. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-image.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/btrfs-image.c b/btrfs-image.c index cf1fe2d

[PATCH 4/4] btrfs-progs: update manpage for btrfs-image with -m option added

2014-06-18 Thread Gui Hecheng
The btrfs-image support multiple devices with -m specified. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- Documentation/btrfs-image.txt | 3 +++ btrfs-image.c | 1 + 2 files changed, 4 insertions(+) diff --git a/Documentation/btrfs-image.txt b/Documentation/btrfs

[PATCH 2/4] btrfs-progs: deal with invalid option combinations for btrfs-image

2014-06-18 Thread Gui Hecheng
For btrfs-image, dumpmay not come with option '-o' -r may not come with option '-c', '-s', '-w', dev_cnt != 1 -m may not come with dev_cnt 2 All of the above should be regarded as invalid combinations, and the usage will show up. Signed-off-by: Gui Hecheng

[PATCH 3/4] btrfs-progs: delete invalid output file when btrfs-image failed

2014-06-18 Thread Gui Hecheng
When btrfs-image failed to create an image, the invalid output file had better be deleted to prevent being used mistakenly in the future. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-image.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/btrfs

Re: [PATCH 3/4] btrfs-progs: delete invalid output file when btrfs-image failed

2014-06-23 Thread Gui Hecheng
On Mon, 2014-06-23 at 16:15 +0200, David Sterba wrote: On Thu, Jun 19, 2014 at 09:46:02AM +0800, Gui Hecheng wrote: When btrfs-image failed to create an image, the invalid output file had better be deleted to prevent being used mistakenly in the future. Signed-off-by: Gui Hecheng guihc.f

Re: [PATCH 2/4] btrfs-progs: deal with invalid option combinations for btrfs-image

2014-06-23 Thread Gui Hecheng
On Mon, 2014-06-23 at 16:12 +0200, David Sterba wrote: On Thu, Jun 19, 2014 at 09:46:01AM +0800, Gui Hecheng wrote: For btrfs-image, dumpmay not come with option '-o' -r may not come with option '-c', '-s', '-w', dev_cnt != 1 -m may not come with dev_cnt 2 All

[PATCH v2 2/4] btrfs-progs: deal with invalid option combinations for btrfs-image

2014-06-23 Thread Gui Hecheng
For btrfs-image, dumpmay not come with option '-o' -r may not come with option '-c', '-s', '-w', dev_cnt != 1 -m may not come with dev_cnt 2 All of the above should be regarded as invalid combinations, and the usage will show up. Signed-off-by: Gui Hecheng

[PATCH v2 3/4] btrfs-progs: delete invalid output file when btrfs-image failed

2014-06-23 Thread Gui Hecheng
When btrfs-image failed to create an image, the invalid output file had better be deleted to prevent being used mistakenly in the future. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog v1-v2: use a new local variable to avoid return value overwritten --- btrfs-image.c

Re: [PATCH v2 2/4] btrfs-progs: deal with invalid option combinations for btrfs-image

2014-06-23 Thread Gui Hecheng
On Tue, 2014-06-24 at 10:36 +0800, Gui Hecheng wrote: For btrfs-image, dumpmay not come with option '-o' -r may not come with option '-c', '-s', '-w', dev_cnt != 1 -m may not come with dev_cnt 2 All of the above should be regarded as invalid combinations

Re: [PATCH v2 3/4] btrfs-progs: delete invalid output file when btrfs-image failed

2014-06-23 Thread Gui Hecheng
On Tue, 2014-06-24 at 10:38 +0800, Gui Hecheng wrote: When btrfs-image failed to create an image, the invalid output file had better be deleted to prevent being used mistakenly in the future. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog v1-v2: use a new local

[PATCH v3 2/4] btrfs-progs: deal with invalid option combinations for btrfs-image

2014-06-23 Thread Gui Hecheng
For btrfs-image, dumpmay not come with option '-o' -r may not come with option '-c', '-s', '-w', dev_cnt != 1 -m may not come with dev_cnt 2 All of the above should be regarded as invalid combinations, and the usage will show up. Signed-off-by: Gui Hecheng

[PATCH v3 3/4] btrfs-progs: delete invalid output file when btrfs-image failed

2014-06-23 Thread Gui Hecheng
When btrfs-image failed to create an image, the invalid output file had better be deleted to prevent being used mistakenly in the future. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog v1-v2: use a new local variable to avoid return value overwritten v2-v3: fix

Re: Assertion `!(exist-nmirrors = 2)' failed

2014-06-24 Thread Gui Hecheng
On Tue, 2014-06-24 at 15:43 +0200, Karl-Philipp Richter wrote: Hi together, I wondered whether $ sudo btrfs rescue chunk-recover -y /dev/loop2p1 btrfs: chunk-recover.c:124: process_extent_buffer: Assertion `!(exist-nmirrors = 2)' failed. $ echo $? 134 Hi, Karl For the

Re: [PATCH 2/3] btrfs-progs: fix max mirror number error for chunk-recover

2014-06-24 Thread Gui Hecheng
On Tue, 2014-06-24 at 21:17 -0500, Eric Sandeen wrote: On 6/11/14, 9:25 PM, Gui Hecheng wrote: When run chunk-recover on a health btrfs(data profile raid0, with plenty of data), the program has a chance to abort on the number of mirrors of an extent. According to the kernel code

Re: [PATCH 2/3] btrfs-progs: fix max mirror number error for chunk-recover

2014-06-25 Thread Gui Hecheng
On Wed, 2014-06-25 at 00:25 -0500, Eric Sandeen wrote: On 6/25/14, 12:14 AM, Eric Sandeen wrote: On 6/24/14, 9:22 PM, Gui Hecheng wrote: On Tue, 2014-06-24 at 21:17 -0500, Eric Sandeen wrote: On 6/11/14, 9:25 PM, Gui Hecheng wrote: When run chunk-recover on a health btrfs(data profile

[PATCH] btrfs-progs: replace BTRFS_NUM_MIRRORS with BTRFS_MAX_MIRRORS

2014-06-25 Thread Gui Hecheng
/BTRFS_MAX_MIRRORS This provides convenience for future use. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- chunk-recover.c | 8 +++- ctree.h | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chunk-recover.c b/chunk-recover.c index 8bc5bc3..b638ada 100644

[PATCH 5/6] btrfs-progs: limit minimal num of args for btrfs-image

2014-06-25 Thread Gui Hecheng
The btrfs-image requires at least 2 args to run, one for the source dev/file, the other for the target dev/file. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-image.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/btrfs-image.c b/btrfs-image.c index e0aabfd..b13f236

[PATCH 1/6] btrfs-progs: fix btrfs-image old_restore fsck failure

2014-06-25 Thread Gui Hecheng
Steps to reproduce: # mkfs.btrfs -f dev1 # btrfs-image dev1 image_file # btrfs-image -r -o image_file dev2 # btrfs check dev2 btrfs check output: : read block failed check_tree_block : Couldn't read tree root : Couldn't open file system The

[PATCH 2/6] btrfs-progs: deal with malloc failure in btrfs-image

2014-06-25 Thread Gui Hecheng
Handle the malloc failure for dump_worker in the same way as the restore worker. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-image.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/btrfs-image.c b/btrfs-image.c index c90bca8..7131001

[PATCH 6/6] btrfs-progs: use BTRFS_SUPER_INFO_SIZE to replace raw 4096 in btrfs-image

2014-06-25 Thread Gui Hecheng
Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-image.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/btrfs-image.c b/btrfs-image.c index b13f236..ed0b6ec 100644 --- a/btrfs-image.c +++ b/btrfs-image.c @@ -1163,7 +1163,7 @@ static int

[PATCH 4/6] btrfs-progs: cleanup possible silent failure in btrfs-image

2014-06-25 Thread Gui Hecheng
If the malloc above fails, the btrfs-image will exit directly without any error messages. Now just return the ENOMEM errno and let the caller prompt the error message. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-image.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion

[PATCH 3/6] btrfs-progs: cleanup unnecessary free if malloc fails in btrfs-image

2014-06-25 Thread Gui Hecheng
Don't bother free the buffer if the malloc failed. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs-image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btrfs-image.c b/btrfs-image.c index 7131001..2d482c3 100644 --- a/btrfs-image.c +++ b/btrfs-image.c

Re: [PATCH 5/6] btrfs-progs: limit minimal num of args for btrfs-image

2014-06-29 Thread Gui Hecheng
On Fri, 2014-06-27 at 14:35 +0200, David Sterba wrote: On Thu, Jun 26, 2014 at 10:53:05AM +0800, Gui Hecheng wrote: @@ -2521,6 +2521,9 @@ int main(int argc, char *argv[]) } argc = argc - optind; + if (argc 2) Please use the check_argc_min helper instead. Thanks. Yes

[PATCH v2 2/2] btrfs-progs: limit minimal num of args for btrfs-image

2014-06-29 Thread Gui Hecheng
The btrfs-image requires at least 2 args to run, one for the source dev/file, the other for the target dev/file. This patch depends on patch: btrfs-progs: move the check_argc_* functions into utils.c Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- changelog v1-v2: use

[PATCH 1/2] btrfs-progs: move the check_argc_* functions into utils.c

2014-06-29 Thread Gui Hecheng
. Signed-off-by: Gui Hecheng guihc.f...@cn.fujitsu.com --- btrfs.c | 41 + utils.c | 47 +++ utils.h | 7 +++ 3 files changed, 55 insertions(+), 40 deletions(-) diff --git a/btrfs.c b/btrfs.c index 25257b6..685455f

Re: [PATCH 1/2] btrfs-progs: move the check_argc_* functions into utils.c

2014-07-01 Thread Gui Hecheng
On Wed, 2014-07-02 at 01:11 +0200, David Sterba wrote: On Mon, Jun 30, 2014 at 11:54:11AM +0800, Gui Hecheng wrote: To let the independent tools(e.g. btrfs-image, btrfs-convert, etc.) share the convenience of check_argc_* functions, just move it into utils.c. Also add a new function

[PATCH 1/2] btrfs-progs: add ask_user confirmation for btrfstune clear seeding flag

2014-07-02 Thread Gui Hecheng
Clear the seeding flag may cause the original filesystem to be writable, which is dangerous. In this case, add user confirmation check when clearing seeding flag. Also warn the user that the fs is in a dangerous condition when the seeding flag is cleared if it it forced to. Signed-off-by: Gui

Re: [PATCH] btrfs-progs: prevent select invalid dev super after dev replace

2014-07-03 Thread Gui Hecheng
On Thu, 2014-07-03 at 20:10 +0200, David Sterba wrote: On Thu, Jul 03, 2014 at 10:06:35AM +0800, Gui Hecheng wrote: After dev replace, we should not select the superblock of the replaced dev. Otherwise, all the superblokcs will be overwritten by this invalid superblock. To prevent

Re: [PATCH] btrfs-progs: add mount status check for btrfs-image

2014-07-03 Thread Gui Hecheng
On Thu, 2014-07-03 at 18:58 +0200, David Sterba wrote: On Thu, Jul 03, 2014 at 10:06:34AM +0800, Gui Hecheng wrote: The btrfs-image tool should not be run on a mounted filesystem. Should not, but for some values of sometimes it makes sense, eg. capturing image of an otherwise quiescent

Re: [PATCH 1/2] btrfs-progs: add ask_user confirmation for btrfstune clear seeding flag

2014-07-03 Thread Gui Hecheng
On Thu, 2014-07-03 at 18:51 +0200, David Sterba wrote: On Thu, Jul 03, 2014 at 10:06:33AM +0800, Gui Hecheng wrote: Clear the seeding flag may cause the original filesystem to be writable, which is dangerous. Can you please describe the dangerous scenario a bit more? This would also go

[PATCH v2] btrfs-progs: add ask_user confirmation for btrfstune clear seeding flag

2014-07-06 Thread Gui Hecheng
, the new device will not be mountable. Even set the seeding flag back will not recovery this problem, because the generation has been changed. So clear the seeding flag has the chance to damage the derived new fs. So I add user confirmation check when clearing seeding flag. Signed-off-by: Gui Hecheng

[PATCH v2] btrfs-progs: update manpage with new option -f for btrfstune

2014-07-06 Thread Gui Hecheng
The new option -f will force to do dangerous changes. e.g. clear the seeding flag. --- changelog v1-v2: use -f instead of -y --- Documentation/btrfstune.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/btrfstune.txt b/Documentation/btrfstune.txt

  1   2   3   >