RE: [PATCH v2] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

2016-09-05 Thread Zhao Lei
Hi, Sean Fu > -Original Message- > From: Sean Fu [mailto:fxinr...@gmail.com] > Sent: Tuesday, September 06, 2016 11:51 AM > To: dste...@suse.com > Cc: c...@fb.com; anand.j...@oracle.com; fdman...@suse.com; > zhao...@cn.fujitsu.com; linux-ker...@vger.kernel.org; > linux-btrfs@vger.kernel.or

RE: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

2016-09-05 Thread Zhao Lei
Hi, Qu Wenruo > From: Qu Wenruo [mailto:quwen...@cn.fujitsu.com] > Sent: Monday, September 05, 2016 3:57 PM > To: Zhao Lei ; 'Sean Fu' ; > dste...@suse.com > Cc: c...@fb.com; anand.j...@oracle.com; fdman...@suse.com; > linux-btrfs@vger.kernel.org; linux-ker...@v

RE: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

2016-09-04 Thread Zhao Lei
Hi, Sean Fu > From: Sean Fu [mailto:fxinr...@gmail.com] > Sent: Sunday, September 04, 2016 7:54 PM > To: dste...@suse.com > Cc: c...@fb.com; anand.j...@oracle.com; fdman...@suse.com; > zhao...@cn.fujitsu.com; linux-btrfs@vger.kernel.org; > linux-ker...@vger.kernel.org; Sean Fu > Subject: [PATCH]

[PATCH] btrfs: scrub: Set bbio to NULL before calling btrfs_map_block

2016-05-17 Thread Zhao Lei
, invalid memory accessing will happened. Above case is in scrub_missing_raid56_pages(), and similar case in scrub_raid56_parity(). Signed-off-by: Zhao Lei --- fs/btrfs/scrub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 4678f03

RE: [PATCH] btrfs: fix memory leak during RAID 5/6 device replacement

2016-05-16 Thread Zhao Lei
Hi, Scott Talbert > From: Zhao Lei [mailto:zhao...@cn.fujitsu.com] > Sent: Friday, May 13, 2016 6:31 PM > To: 'dste...@suse.cz' ; 'Scott Talbert' > > Cc: 'linux-btrfs@vger.kernel.org' > Subject: RE: [PATCH] btrfs: fix memory leak during RA

RE: [PATCH] btrfs: fix memory leak during RAID 5/6 device replacement

2016-05-13 Thread Zhao Lei
Hi, Scott Talbert * From: David Sterba [mailto:dste...@suse.cz] > Sent: Tuesday, May 10, 2016 1:32 AM > To: Scott Talbert > Cc: linux-btrfs@vger.kernel.org; Zhao Lei > Subject: Re: [PATCH] btrfs: fix memory leak during RAID 5/6 device replacement > > CC Zhao Lei > >

[PATCH v2 3/3] btrfs-progs: autogen: Don't show success message on fail

2016-05-12 Thread Zhao Lei
' and 'make' to compile. # Fixed by check return value of autoconf. After patch: # ./autogen.sh ... configure.ac:132: error: possibly undefined macro: PKG_CHECK_VAR If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. #

[PATCH v2 2/3] btrfs-progs: autogen: Make build success in CentOS 6 and 7

2016-05-12 Thread Zhao Lei
ugins/commit/f95ab6f939ecf0d9232b3165f9241d2ea9676b9e Changelog v1->v2: 1: Add AC_SUBST(UDEVDIR) Suggested by: Jeff Mahoney Signed-off-by: Zhao Lei --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4688bc7..c79472c 100644 --- a/configure.ac +++

[PATCH v2 0/3] btrfs-progs: autogen: Some compatibility fixs

2016-05-12 Thread Zhao Lei
Changelog v1->v2: 1: btrfs-progs: autogen: Make build success in CentOS 6 and 7 Add AC_SUBST(UDEVDIR), suggested by: Jeff Mahoney Zhao Lei (3): btrfs-progs: autogen: Avoid chdir fail on dirname with blank btrfs-progs: autogen: Make build success in CentOS 6 and 7 btrfs-progs: auto

[PATCH v2 1/3] btrfs-progs: autogen: Avoid chdir fail on dirname with blank

2016-05-12 Thread Zhao Lei
If source put in dir with blanks, as: /var/lib/jenkins/workspace/btrfs progs autogen will failed: ./autogen.sh: line 95: cd: /var/lib/jenkins/workspace/btrfs: No such file or directory Can be fixed by adding quotes into cd command. Signed-off-by: Zhao Lei --- autogen.sh | 2 +- 1 file

[PATCH 2/3] btrfs-progs: autogen: Make build success in CentOS 6 and 7

2016-05-12 Thread Zhao Lei
ugins/commit/f95ab6f939ecf0d9232b3165f9241d2ea9676b9e Signed-off-by: Zhao Lei --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4688bc7..a754990 100644 --- a/configure.ac +++ b/configure.ac @@ -128,7 +128,7 @@ PKG_STATIC(UUID_LIBS_STATIC, [uuid]) PKG_C

[PATCH 3/3] btrfs-progs: autogen: Don't show success message on fail

2016-05-12 Thread Zhao Lei
' and 'make' to compile. # Fixed by check return value of autoconf. After patch: # ./autogen.sh ... configure.ac:132: error: possibly undefined macro: PKG_CHECK_VAR If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. #

[PATCH 1/3] btrfs-progs: autogen: Avoid chdir fail on dirname with blank

2016-05-12 Thread Zhao Lei
If source put in dir with blanks, as: /var/lib/jenkins/workspace/btrfs progs autogen will failed: ./autogen.sh: line 95: cd: /var/lib/jenkins/workspace/btrfs: No such file or directory Can be fixed by adding quotes into cd command. Signed-off-by: Zhao Lei --- autogen.sh | 2 +- 1 file

RE: btrfs: reada: simplify dev->reada_in_flight processing

2016-02-17 Thread Zhao Lei
Hi, Dan Carpenter > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Thursday, February 18, 2016 3:02 AM > To: zhao...@cn.fujitsu.com > Cc: linux-btrfs@vger.kernel.org > Subject: re: btrfs: reada: simplify dev->reada_in_flight processing > > Hello

RE: [GIT PULL] Fujitsu for 4.5

2016-02-14 Thread Zhao Lei
Hi, David Sterba Thanks for notice me, sorry for reply late. > From: David Sterba [mailto:dste...@suse.cz] > Sent: Wednesday, February 10, 2016 6:14 PM > To: Zhao Lei > Cc: 'Chris Mason' ; 'btrfs' > Subject: Re: [GIT PULL] Fujitsu for 4.5 > > On Wed, J

[PATCH 2/3] btrfs: delete no_used argument in btrfs_copy_from_user

2016-01-06 Thread Zhao Lei
size_t write_bytes is not necessary for btrfs_copy_from_user(), delete it. Signed-off-by: Zhao Lei --- fs/btrfs/file.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 11fd981..e4f287c 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs

[PATCH 3/3] btrfs: merge functions for wait snapshot creation

2016-01-06 Thread Zhao Lei
wait_for_snapshot_creation() is in same group with oher two: btrfs_start_write_no_snapshoting() btrfs_end_write_no_snapshoting() Rename wait_for_snapshot_creation() and move it into same place with other two. Signed-off-by: Zhao Lei --- fs/btrfs/ctree.h | 1 + fs/btrfs/extent-tree.c

[PATCH 1/3] btrfs: Continue write in case of can_not_nocow

2016-01-06 Thread Zhao Lei
code only continue write on first case, the second case happened in doing subvolume. Fix: Continue write when check_can_nocow() return 0 and <0. Signed-off-by: Zhao Lei --- fs/btrfs/file.c | 37 + 1 file changed, 17 insertions(+), 20 deletions(-) diff --gi

[PATCH 10/10] btrfs: reada: Fix a debug code typo

2015-12-31 Thread Zhao Lei
Remove one copy of loop to fix the typo of iterate zones. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index 902f899..53ee7b1 100644 --- a/fs/btrfs/reada.c +++ b/fs/btrfs/reada.c

[PATCH 06/10] btrfs: reada: move reada_extent_put to place after __readahead_hook()

2015-12-31 Thread Zhao Lei
de at least one reada_extctl, which keeps additional one refcnt for reada_extent. But we still need this patch to make the code in pretty logic. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/reada.c b/fs/btrfs/re

[PATCH 08/10] btrfs: reada: Use fs_info instead of root in __readahead_hook's argument

2015-12-31 Thread Zhao Lei
What __readahead_hook() need exactly is fs_info, no need to convert fs_info to root in caller and convert back in __readahead_hook() Signed-off-by: Zhao Lei --- fs/btrfs/ctree.h | 4 ++-- fs/btrfs/disk-io.c | 22 +++--- fs/btrfs/reada.c | 23 +++ 3 files

[PATCH 04/10] btrfs: reada: bypass adding extent when all zone failed

2015-12-31 Thread Zhao Lei
When failed adding all dev_zones for a reada_extent, the extent will have no chance to be selected to run, and keep in memory for ever. We should bypass this extent to avoid above case. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs

[PATCH 01/10] btrfs: reada: Avoid many times of empty loop

2015-12-31 Thread Zhao Lei
will be selected in __reada_start_machine() for 1 times(total times in __reada_start_machine()). Fix: For a reada_extent without job, we don't need to run it, just return 0 to let caller break. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 2 +- 1 file changed, 1 insertion(+), 1 de

[PATCH 09/10] btrfs: reada: Jump into cleanup in direct way for __readahead_hook()

2015-12-31 Thread Zhao Lei
Current code set nritems to 0 to make for_loop useless to bypass it, and set generation's value which is not necessary. Jump into cleanup directly is better choise. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 40 +--- 1 file changed, 21 insertions(+

[PATCH 05/10] btrfs: reada: Remove level argument in severial functions

2015-12-31 Thread Zhao Lei
level is not used in severial functions, remove them from arguments, and remove relative code for get its value. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index ef9457e

[PATCH 07/10] btrfs: reada: Pass reada_extent into __readahead_hook directly

2015-12-31 Thread Zhao Lei
reada_start_machine_dev() already have reada_extent pointer, pass it into __readahead_hook() directly instead of search radix_tree will make code run faster. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 45 - 1 file changed, 24 insertions(+), 21

[PATCH 02/10] btrfs: reada: Move is_need_to_readahead contition earlier

2015-12-31 Thread Zhao Lei
Move is_need_to_readahead contition earlier to avoid useless loop to get relative data for readahead. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index fb21bf0..dcc5b69

[PATCH 00/10] btrfs: reada: Avoid many times of empty loop

2015-12-31 Thread Zhao Lei
This is some cleanup, bugfix and enhance for reada, tested by a script running scrub and relatice trace log. Zhao Lei (10): btrfs: reada: Avoid many times of empty loop btrfs: reada: Move is_need_to_readahead contition earlier btrfs: reada: add all reachable mirrors into reada device list

[PATCH 03/10] btrfs: reada: add all reachable mirrors into reada device list

2015-12-31 Thread Zhao Lei
If some device is not reachable, we should bypass and continus addingb next, instead of break on bad device. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index dcc5b69

[PATCH 2/3] btrfs: reduce additional fs_info->reada_lock in reada_find_zone

2015-12-18 Thread Zhao Lei
We can avoid additional locking-acquirment and one pair of kref_get/put by combine two condition. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index 6fb9c37..d8116fe 100644 --- a

[PATCH 3/3] btrfs: Add missed segment checking in reada_find_zone

2015-12-18 Thread Zhao Lei
In rechecking zone-in-tree, we still need to check zone include our logical address. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index d8116fe..c65b42f 100644 --- a/fs/btrfs/reada.c +++ b

[PATCH 1/3] btrfs: Fix in-segment calculation for reada

2015-12-18 Thread Zhao Lei
code right in logic. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index 7bbd656..6fb9c37 100644 --- a/fs/btrfs/reada.c +++ b/fs/btrfs/reada.c @@ -265,7 +265,7 @@ static struct reada_zone *rea

[PATCH 3/4] btrfs: Small cleanup for get index_srcdev loop

2015-12-15 Thread Zhao Lei
1: Adjust condition in loop to make less TAB 2: Move btrfs_put_bbio()'s line for combine, and makes logic clean. Signed-off-by: Zhao Lei --- fs/btrfs/volumes.c | 42 -- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/fs/btrfs/volume

[PATCH 1/4] btrfs: Disable raid56 readahead

2015-12-15 Thread Zhao Lei
(), which make raid56 readahead do nothing. Before we will fix bug in __btrfs_map_block(), we need to disable raid56 temporary, to avoid above warning. Signed-off-by: Zhao Lei --- fs/btrfs/reada.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c

[PATCH 4/4] btrfs: Use direct way to determine raid56 write/recover mode

2015-12-15 Thread Zhao Lei
gned-off-by: Zhao Lei --- fs/btrfs/volumes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 367e8ec..d411444 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -6056,7 +6056,8 @@ int btrfs_map_bio(struct btrfs_root *r

[PATCH 2/4] btrfs: return all mirror whether need_raid_map set or not

2015-12-15 Thread Zhao Lei
and this function happened to bypass on less mirror. Signed-off-by: Zhao Lei --- fs/btrfs/volumes.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a6df8fd..4ee429b 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volume

[PATCH 0/4] btrfs: return all mirror whether need_raid_map set or not

2015-12-15 Thread Zhao Lei
'll fix raid56 readahead next. Zhao Lei (4): btrfs: Disable raid56 readahead btrfs: return all mirror whether need_raid_map set or not btrfs: Small cleanup for get index_srcdev loop btrfs: Use direct way to determine raid56 write/recover mode fs/btrfs/reada.c | 5 + fs/btrfs/v

RE: [PATCH] fstests: Fix generic/102 fail for btrfs

2015-12-07 Thread Zhao Lei
gt; > On Thu, Dec 03, 2015 at 06:08:36PM +0800, Zhaolei wrote: > > From: Zhao Lei > > > > generic/102 sometimes fails in newest btrfs toolchain, because it use > > non-mixed mode in default, which request more space for metadata, and > > no space for data writing. &g

[PATCH] btrfs: Fix no_space in write and rm loop

2015-12-01 Thread Zhao Lei
I'll fix it in xfstests. Signed-off-by: Zhao Lei --- fs/btrfs/extent-tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index acf3ed1..ab85393 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c

[PATCH v3] btrfs-progs: mkfs: Enable -d dup for single device

2015-11-19 Thread Zhao Lei
return 0 } test_all() { for m_from in single dup; do for d_from in single dup; do for m_to in single dup; do for d_to in single dup; do do_dup_test "$m_from" "$d_from" "$m_to" "$d_to" || return 1 done

[PATCH] btrfs: Support convert to -d dup for btrfs-convert

2015-11-19 Thread Zhao Lei
rt="$d_to" "$TEST_DIR" || return 1 } umount "$TEST_DIR" || return 1 ./btrfsck "$TEST_DEV" || return 1 echo return 0 } test_all() { for m_from in single dup; do for d_from in single dup; do for m_to in single dup; do

[PATCH v2] btrfs: Continue replace when set_block_ro failed

2015-11-17 Thread Zhao Lei
Let replace continue in this case is no problem. Tested by above script, and xfstests/011, plus 100 times xfstests/070. Changelog v1->v2: 1: Add detail comments in source and commit-message. 2: Add dmesg detail into commit-message. 3: Limit return value of -ENOSPC to be passed. All sug

RE: [PATCH] btrfs: Continue replace when set_block_ro failed

2015-11-16 Thread Zhao Lei
Hi, Filipe Manana > -Original Message- > From: Filipe Manana [mailto:fdman...@gmail.com] > Sent: Monday, November 16, 2015 6:57 PM > To: Zhao Lei > Cc: linux-btrfs@vger.kernel.org > Subject: Re: [PATCH] btrfs: Continue replace when set_block_ro failed > > On Mo

RE: [PATCH] btrfs: Continue replace when set_block_ro failed

2015-11-16 Thread Zhao Lei
Hi, Filipe Manana > -Original Message- > From: linux-btrfs-ow...@vger.kernel.org > [mailto:linux-btrfs-ow...@vger.kernel.org] On Behalf Of Filipe Manana > Sent: Monday, November 16, 2015 6:27 PM > To: Zhao Lei > Cc: linux-btrfs@vger.kernel.org > Subject: Re: [P

RE: [PATCH] btrfs: Continue replace when set_block_ro failed

2015-11-16 Thread Zhao Lei
Hi, Filipe Manana Thanks for review. > -Original Message- > From: Filipe Manana [mailto:fdman...@gmail.com] > Sent: Friday, November 13, 2015 8:02 PM > To: Zhao Lei > Cc: linux-btrfs@vger.kernel.org > Subject: Re: [PATCH] btrfs: Continue replace when set_block_ro faile

[PATCH v2] btrfs-progs: mkfs: Enable -d dup for single device

2015-11-13 Thread Zhao Lei
all source are modified. 4: Use this raid type manually, do some operations in fs, no error found in command and dmesg. Changelog v1->v2: Fix a bug in v1 which cause no dup chunk created, found by above check command. Signed-off-by: Zhao Lei --- mkfs.c | 4 ++-- utils.c | 10 --

[PATCH] btrfs: Continue replace when set_block_ro failed

2015-11-13 Thread Zhao Lei
ailed because no space in device. Fix: When set_block_ro failed for metadata chunk, it is not a problem because scrub_lock forbids commit_trancaction. Let replace continue in this case is no problem. Tested by above script, and xfstests/011, plus 100 times xfstests/070. Signed-off-by: Zhao Lei --- fs

RE: [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message

2015-11-10 Thread Zhao Lei
Hi, Anand Jain > -Original Message- > From: Anand Jain [mailto:anand.j...@oracle.com] > Sent: Monday, November 09, 2015 6:34 PM > To: Zhao Lei > Cc: linux-btrfs@vger.kernel.org; dste...@suse.cz > Subject: Re: [PATCH 1/3] btrfs-progs: cmds-device: use warning/error f

[GIT PULL] Fujitsu for 4.4

2015-11-09 Thread Zhao Lei
le", and I have queued xfstests(btrfs/generic with all mountopt) for this branch, (need about 4~5 days), and no error found until now(1 days). -- Zhao Lei (9): btrfs: scrub: set error stats when tree block spanning stripes btrfs: scrub: setup all fields for sblock_to_check btrfs: Reset sbl

[PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message

2015-11-09 Thread Zhao Lei
Switch to common warning()/error() for cmds-device.c. Signed-off-by: Zhao Lei --- cmds-device.c | 57 +++-- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index 2ed32a2..e23ea61 100644 --- a/cmds

[PATCH 2/3] btrfs-progs: cleanup cmd_device_usage

2015-11-09 Thread Zhao Lei
1: Remove more_than_one variant, use iterator's value instead 2: Remove "out" mark, use break instead. Signed-off-by: Zhao Lei --- cmds-device.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index e23ea61..739405b 10

[PATCH 3/3] btrfs-progs: Remove noused path argument in _cmd_device_usage

2015-11-09 Thread Zhao Lei
Argument of char *path in _cmd_device_usage() is not necessary, remove it. Signed-off-by: Zhao Lei --- cmds-device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index 739405b..190bed6 100644 --- a/cmds-device.c +++ b/cmds-device.c

[PATCH] btrfs-progs: Check periodic.timer_fd's value before use

2015-11-09 Thread Zhao Lei
periodic.timer_fd's value is 0 on inititlize-failed case, if no value-checking before read(), the code will run as read(STDIN). This patch fixed above case. Signed-off-by: Zhao Lei --- task-utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/task-utils.c b/task-utils.c index a4

[PATCH 2/2] btrfs-progs: mkfs: remove unused code of format uuid string

2015-11-03 Thread Zhao Lei
Variant named dev_uuid and uuid_unparse() for set its value are not used, remove it. Signed-off-by: Zhao Lei --- mkfs.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mkfs.c b/mkfs.c index 75fc086..d5da1fb 100644 --- a/mkfs.c +++ b/mkfs.c @@ -1176,9 +1176,6 @@ static void

[PATCH 1/2] btrfs-progs: mkfs: output device list in sorted order

2015-11-03 Thread Zhao Lei
Signed-off-by: Zhao Lei --- mkfs.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mkfs.c b/mkfs.c index 14e7eb4..75fc086 100644 --- a/mkfs.c +++ b/mkfs.c @@ -42,6 +42,7 @@ #include "volumes.h" #include "transaction.h" #include "utils.

[PATCH 2/2] btrfs-progs: Rename variables in btrfs_add_to_fsid

2015-11-02 Thread Zhao Lei
tes block_count -> device_total_bytes To make code more readable. Signed-off-by: Zhao Lei --- utils.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils.c b/utils.c index b7752df..999af43 100644 --- a/utils.c +++ b/utils.c @@ -724,7 +724,7 @@ static int zero

[PATCH 1/2] btrfs-progs: mkfs: Round device size down to sectorsize

2015-11-02 Thread Zhao Lei
Reported-by: Qu Wenruo Signed-off-by: Zhao Lei --- utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils.c b/utils.c index d17291a..b7752df 100644 --- a/utils.c +++ b/utils.c @@ -736,6 +736,8 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, u64 num_devs;

RE: [PATCH 5/6] btrfs-progs: free comparer_set in cmd_qgroup_show

2015-11-01 Thread Zhao Lei
Hi, David Sterba > -Original Message- > From: David Sterba [mailto:dste...@suse.cz] > Sent: Friday, October 30, 2015 9:36 PM > To: Zhao Lei > Cc: linux-btrfs@vger.kernel.org > Subject: Re: [PATCH 5/6] btrfs-progs: free comparer_set in cmd_qgroup_show > > On Th

[PATCH 6/6] btrfs-progs: Avoid use pointer in handle_options

2015-10-29 Thread Zhao Lei
for condition in handle_options() to make line short. Signed-off-by: Zhao Lei --- btrfs.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/btrfs.c b/btrfs.c index 9416a29..f881c18 100644 --- a/btrfs.c +++ b/btrfs.c @@ -172,20 +172,22 @@ static

[PATCH 3/6] btrfs-progs: free fslabel for btrfs-convert

2015-10-29 Thread Zhao Lei
fslabel need to be freed before exit. Signed-off-by: Zhao Lei --- btrfs-convert.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/btrfs-convert.c b/btrfs-convert.c index 5b9171e..1693d03 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -3027,6 +3027,9 @@ int main(int argc, char

[PATCH 2/6] btrfs-progs: Fix negative eb's ref_cnt in btrfs-calc-size

2015-10-29 Thread Zhao Lei
t_size() is only used to save node data, it don't hold ref_cnt for each eb in. Using btrfs_free_path() to free path will reduce these eb again, and cause many problems, as negative ref_cnt or invalid memory access. Signed-off-by: Zhao Lei --- btrfs-calc-size.c | 9 - 1 file

[PATCH 1/6] btrfs-progs: fix floating point exception for btrfs-calc-size

2015-10-29 Thread Zhao Lei
exception This patch add a condition check for above case. Signed-off-by: Zhao Lei --- btrfs-calc-size.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/btrfs-calc-size.c b/btrfs-calc-size.c index b756693..17d44ae 100644 --- a/btrfs-calc-size.c +++ b/btrfs-calc-size.c

[PATCH 5/6] btrfs-progs: free comparer_set in cmd_qgroup_show

2015-10-29 Thread Zhao Lei
comparer_set, which was allocated by malloc(), should be free before function return. Signed-off-by: Zhao Lei --- cmds-qgroup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmds-qgroup.c b/cmds-qgroup.c index a64b716..f069d32 100644 --- a/cmds-qgroup.c +++ b/cmds

[PATCH 4/6] btrfs-progs: Fix uninitialized key.type for btrfs_find_free_objectid

2015-10-29 Thread Zhao Lei
To avoid using uninitialized value in btrfs_search_slot(). Signed-off-by: Zhao Lei --- inode-map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/inode-map.c b/inode-map.c index 1321bfb..346952b 100644 --- a/inode-map.c +++ b/inode-map.c @@ -44,6 +44,7 @@ int btrfs_find_free_objectid

RE: [PATCH] btrfs-progs: mkfs: Enable -d dup for single device

2015-10-27 Thread Zhao Lei
Hi, David Sterba > -Original Message- > From: David Sterba [mailto:dste...@suse.cz] > Sent: Tuesday, October 27, 2015 10:20 PM > To: Zhao Lei > Cc: linux-btrfs@vger.kernel.org > Subject: Re: [PATCH] btrfs-progs: mkfs: Enable -d dup for single device > > On Tu

[PATCH v2 0/5] btrfs-progs: Add all missing close_ctree and btrfs_close_all_devices

2015-10-26 Thread Zhao Lei
This patch add all missing close_ctree and btrfs_close_all_devices to several tools in btrfs progs, to avoid memory leak. Changelog v1->v2: Move btrfs_close_all_devices() from cmd-XXX into btrfs.c to make code simple, and avoid similar problem in cmd-XXX in future. Zhao Lei (5): btrfs-pr

[PATCH v2 1/5] btrfs-progs: btrfs: Add missing btrfs_close_all_devices for btrfs command

2015-10-26 Thread Zhao Lei
Adding a btrfs_close_all_devices() after command callback in btrfs.c can force-close all opened device before program exit, to avoid memory leak in all btrfs sub-command. Suggested-by: David Sterba Signed-off-by: Zhao Lei --- btrfs.c | 9 - 1 file changed, 8 insertions(+), 1 deletion

[PATCH v2 5/5] btrfs-progs: use system's default path for math.h

2015-10-26 Thread Zhao Lei
Line of #include "math.h" in extent-tree.c using quotas is history reason, (we have cuseom math.h in source before) Now it is better to use "<>" instead of quotas for this header file. Signed-off-by: Zhao Lei --- extent-tree.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH v2 3/5] btrfs-progs: Add all missing btrfs_close_all_devices to standalone tools

2015-10-26 Thread Zhao Lei
This patch add all missing btrfs_close_all_devices() to standalone tools in btrfs progs, to avoid memory leak. Signed-off-by: Zhao Lei --- btrfs-calc-size.c| 1 + btrfs-debug-tree.c | 5 - btrfs-find-root.c| 1 + btrfs-map-logical.c | 1 + btrfs-select-super.c | 2 ++ btrfstune.c

[PATCH v2 4/5] btrfs-progs: Add missing close_ctree to btrfs-select-super.c

2015-10-26 Thread Zhao Lei
Add missing close_ctree() to btrfs-select-super.c to avoid memory leak. Signed-off-by: Zhao Lei --- btrfs-select-super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/btrfs-select-super.c b/btrfs-select-super.c index bd44978..df74153 100644 --- a/btrfs-select-super.c +++ b/btrfs-select

[PATCH v2 2/5] btrfs-progs: Remove all btrfs_close_all_devices in sub-command

2015-10-26 Thread Zhao Lei
Since we have btrfs_close_all_devices() in btrfs's main entrance, it is not necessary to call btrfs_close_all_devices() separately in each sub-command. Signed-off-by: Zhao Lei --- cmds-check.c | 1 - cmds-device.c | 3 --- cmds-replace.c | 2 -- 3 files changed, 6 deletions(-) diff --

RE: [PATCH] btrfs: Remove code for no-cow in scrub/replace

2015-10-26 Thread Zhao Lei
Hi, Filipe Manana > -Original Message- > From: Filipe Manana [mailto:fdman...@gmail.com] > Sent: Friday, October 23, 2015 11:17 PM > To: Jeff Mahoney > Cc: Zhao Lei ; linux-btrfs@vger.kernel.org > Subject: Re: [PATCH] btrfs: Remove code for no-cow in scrub/replace &

RE: [PATCH] btrfs: Remove code for no-cow in scrub/replace

2015-10-26 Thread Zhao Lei
Hi, Jeff Mahoney Thanks for review! > -Original Message- > From: Jeff Mahoney [mailto:je...@suse.com] > Sent: Friday, October 23, 2015 11:11 PM > To: Zhao Lei ; linux-btrfs@vger.kernel.org > Subject: Re: [PATCH] btrfs: Remove code for no-cow in scrub/replace > >

[PATCH] btrfs: Remove code for no-cow in scrub/replace

2015-10-23 Thread Zhao Lei
roups with 10 mount options include nodatacow. Signed-off-by: Zhao Lei --- fs/btrfs/ctree.h | 1 - fs/btrfs/scrub.c | 669 --- 2 files changed, 670 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 938efe3..3387509 100644 ---

RE: [PATCH v6 0/4] VFS: In-kernel copy system call

2015-10-20 Thread Zhao Lei
Hi, Anna Schumaker This patchset compile ok in x86 and x86_64 target, But failed in arm when compiling btrfs dir, and output following error message: :1304:2: warning: #warning syscall copy_file_range not implemented [-Wcpp] Reproduce: merge commands: cd /mnt/big1/linux git fetch -q --all

RE: [PATCH 0/3] btrfs-progs: mkfs: Fix different mixed type by argument sequence

2015-10-13 Thread Zhao Lei
Hi, David Sterba > -Original Message- > From: David Sterba [mailto:dste...@suse.cz] > Sent: Wednesday, October 14, 2015 12:19 AM > To: Zhao Lei > Cc: linux-btrfs@vger.kernel.org > Subject: Re: [PATCH 0/3] btrfs-progs: mkfs: Fix different mixed type by > argument sequ

RE: [PATCH] btrfs-progs: mkfs: Enable -d dup for single device

2015-10-13 Thread Zhao Lei
Hi, David Sterba > -Original Message- > From: David Sterba [mailto:dste...@suse.cz] > Sent: Tuesday, October 13, 2015 8:36 PM > To: Zhao Lei > Cc: dste...@suse.cz; linux-btrfs@vger.kernel.org; c...@fb.com > Subject: Re: [PATCH] btrfs-progs: mkfs: Enable -d dup for sin

[PATCH 0/3] btrfs-progs: mkfs: Fix different mixed type by argument sequence

2015-10-13 Thread Zhao Lei
Given a 200G vdd1 and 1G vdd2: In current code: mkfs.btrfs -f /dev/vdd1 /dev/vdd2 and mkfs.btrfs -f /dev/vdd2 /dev/vdd1 will create different "mixed" type. See [PATCH 2/3] for detail. This patchset also include some small fixs. Zhao Lei (3): btrfs-progs: mkfs: Remove saved

[PATCH 1/3] btrfs-progs: mkfs: Remove saved_optind in mkfs.btrfs

2015-10-13 Thread Zhao Lei
No need to use complex logic for iter devs in mkfs.c, as backup optind, increase/decrease optind and reset dev_cnt. A simple for() loop is enough for above request. Signed-off-by: Zhao Lei --- mkfs.c | 25 +++-- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a

[PATCH 2/3] btrfs-progs: mkfs: Fix different mixed type by argument sequence

2015-10-13 Thread Zhao Lei
e. Reason: Current code determine "is to use mixed-type" only by first device. Fix: Use mixed-type only if all device are small. Signed-off-by: Zhao Lei --- mkfs.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mkfs.c b/mkfs.c index cdae94d..

[PATCH 3/3] btrfs-progs: mkfs: Fix inaccurate mixed information

2015-10-13 Thread Zhao Lei
In current code, with a "BIG VOLUME" /dev/vdd2: # ./mkfs.btrfs -f -M /dev/vdd2 SMALL VOLUME: forcing mixed metadata/data groups ... This patch changed above output to: Using mixed metadata/data groups And the "SMALL VOLUME" output only when we exactly using SMALL VOLUME.

RE: [PATCH] btrfs-progs: mkfs: Enable -d dup for single device

2015-10-13 Thread Zhao Lei
Hi, David Sterba Thanks for review. > -Original Message- > From: David Sterba [mailto:dste...@suse.cz] > Sent: Tuesday, October 13, 2015 7:29 PM > To: Zhao Lei > Cc: linux-btrfs@vger.kernel.org; c...@fb.com > Subject: Re: [PATCH] btrfs-progs: mkfs: Enable -d dup

[PATCH] btrfs-progs: mkfs: Enable -d dup for single device

2015-10-13 Thread Zhao Lei
ingle profile. 4: We have a workaround: Create multi-partition in single device, and btefs will treat them as multi device. Instead of refuse -d dup, we have a better choise: Give user a chance to select, and output a warning to notice above problem. Signed-off-by: Zhao Lei --- mkfs.c | 2 +- ut

[PATCH 08/11] btrfs-progs: quota: use btrfs_open_dir for btrfs quota command

2015-10-12 Thread Zhao Lei
quota disable /mnt/tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 # ./btrfs quota rescan /mnt/tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 # Signed-off-by: Zhao Lei --- cmds-quota.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cmds-quota.c b/cmds-quota.c

[PATCH 04/11] btrfs-progs: inspect: Bypass unnecessary clean function in open_error

2015-10-12 Thread Zhao Lei
No need to cleanup fd in open_fail case, because it is not opened. Signed-off-by: Zhao Lei --- cmds-inspect.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmds-inspect.c b/cmds-inspect.c index fc3db99..879fd43 100644 --- a/cmds-inspect.c +++ b/cmds-inspect.c @@ -626,9

[PATCH 02/11] btrfs-progs: filesystem: use btrfs_open_dir for btrfs filesystem command

2015-10-12 Thread Zhao Lei
get space info - Inappropriate ioctl for device ERROR: get_df failed Inappropriate ioctl for device # After patch: # ./btrfs filesystem df /mnt/tmp ERROR: not btrfs filesystem: /mnt/tmp # Signed-off-by: Zhao Lei --- cmds-fi-usage.c | 4 +--- cmds-filesystem.c | 19 +++---

[PATCH 09/11] btrfs-progs: use btrfs_open_dir in open_path_or_dev_mnt

2015-10-12 Thread Zhao Lei
/tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 # ./btrfs replace start /dev/vdd /dev/vde /mnt/tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 Signed-off-by: Zhao Lei --- cmds-device.c | 13 ++--- cmds-replace.c | 13 ++--- cmds-scrub.c | 28 +---

[PATCH 01/11] btrfs-progs: subvolume: use btrfs_open_dir for btrfs subvolume command

2015-10-12 Thread Zhao Lei
'/mnt/tmp/123' ERROR: cannot create subvolume - Inappropriate ioctl for device # After patch: # btrfs subvolume create /mnt/tmp/123 ERROR: not btrfs filesystem: /mnt/tmp # Signed-off-by: Zhao Lei --- cmds-subvolume.c | 56 +++--

[PATCH 07/11] btrfs-progs: qgroup: use btrfs_open_dir for btrfs qgroup command

2015-10-12 Thread Zhao Lei
stem: /mnt/tmp1 # ./btrfs qgroup show /mnt/tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 # ./btrfs qgroup limit 1G 1/5 /mnt/tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 Signed-off-by: Zhao Lei --- cmds-qgroup.c | 24 1 file changed, 8 insertions(+), 16 deletions(-

[PATCH 06/11] btrfs-progs: inspect: use btrfs_open_dir for btrfs inspect command

2015-10-12 Thread Zhao Lei
igned-off-by: Zhao Lei --- cmds-inspect.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/cmds-inspect.c b/cmds-inspect.c index a13a170..40ab49b 100644 --- a/cmds-inspect.c +++ b/cmds-inspect.c @@ -116,11 +116,9 @@ static int cmd_inspect_inode_resolv

[PATCH 03/11] btrfs-progs: balance: use btrfs_open_dir for btrfs balance command

2015-10-12 Thread Zhao Lei
riate ioctl for device There may be more info in syslog - try dmesg | tail # After patch: # btrfs balance start /mnt/tmp ERROR: not btrfs filesystem: /mnt/tmp # Signed-off-by: Zhao Lei --- cmds-balance.c | 30 ++ 1 file changed, 10 insertions(+), 20 deletions(-

[PATCH 11/11] btrfs-progs: fragments: use btrfs_open_dir for btrfs-fragments command

2015-10-12 Thread Zhao Lei
nts -o 123 /mnt/tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 Signed-off-by: Zhao Lei --- btrfs-fragments.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/btrfs-fragments.c b/btrfs-fragments.c index d742f60..17768c3 100644 --- a/btrfs-fragments.c +++ b/btrfs-fragments.c

[PATCH 10/11] btrfs-progs: replace: use btrfs_open_dir for btrfs replace command

2015-10-12 Thread Zhao Lei
tmp1 ERROR: not a btrfs filesystem: /mnt/tmp1 Signed-off-by: Zhao Lei --- cmds-replace.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/cmds-replace.c b/cmds-replace.c index 385b764..9596f2a 100644 --- a/cmds-replace.c +++ b/cmds-replace.c @@ -348,7 +3

[PATCH 05/11] btrfs-progs: inspect: set return value of error case

2015-10-12 Thread Zhao Lei
In case of open_file_or_dir() failed, ret is not set to right value, and the function will return unwanted value(ret of sprintf). Signed-off-by: Zhao Lei --- cmds-inspect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cmds-inspect.c b/cmds-inspect.c index 879fd43..a13a170 100644 --- a

[PATCH 00/11] btrfs-progs: Use btrfs_open_dir to avoid show error of ioctl or tree search

2015-10-12 Thread Zhao Lei
en_file_or_dir3(const char *fname, DIR **dirstream, int open_flags) utils.c:int open_file_or_dir(const char *fname, DIR **dirstream) utils.c:return open_file_or_dir3(fname, dirstream, O_RDWR); utils.c:fd = open_file_or_dir(path, &dirstream); # *1: It is used to open dir or file,

[PATCH] btrfs-progs: Add all missing close_ctree and btrfs_close_all_devices

2015-10-11 Thread Zhao Lei
This patch add all missing close_ctree and btrfs_close_all_devices to several tools in btrfs progs, to avoid memory leak. Signed-off-by: Zhao Lei --- btrfs-calc-size.c| 1 + btrfs-debug-tree.c | 5 - btrfs-find-root.c| 1 + btrfs-map-logical.c | 1 + btrfs-select-super.c | 3

[PATCH v4 1/3] btrfs: Fix lost-data-profile caused by auto removing bg

2015-10-08 Thread Zhao Lei
gested-by: Jeff Mahoney Changelog v1->v2: 1: Put code of checking block_group->list into semaphore of space_info->groups_sem. Noticed-by: Filipe Manana Reviewed-by: Filipe Manana Signed-off-by: Zhao Lei --- fs/btrfs/extent-tree.c | 7 +-- 1 file changed, 5 insertions(+), 2 delet

[PATCH v4 2/3] btrfs: Fix lost-data-profile caused by balance bg

2015-10-08 Thread Zhao Lei
g v1->v2: 1: Update patch description of "Fix" field 2: Use BTRFS_BLOCK_GROUP_DATA for btrfs_force_chunk_alloc instead of 1 3: Only reserve chunk when doing balance on data chunk. All suggested-by: Filipe Manana Reviewed-by: Filipe Manana Signed-off-by: Zhao Lei --- fs/btrfs/vo

[PATCH v4 3/3] btrfs: Use fs_info directly in btrfs_delete_unused_bgs

2015-10-08 Thread Zhao Lei
No need to use root->fs_info in btrfs_delete_unused_bgs(), use fs_info directly instead. Signed-off-by: Zhao Lei --- fs/btrfs/extent-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 00c621b..c93a77a 100644 --

[PATCH v4 0/3] btrfs: Fix lost-data-profile caused by auto removing bg and balance bg

2015-10-08 Thread Zhao Lei
chunk. All suggested-by: Filipe Manana Zhao Lei (3): btrfs: Fix lost-data-profile caused by auto removing bg btrfs: Fix lost-data-profile caused by balance bg btrfs: Use fs_info directly in btrfs_delete_unused_bgs fs/btrfs/extent-tree.c | 11 +++ fs/btrfs/volumes.c | 24 ++

  1   2   3   >