[PATCH v5 05/15] btrfs-progs: scrub: Introduce functions to scrub mirror based tree block

2017-07-15 Thread Gu Jinxiang
jitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- disk-io.c | 4 +- disk-io.h | 2 + scrub.c | 145 ++ 3 files changed, 149 insertions(+), 2 deletions(-) diff --git a/disk-io.c b/disk-io.c index 8cf80

[PATCH v5 07/15] btrfs-progs: scrub: Introduce function to scrub one mirror-based extent

2017-07-15 Thread Gu Jinxiang
ed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 148 +++- 1 file changed, 147 insertions(+), 1 deletion(-) diff --git a/scrub.c b/scrub.c index 5d625e6..ebdde5b 10

[PATCH v5 04/15] btrfs-progs: scrub: Introduce structures to support offline scrub for RAID56

2017-07-15 Thread Gu Jinxiang
on, so they don't need any extra structures for these profiles. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- Makefile | 2 +- scrub.c | 124 +++ 2 files changed, 12

[PATCH v5 01/15] btrfs-progs: Introduce new btrfs_map_block function which returns more unified result.

2017-07-15 Thread Gu Jinxiang
old mirror_num basic one can't handle well). Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- volumes.c | 181 ++ volumes.h | 78 +++ 2 files

[PATCH v5 06/15] btrfs-progs: scrub: Introduce functions to scrub mirror based data blocks

2017-07-15 Thread Gu Jinxiang
Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Su Yue <suy.f...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 212 1 file changed, 212 insertions(+) diff --git a/scrub.c b/scrub.c index

[PATCH v5 10/15] btrfs-progs: extent-tree: Introduce function to check if there is any extent in given range.

2017-07-15 Thread Gu Jinxiang
return 0 if no extent is found. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- ctree.h | 2 ++ extent-tree.c | 60 +++ 2 files changed, 62 insertions(+) diff --gi

[PATCH v5 15/15] btrfs-progs: scrub: Introduce offline scrub function

2017-07-15 Thread Gu Jinxiang
ty report, while kernel will only report data stripe error. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Su <suy.f...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- Documentation/btrfs-scrub.asciidoc | 9 +++ cmds-s

[PATCH v5 14/15] btrfs-progs: scrub: Introduce function to check a whole block group

2017-07-15 Thread Gu Jinxiang
check full stripe by full stripe. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 92 + 1 file changed, 92 insertions(+) diff --git a/scrub.c b/scrub.c inde

[PATCH v5 11/15] btrfs-progs: scrub: Introduce function to recover data parity

2017-07-15 Thread Gu Jinxiang
From: Qu Wenruo <quwen...@cn.fujitsu.com> Introduce function, recover_from_parities(), to recover data stripes. It just wraps raid56_recov() with extra check functions to scrub_full_stripe structure. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu

[PATCH v5 02/15] btrfs-progs: Allow __btrfs_map_block_v2 to remove unrelated stripes

2017-07-15 Thread Gu Jinxiang
enruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- volumes.c | 103 +- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/volumes.c b/volumes.c index 3116f8c..66fe365 100644 --- a/volumes.c ++

[PATCH v5 03/15] btrfs-progs: csum: Introduce function to read out data csums

2017-07-15 Thread Gu Jinxiang
f-by: Su Yue <suy.f...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- Makefile | 2 +- csum.c | 134 +++ ctree.h | 4 ++ kerncompat.h | 3 ++ utils.h | 6 +++ 5 files changed, 148 i

[PATCH v5 13/15] btrfs-progs: scrub: Introduce a function to scrub one full stripe

2017-07-15 Thread Gu Jinxiang
csum mismatch Best case, just check if P/Q matches. If P/Q matches, everything is good Else, just P/Q is screwed up, still recoverable. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 285 ++

[PATCH v5 09/15] btrfs-progs: scrub: Introduce function to verify parities

2017-07-15 Thread Gu Jinxiang
Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 69 + 1 file changed, 69 insertions(+) diff --git a/scrub.c b/scrub.c index b544587..33d5ce2 100644 --- a/scrub.c +++ b/scru

[PATCH v5 12/15] btrfs-progs: scrub: Introduce helper to write a full stripe

2017-07-15 Thread Gu Jinxiang
From: Qu Wenruo <quwen...@cn.fujitsu.com> Introduce a internal helper, write_full_stripe() to calculate P/Q and write the whole full stripe. This is useful to recover RAID56 stripes. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.co

[PATCH v5 08/15] btrfs-progs: scrub: Introduce function to scrub one data stripe

2017-07-15 Thread Gu Jinxiang
which is completely valid for case like nodatasum, it will just record it, but not report as error. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 129 1 file chang

[PATCH 00/15] Btrfs-progs offline scrub

2017-07-18 Thread Gu Jinxiang
r by sector. And make repair to be supported. Gu Jinxiang (1): btrfs-progs: Introduce new btrfs_map_block function which returns more unified result. Qu Wenruo (14): btrfs-progs: Allow __btrfs_map_block_v2 to remove unrelated stripes btrfs-progs: csum: Introduce function to read out d

[PATCH v6 00/15] Btrfs-progs offline scrub

2017-07-20 Thread Gu Jinxiang
For any one who wants to try it, it can be get from my repo: https://github.com/gujx2017/btrfs-progs/tree/offline_scrub In this v6, fix for make error reported by Marco Lorenzo Crociani. Several reports on kernel scrub screwing up good data stripes are in ML for sometime. And since kernel scrub

[PATCH v6 08/15] btrfs-progs: scrub: Introduce function to scrub one data stripe

2017-07-20 Thread Gu Jinxiang
which is completely valid for case like nodatasum, it will just record it, but not report as error. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 129 1 file chang

[PATCH v6 14/15] btrfs-progs: scrub: Introduce function to check a whole block group

2017-07-20 Thread Gu Jinxiang
check full stripe by full stripe. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 92 + 1 file changed, 92 insertions(+) diff --git a/scrub.c b/scrub.c inde

[PATCH v6 15/15] btrfs-progs: scrub: Introduce offline scrub function

2017-07-20 Thread Gu Jinxiang
ty report, while kernel will only report data stripe error. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Su <suy.f...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- Documentation/btrfs-scrub.asciidoc | 9 +++ cmds-s

[PATCH v6 11/15] btrfs-progs: scrub: Introduce function to recover data parity

2017-07-20 Thread Gu Jinxiang
From: Qu Wenruo Introduce function, recover_from_parities(), to recover data stripes. It just wraps raid56_recov() with extra check functions to scrub_full_stripe structure. Signed-off-by: Qu Wenruo --- scrub.c | 51

[PATCH v6 06/15] btrfs-progs: scrub: Introduce functions to scrub mirror based data blocks

2017-07-20 Thread Gu Jinxiang
Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Su Yue <suy.f...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 212 1 file changed, 212 insertions(+) diff --git a/scrub.c b/scrub.c index

[PATCH v6 12/15] btrfs-progs: scrub: Introduce helper to write a full stripe

2017-07-20 Thread Gu Jinxiang
From: Qu Wenruo Introduce a internal helper, write_full_stripe() to calculate P/Q and write the whole full stripe. This is useful to recover RAID56 stripes. Signed-off-by: Qu Wenruo --- scrub.c | 44

[PATCH v6 13/15] btrfs-progs: scrub: Introduce a function to scrub one full stripe

2017-07-20 Thread Gu Jinxiang
From: Qu Wenruo Introduce a new function, scrub_one_full_stripe(), to check a full stripe. It handles the full stripe scrub in the following steps: 0) Check if we need to check full stripe If full stripe contains no extent, why waste our CPU and IO? 1) Read out full

[PATCH v6 07/15] btrfs-progs: scrub: Introduce function to scrub one mirror-based extent

2017-07-20 Thread Gu Jinxiang
ed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 148 +++- 1 file changed, 147 insertions(+), 1 deletion(-) diff --git a/scrub.c b/scrub.c index 74bfe01..01e8b6b 10

[PATCH v6 09/15] btrfs-progs: scrub: Introduce function to verify parities

2017-07-20 Thread Gu Jinxiang
Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- scrub.c | 69 + 1 file changed, 69 insertions(+) diff --git a/scrub.c b/scrub.c index 05f4608..513725f 100644 --- a/scrub.c +++ b/scru

[PATCH v6 10/15] btrfs-progs: extent-tree: Introduce function to check if there is any extent in given range.

2017-07-20 Thread Gu Jinxiang
return 0 if no extent is found. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- ctree.h | 2 ++ extent-tree.c | 60 +++ 2 files changed, 62 insertions(+) diff --gi

[PATCH v6 04/15] btrfs-progs: scrub: Introduce structures to support offline scrub for RAID56

2017-07-20 Thread Gu Jinxiang
on, so they don't need any extra structures for these profiles. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- Makefile | 2 +- scrub.c | 119 +++ 2 files changed, 12

[PATCH v6 02/15] btrfs-progs: Allow __btrfs_map_block_v2 to remove unrelated stripes

2017-07-20 Thread Gu Jinxiang
From: Qu Wenruo For READ, caller normally hopes to get what they request, other than full stripe map. In this case, we should remove unrelated stripe map, just like the following case: 32K 96K |<-request range->| 0

[PATCH v6 05/15] btrfs-progs: scrub: Introduce functions to scrub mirror based tree block

2017-07-20 Thread Gu Jinxiang
jitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- disk-io.c | 4 +- disk-io.h | 2 + scrub.c | 145 ++ 3 files changed, 149 insertions(+), 2 deletions(-) diff --git a/disk-io.c b/disk-io.c index 8cf80

[PATCH v6 01/15] btrfs-progs: Introduce new btrfs_map_block function which returns more unified result.

2017-07-20 Thread Gu Jinxiang
nd can even handle things like N-way RAID1 (which old mirror_num basic one can't handle well). Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- volumes.c | 181 +

[PATCH v6 03/15] btrfs-progs: csum: Introduce function to read out data csums

2017-07-20 Thread Gu Jinxiang
f-by: Su Yue <suy.f...@cn.fujitsu.com> Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- Makefile | 2 +- csum.c | 130 +++ ctree.h | 4 ++ kerncompat.h | 3 ++ utils.h | 6 +++ 5 files changed, 144 i

[PATCH] btrfs-progs: Move check of mixed block early.

2017-07-24 Thread Gu Jinxiang
sts/fuzz-tests/images/bko-154961-heap-overflow-chunk-items.raw.restored mayfail: returned code 134 (SIGABRT), not ignored Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- cmds-check.c | 32 +--- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/cmd

[PATCH] btrfs-progs: mkfs: Replace number with enum

2017-06-28 Thread Gu Jinxiang
For code maintainability and scalability, replace hardcoded constant with a meaningful enum. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- mkfs/common.c | 47 --- mkfs/common.h | 14 +- 2 files changed, 37 insertions(+), 24 del

RE: [PATCH] btrfs-progs: mkfs: Replace number with enum

2017-08-22 Thread Gu, Jinxiang
> -Original Message- > From: David Sterba [mailto:dste...@suse.cz] > Sent: Tuesday, August 22, 2017 10:04 PM > To: Gu, Jinxiang/顾 金香 <g...@cn.fujitsu.com>; linux-btrfs@vger.kernel.org > Subject: Re: [PATCH] btrfs-progs: mkfs: Replace number with enum > > On

[PATCH 1/2] btrfs-progs: add necessary close(fd) in mkfs

2017-08-18 Thread Gu Jinxiang
Add some close(fd) when error occures in mkfs. And add close(fd) when end use it. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- mkfs/main.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/mkfs/main.c b/mkfs/main.c index 2b109a5..ec82565 100644 --- a/mkfs/main.c +++ b/mkfs/

[PATCH 2/2] btrfs-progs: delete not-used parameter fd

2017-08-18 Thread Gu Jinxiang
Parameter fd is not used in function make_image and traverse_directory of mkfs. Delete it. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- mkfs/main.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mkfs/main.c b/mkfs/main.c index ec82565..3e9c1b8

[PATCH] btrfs-progs: mkfs: Replace number with a macro

2017-06-26 Thread Gu Jinxiang
For code maintainability and scalability, replace number with a macro of member blocks in btrfs_mkfs_config. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- mkfs/common.c | 2 +- mkfs/common.h | 5 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mkfs/common.c

[PATCH v2] btrfs-progs: mkfs: Replace number with a macro

2017-06-26 Thread Gu Jinxiang
For code maintainability and scalability, replace number with a macro of member blocks in btrfs_mkfs_config. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- Changes since v1: Missing a using place. And modify it. mkfs/common.c | 4 ++-- mkfs/common.h | 5 - 2 files chan

[no subject]

2017-05-08 Thread Gu, Jinxiang
subscribe linux-btrfs

[no subject]

2017-05-08 Thread Gu, Jinxiang
subscribe linux-btrfs

[PATCH RESEND 2/2] btrfs-progs: Add some check for sectorsize and nodesize

2017-06-28 Thread Gu Jinxiang
Add some check for sectorsize and nodesize, make it consistent with kernel. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- convert/main.c | 6 +- fsfeatures.h | 2 +- mkfs/main.c| 8 +--- utils.c| 21 +++-- 4 files changed, 22 insertions(

[PATCH RESEND 1/2] btrfs-progs: Replace number with a exsiting macro

2017-06-28 Thread Gu Jinxiang
Use macro SZ_4K to replace number 4096 when define macro BTRFS_SUPER_INFO_SIZE. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- disk-io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk-io.h b/disk-io.h index dfe4cf0..5c293eb 100644 --- a/disk-io.h +++ b/dis

btrfs-progs: Replace number with a exsiting macro

2017-06-28 Thread Gu Jinxiang
Use macro SZ_4K to replace number 4096 when define macro BTRFS_SUPER_INFO_SIZE. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- disk-io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk-io.h b/disk-io.h index dfe4cf0..5c293eb 100644 --- a/disk-io.h +++ b/dis

btrfs-progs: Add some check for sectorsize and nodesize

2017-06-28 Thread Gu Jinxiang
Add some check for sectorsize and nodesize, make it consistent with kernel. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- convert/main.c | 6 +- fsfeatures.h | 2 +- mkfs/main.c| 8 +--- utils.c| 21 +++-- 4 files changed, 22 insertions(

[PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS

2017-09-18 Thread Gu Jinxiang
Resovle the inconsistent of mount option. Btrfs use MOUNT_OPTIONS for both scrath_dev and test_dev. Change to MOUNT_OPTIONS for scratch mount, and TEST_FS_MOUNT_OPTS for test dev mount. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- As mentioned by https://patchwork.kernel.org/patch/9

[PATCH 2/2] xfstests: Add echo logic to show the information of TEST_FS_MOUNT_OPTS

2017-09-18 Thread Gu Jinxiang
There is message to show user the scrath mount, but no message to point TEST_FS_MOUNT_OPTS of test mount. Add logic to show test mount. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- check | 1 + common/rc | 13 + 2 files changed, 14 insertions(+) diff --git a/c

[PATCH] btrfs: Fix bug for misused dev_t when lookup in dev state hash table.

2017-10-17 Thread Gu Jinxiang
From: Gu JinXiang <g...@cn.fujitsu.com> Fix bug of commit 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and partitions index"). In this modify, use bio_dev(bio) to find dev state in function __btrfsic_submit_bio. But when dev_state added to hashtable, i

[PATCH v3] btrfs: Use bd_dev to generate index when dev_state_hashtable add items.

2017-10-11 Thread Gu Jinxiang
From: Gu JinXiang <g...@cn.fujitsu.com> Fix missing modify of commit f8f84b2dfda5 ("btrfs: index check-integrity state hash by a dev_t"). Function btrfsic_dev_state_hashtable_lookup use dev_t to generate hashval when lookup a btrfsic_dev_state in hash table. So when add a b

[PATCH 1/2] btrfs-progs: Use clean_tree_block when btrfs_update_root fail

2017-09-05 Thread Gu Jinxiang
In btrfs_fsck_reinit_root, when btrfs_alloc_free_block fail, it will update on original root. Before update it, used btrfs_mark_buffer_dirty to set the flag to EXTENT_DIRTY. So, we should call clean_tree_block to clear the flag if update fail. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.

[PATCH 2/2] btrfs-progs: Replace some BUG_ON by return

2017-09-05 Thread Gu Jinxiang
/home/fnst/btrfs/btrfs-progs/tests/fuzz-tests/images/bko-155621-bad-block-group-offset.raw.restored mayfail: returned code 134 (SIGABRT), not ignored test failed for case 003-multi-check-unmounted Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- extent-tree.

[PATCH] btrfs: Use bd_dev to generate index when dev_state_hashtable add items.

2017-09-29 Thread Gu Jinxiang
From: Gu JinXiang <g...@cn.fujitsu.com> Fix bug of (). Signed-off-by: Gu JinXiang <g...@cn.fujitsu.com> --- fs/btrfs/check-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 9d3854839038..

[PATCH] btrfs-progs: Resolve memory-leak in btrfs qgroup show when quota disabled

2017-09-28 Thread Gu Jinxiang
From: Gu JinXiang <g...@cn.fujitsu.com> When quota disabled, btrfs qgroup show exit with a error message, but the allocated memory is not freed. By the way, this bug marked as issue#20 in github. Signed-off-by: Gu JinXiang <g...@cn.fujitsu.com> --- cmds-qgroup.c | 17 -

RE: [PATCH] btrfs-progs: Resolve memory-leak in btrfs qgroup show when quota disabled

2017-09-28 Thread Gu, Jinxiang
> To: Gu, Jinxiang/顾 金香 <g...@cn.fujitsu.com> > Cc: linux-btrfs@vger.kernel.org > Subject: Re: [PATCH] btrfs-progs: Resolve memory-leak in btrfs qgroup show > when quota disabled > > On Tue, Sep 26, 2017 at 05:28:31PM +0800, Gu Jinxiang wrote: > > When quota disabled, btrf

[PATCH] btrfs-progs: Resolve memory-leak in btrfs qgroup show when quota disabled

2017-09-26 Thread Gu Jinxiang
When quota disabled, btrfs qgroup show exit with a error message, but the allocated memory is not freed. By the way, this bug marked as issue#20 in github. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- cmds-qgroup.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-)

RE: [PATCH 00/15] Btrfs-progs offline scrub

2017-08-22 Thread Gu, Jinxiang
Ping -Original Message- From: linux-btrfs-ow...@vger.kernel.org [mailto:linux-btrfs-ow...@vger.kernel.org] On Behalf Of Gu Jinxiang Sent: Tuesday, July 18, 2017 2:34 PM To: linux-btrfs@vger.kernel.org Cc: quwenruo.bt...@gmx.com Subject: [PATCH 00/15] Btrfs-progs offline scrub For any

[PATCH] btrfs-progs: Make in-place exit to a common exit block

2017-08-21 Thread Gu Jinxiang
As comment pointed out by David, make in-place exit to a common exit block of mkfs. v1: Add some close(fd) when error occures in mkfs. And add close(fd) when end use it. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- mkfs/main.

[PATCH] btrfs-progs: Make the process of create root tree to a function

2017-08-25 Thread Gu Jinxiang
make_btrfs is too long to understand, make creatation of root tree in a function. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- mkfs/common.c | 136 +++--- 1 file changed, 64 insertions(+), 72 deletions(-) diff --git a/mkfs/comm

RE: [PATCH] btrfs: Use bd_dev to generate index when dev_state_hashtable add items.

2017-10-08 Thread Gu, Jinxiang
urday, September 30, 2017 2:05 AM > To: Gu, Jinxiang/顾 金香 <g...@cn.fujitsu.com> > Cc: linux-btrfs@vger.kernel.org; h...@lst.de > Subject: Re: [PATCH] btrfs: Use bd_dev to generate index when > dev_state_hashtable add items. > > On Fri, Sep 29, 2017 at 04:16:35PM +0800,

[PATCH v2] btrfs: Use bd_dev to generate index when dev_state_hashtable add items.

2017-10-10 Thread Gu Jinxiang
From: Gu JinXiang <g...@cn.fujitsu.com> Fix bug of (). Description of this bug: Use MOUNT_OPTIONS="-o check_int" when run xfstest, device can not be mount successfully. So xfstest can not run. Signed-off-by: Gu JinXiang <g...@cn.fujitsu.com> --- fs/btrfs/check-inte

[PATCH v2] btrfs: Fix bug for misused dev_t when lookup in dev state hash table.

2017-10-18 Thread Gu Jinxiang
From: Gu JinXiang <g...@cn.fujitsu.com> Fix bug of commit 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and partitions index"). In this modify, use bio_dev(bio) to find dev state in function __btrfsic_submit_bio. But when dev_state added to hashtable, i

RE: [PATCH] btrfs: Fix bug for misused dev_t when lookup in dev state hash table.

2017-10-17 Thread Gu, Jinxiang
Hi, > -Original Message- > From: Nikolay Borisov [mailto:nbori...@suse.com] > Sent: Tuesday, October 17, 2017 9:36 PM > To: Gu, Jinxiang/顾 金香 <g...@cn.fujitsu.com>; linux-btrfs@vger.kernel.org; > h...@lst.de > Subject: Re: [PATCH] btrfs: Fix bug for misused

[PATCH 4/5] btrfs-progs: check null pointer before use it

2017-11-24 Thread Gu Jinxiang
led for case 003-multi-check-unmounted Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- cmds-check.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmds-check.c b/cmds-check.c index 49b0792b..3f4244a2 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -4070,6 +4070,8 @@ static int chec

[PATCH 3/5] btrfs-progs: return error to upper caller instead of BUG_ON

2017-11-24 Thread Gu Jinxiang
/bko-172811.raw.restored Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- cmds-check.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmds-check.c b/cmds-check.c index ac0375e5..49b0792b 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -3489,9 +3489,10 @@ stat

[PATCH 1/5] btrfs-progs: Add location check when process share_data_ref item

2017-11-24 Thread Gu Jinxiang
sum /home/adam/btrfs/btrfs-progs/tests/fuzz-tests/images/bko-156731.raw.restored mayfail: returned code 134 (SIGABRT), not ignored test failed for case 003-multi-check-unmounted Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- cmds-check.c | 8 1 file changed, 8 insertions

[PATCH 5/5] btrfs-progs: return error to caller instead of BUG_ON

2017-11-24 Thread Gu Jinxiang
-tree /home/adam/btrfs/btrfs-progs/tests/fuzz-tests/images/bko-172811.raw.restored mayfail: returned code 134 (SIGABRT), not ignored Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- ctree.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ctree.c b/ctree.c

[PATCH 2/5] btrfs-progs: Add logic to judge the level between parent and child

2017-11-24 Thread Gu Jinxiang
failed (ignored, ret=139): /home/adam/btrfs/btrfs-progs/btrfs check --init-csum-tree /home/adam/btrfs/btrfs-progs/tests/fuzz-tests/images/bko-161821.raw.restored mayfail: returned code 139 (SEGFAULT), not ignored Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- cmds-

[PATCH] btrfs-progs: Allow to open filesystem with some broken tree roots

2017-11-21 Thread Gu Jinxiang
e the csum tree's bytenr is not correct. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- cmds-inspect-dump-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c index 4e72c08a..9ae4eb23 100644 --- a/cmds-inspect-dump-t

[PATCH] btrfs-progs: use enum instead of constant value

2017-12-05 Thread Gu Jinxiang
Add a enum for reada of btrfs_path to be consistent with kernel. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- ctree.c | 3 ++- ctree.h | 2 +- extent-tree.c | 12 ++-- free-space-tree.c | 2 +- qgroup-verify.c | 2 +- volumes.c | 4 +

[PATCH] btrfs: use enum instead of constant value

2017-12-05 Thread Gu Jinxiang
Use enum READA_BACK instead of value 1 to keep source robust. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- fs/btrfs/free-space-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c index a5e34de..a

RE: [PATCH] xfstests: Add message indicating btrfs-progs support FST in read-only mode

2017-10-26 Thread Gu, Jinxiang
Hi, > -Original Message- > From: Eryu Guan [mailto:eg...@redhat.com] > Sent: Thursday, October 26, 2017 2:52 PM > To: Gu, Jinxiang/顾 金香 <g...@cn.fujitsu.com> > Cc: fste...@vger.kernel.org; linux-btrfs@vger.kernel.org > Subject: Re: [PATCH] xfstests: Add messag

[PATCH] xfstests: Add message indicating btrfs-progs support FST in read-only mode

2017-10-25 Thread Gu Jinxiang
From: Gu JinXiang <g...@cn.fujitsu.com> btrfs-progs now support FST in read-only mode, so when space_cache=v2 enabled, this test case will fail. Add message to help user to understand this status. Signed-off-by: Gu JinXiang <g...@cn.fujitsu.com> --- tests/btrfs/012 | 6 ++ 1 fil

RE: [PATCH] btrfs-progs: convert: Open the fs readonly for rollback

2017-10-26 Thread Gu, Jinxiang
ck. > > So open the fs RO for rollback, to avoid v2 space cache problem. > > Reported-by: Gu Jinxiang <g...@cn.fujitsu.com> > Signed-off-by: Qu Wenruo <w...@suse.com> > --- > convert/main.c | 8 +++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff -

[RFC PATCH 1/3] btrfs-progs: Add EXEC parameter in Makefile

2017-10-31 Thread Gu Jinxiang
When EXEC parameter is set, do not build this tool. run the test tool with a given path.(/usr/bin, /usr/local/bin) Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- Makefile| 32 +++- tests/README.md | 10 ++ 2 files changed, 41 insertions

[RFC PATCH 3/3] btrfs-progs: Add support for running tools with given path(EXEC)

2017-10-31 Thread Gu Jinxiang
Modify script of every test case to use executable file of the given path(EXEC), except btrfs-corrupt-block and fssum, because they are internal tools and will not be installed. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- tests/cli-tests/001-btrfs/test.sh

[RFC PATCH 0/3] btrfs-progs: Add support for running the tools from

2017-10-31 Thread Gu Jinxiang
which relies on header files in btrfs-progs. And test-misc and test-fsck depend on btrfs-corrupt-block which is not installed after installation of btrfs-progs. I am wondering that it is necessary or not to modify those tests to run outside of btrfs-progs. Gu Jinxiang (3): btrfs-progs: Add EXEC

[RFC PATCH 2/3] btrfs-progs: Set EXEC to TOP when it not be defined

2017-10-31 Thread Gu Jinxiang
Use EXEC instead of TOP when judge whether where is executable files. And set EXEC to TOP when it is not defined in top level test script. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- tests/cli-tests.sh | 2 ++ tests/common | 18 -- tests/convert-te

[PATCH 1/2] btrfs-progs: Remove unused parameter trans

2017-10-31 Thread Gu Jinxiang
Some parameter of trans is not used indeed. Let's remove them. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- cmds-check.c | 9 - ctree.h | 3 +-- extent-tree.c | 18 -- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/cmds-check.c

[PATCH 2/2] btrfs-progs: Remove unused variable

2017-10-31 Thread Gu Jinxiang
Some variable is never used. Remove them. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- Android.mk | 1 - Makefile | 2 -- 2 files changed, 3 deletions(-) diff --git a/Android.mk b/Android.mk index 958b8bd7..de71a5d1 100644 --- a/Android.mk +++ b/Android.mk @@ -38,7

RE: [RFC PATCH 0/3] btrfs-progs: Add support for running the tools from

2017-10-31 Thread Gu, Jinxiang
> -Original Message- > From: Qu Wenruo [mailto:quwenruo.bt...@gmx.com] > Sent: Tuesday, October 31, 2017 6:36 PM > To: Gu, Jinxiang/顾 金香 <g...@cn.fujitsu.com>; linux-btrfs@vger.kernel.org > Cc: dste...@suse.cz > Subject: Re: [RFC PATCH 0/3] btrfs-progs: Add suppo

RE: [PATCH v4 1/3] btrfs: Add unprivileged ioctl which returns subvolume information

2018-05-15 Thread Gu, Jinxiang
_u64 ctransid; > + __u64 otransid; > + __u64 stransid; > + __u64 rtransid; > + /* Time corresponds to c/o/s/rtransid */ > + struct btrfs_ioctl_timespec ctime; > + struct btrfs_ioctl_timespec otime; > + struct btrfs_ioctl_timespec stime; > + s

RE: [PATCH v4 1/3] btrfs: Add unprivileged ioctl which returns subvolume information

2018-05-15 Thread Gu, Jinxiang
Hi, add a missed a comment. > -Original Message- > From: Misono Tomohiro [mailto:misono.tomoh...@jp.fujitsu.com] > Sent: Tuesday, May 15, 2018 3:04 PM > To: Gu, Jinxiang/顾 金香 <g...@cn.fujitsu.com>; linux-btrfs@vger.kernel.org > Subject: Re: [PATCH v4 1/3] btrfs: A

RE: [PATCH v4 2/3] btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF

2018-05-15 Thread Gu, Jinxiang
> -Original Message- > From: linux-btrfs-ow...@vger.kernel.org > [mailto:linux-btrfs-ow...@vger.kernel.org] On Behalf Of Tomohiro Misono > Sent: Friday, May 11, 2018 3:26 PM > To: linux-btrfs@vger.kernel.org > Subject: [PATCH v4 2/3] btrfs: Add unprivileged ioctl which returns >

[PATCH] btrfs: modify path->reada in btrfs_shrink_device to READA_BACK

2018-04-27 Thread Gu Jinxiang
off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 292266f6ab9c..1a3506a3003d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -4473,7 +4473,7 @@ int btrfs_shri

RE: [PATCH v6 2/3] btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF

2018-05-17 Thread Gu, Jinxiang
gt; + struct { > + __u64 subvolid; > + __u64 dirid; > + } rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM]; > + /* out, number of found items */ > + __u8 num_items; > + __u8 align[7]; > +}; > + > /* Error codes as r

RE: [PATCH v6 1/3] btrfs: Add unprivileged ioctl which returns subvolume information

2018-05-17 Thread Gu, Jinxiang
send/receive happens */ > + __u64 ctransid; > + __u64 otransid; > + __u64 stransid; > + __u64 rtransid; > + /* Time corresponds to c/o/s/rtransid */ > + struct btrfs_ioctl_timespec ctime; > + struct btrfs_ioctl_timespec otime; > + struct btrfs_ioctl_t

RE: [PATCH v5 2/3] btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF

2018-05-17 Thread Gu, Jinxiang
Hi, > -Original Message- > From: linux-btrfs-ow...@vger.kernel.org > [mailto:linux-btrfs-ow...@vger.kernel.org] On Behalf Of Tomohiro Misono > Sent: Wednesday, May 16, 2018 1:50 PM > To: linux-btrfs@vger.kernel.org > Subject: [PATCH v5 2/3] btrfs: Add unprivileged ioctl which returns >

[PATCH] btrfs-progs: Add DEBUG_CFLAGS_INTERNAL for libbtrfsutil

2018-05-18 Thread Gu Jinxiang
From: Gu JinXiang <g...@cn.fujitsu.com> Add DEBUG_CFLAGS_INTERNAL to LIBBTRFSUTIL_CFLAGS for libbtrfsutil's build. Signed-off-by: Gu JinXiang <g...@cn.fujitsu.com> --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index cbd85533..1e38a56f 100644 --

RE: [PATCH v6 2/3] btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF

2018-05-18 Thread Gu, Jinxiang
gt; + struct { > + __u64 subvolid; > + __u64 dirid; > + } rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM]; > + /* out, number of found items */ > + __u8 num_items; > + __u8 align[7]; > +}; > + > /* Error

[PATCH] btrfs-progs: remove BTRFS_LIST_LAYOUT_RAW

2018-05-15 Thread Gu Jinxiang
Since commit 9005b603d723 ("btrfs-progs: use libbtrfsutil for subvol show"), BTRFS_LIST_LAYOUT_RAW has no usage. So, remove it. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- btrfs-list.c | 20 btrfs-list.h | 3 +-- 2 files changed, 1 insertion(

[PATCH] btrfs: remove unnecessary if judge

2018-05-21 Thread Gu Jinxiang
Since add_excluded_extent always returns 0, no need to judge ret. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- fs/btrfs/extent-tree.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 75cfb80d2551..4d876b32e136 100644 --

[PATCH 1/2] btrfs: handle failures of set_extent_bits in add_excluded_extent

2018-05-22 Thread Gu Jinxiang
set_extent_bits may return 0/-EEXIST, so return the result in add_excluded_extent. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- fs/btrfs/extent-tree.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c

[PATCH 2/2] btrfs: propagate failures of __exclude_logged_extent to upper caller

2018-05-22 Thread Gu Jinxiang
Function btrfs_exclude_logged_extents may call __exclude_logged_extent which may fail. Propagate the failures of __exclude_logged_extent to upper caller. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- fs/btrfs/extent-tree.c | 9 +++-- 1 file changed, 7 insertions(+), 2 del

[PATCH] btrfs: handle failures of set_extent_bits in add_excluded_extent

2018-05-21 Thread Gu Jinxiang
ogged_extent to btrfs_exclude_logged_extents. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> --- fs/btrfs/extent-tree.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 75cfb80d2551..28fd71579141 100644 --- a/fs/btrfs/exte

[PATCH v2] btrfs: handle failures of set_extent_bits in add_excluded_extent

2018-05-22 Thread Gu Jinxiang
set_extent_bits may fail, return the result in add_excluded_extent. Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> Changelog: v2-v1: 1.remove goto to make the function run linearly. 2.change commit description not pointing out the failure detail, since set_extent_bits's failure ty

RE: [PATCH v6 3/3] btrfs: Add unprivileged version of ino_lookup ioctl

2018-05-18 Thread Gu, Jinxiang
called. If > constructed path does not exist under fd's inode, -EACCES > will be returned. > 3. The name of bottom subvolume is also searched and filled. > > Note that the maximum length of path is shorter 256 (BTRFS_VOL_NAME_MAX+1) > bytes than ino_lookup ioctl because of space of >

RE: [PATCH v6 1/3] btrfs: Add unprivileged ioctl which returns subvolume information

2018-05-18 Thread Gu, Jinxiang
send/receive happens */ > + __u64 ctransid; > + __u64 otransid; > + __u64 stransid; > + __u64 rtransid; > + /* Time corresponds to c/o/s/rtransid */ > + struct btrfs_ioctl_timespec ctime; > + struct btrfs_ioctl_timespec otime; > + struct btrfs_ioctl_timespec s

RE: [PATCH v4 3/3] btrfs: Add unprivileged version of ino_lookup ioctl

2018-05-16 Thread Gu, Jinxiang
efine BTRFS_INO_LOOKUP_USER_PATH_MAX (4080-BTRFS_VOL_NAME_MAX-1) > +struct btrfs_ioctl_ino_lookup_user_args { > + /* in, inode number containing the subvolume of 'subvolid' */ > + __u64 dirid; > + /* in */ > + __u64 subvolid; > + /* out, name of the subvolume of 'subvolid' */ > + char name

RE: [PATCH v5 1/3] btrfs: Add unprivileged ioctl which returns subvolume information

2018-05-17 Thread Gu, Jinxiang
_uuid[BTRFS_UUID_SIZE]; > + > + /* Transaction id indicates when change/create/send/receive happens */ > + __u64 ctransid; > + __u64 otransid; > + __u64 stransid; > + __u64 rtransid; > + /* Time corresponds to c/o/s/rtransid */ > + struct btrfs_ioctl_timespec c

[PATCH] btrfs: set device state reappearing missing device

2018-05-29 Thread Gu Jinxiang
From: Gu JinXiang patch for commit 921518924084 ("btrfs: handle dynamically reappearing missing device"). Since BTRFS_DEV_STATE_IN_FS_METADATA will be clear in btrfs_open_one_device, and when alloc a new chunk in __btrfs_alloc_chunk, device with BTRFS_DEV_STATE_IN_FS_METADATA

  1   2   3   >