[PATCH 1/2] btrfs-progs: print-tree: Avoid segfault for heavily corrupted item pointers

2018-05-07 Thread Qu Wenruo
Normally corrupted leaf should be caught by csum check, but sometimes corrupted item pointers (out of leaf range) can still pass csum check. In fact, our fsck/005 test case image has such corrupted item pointer and btrfs check can surprisingly fix it. Anyway, make print-tree to skip such item and

[PATCH 2/2] btrfs-progs: misc-tests: Add test case for dump-tree on heavily corrupted leaf

2018-05-07 Thread Qu Wenruo
Signed-off-by: Qu Wenruo --- .../032-bad-item-ptr/bad_item_ptr.raw.xz | Bin 0 -> 21964 bytes tests/misc-tests/032-bad-item-ptr/test.sh | 17 + 2 files changed, 17 insertions(+) create mode 100644 tests/misc-tests/032-bad-item-ptr/bad_item_ptr.raw.xz create mode 1007

[PATCH v2 2/2] Btrfs: fix fiemap extent SHARED flag error with range clone.

2018-05-07 Thread robbieko
From: Robbie Ko [BUG] Range clone can cause fiemap to return error result. Like: # mount /dev/vdb5 /mnt/btrfs # dd if=/dev/zero bs=16K count=2 oflag=dsync of=/mnt/btrfs/file # btrfs-debugfs -f file (276 0): ram 16384 disk 2171609088 disk_size 16384 (276 16384): ram 16384 disk 2171625472 dis

[PATCH v2 0/2] btrfs fiemap related BUG fix.

2018-05-07 Thread robbieko
From: Robbie Ko This patchset intends to fix btrfs fiemap related bug. The fiemap has the following problems: 1) fiemap: pass correct bytenr when fm_extent_count is zero When user space wants to get the number of file extents, set fm_extent_count to 0 to run fiemap and then read fm_mapped_ext

[PATCH v2 1/2] Btrfs: fiemap: pass correct bytenr when fm_extent_count is zero

2018-05-07 Thread robbieko
From: Robbie Ko [BUG] fm_mapped_extents is not correct when fm_extent_count is 0 Like: # mount /dev/vdb5 /mnt/btrfs # dd if=/dev/zero bs=16K count=4 oflag=dsync of=/mnt/btrfs/file # xfs_io -c "fiemap -v" /mnt/btrfs/file /mnt/btrfs/file: EXT: FILE-OFFSET BLOCK-RANGE TOTAL

[PATCH] btrfs-progs: qgroup: swap the argument in the caller of update_qgroup_relation

2018-05-07 Thread Lu Fengqi
The QGROUP_RELATION item is very special, it always exists in pairs (objectid and offset exchange). Its objectid and offset are the ids of a pair of parent and child qgroups, respectively. The larger one is parent and the smaller one is child. After the following commit, the order of the parameters

Re: [PATCH 1/2] btrfs-progs: print-tree: Avoid segfault for heavily corrupted item pointers

2018-05-07 Thread Qu Wenruo
On 2018年05月07日 15:46, Qu Wenruo wrote: > Normally corrupted leaf should be caught by csum check, but sometimes > corrupted item pointers (out of leaf range) can still pass csum check. > In fact, our fsck/005 test case image has such corrupted item pointer > and btrfs check can surprisingly fix it

PF1-1 2018 首次TB

2018-05-07 Thread Cao jin
Dear all 首先道歉一下,2018过去这么久了还没有TB过,导致我们现在相当富裕:p So,年度TB首秀开始报名啦,这次的选择有午餐和KTV,如果KTV足够凑个包厢,下午我们就去嗨一下:) 报名地址: http://www.stdp.css.fujitsu.com:8080/nnnce/schedules/view/360 -- Sincerely, Cao jin -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majo

Re: PF1-1 2018 首次TB

2018-05-07 Thread Cao jin
Sorry for the noise:( On 05/07/2018 05:23 PM, Cao jin wrote: > Dear all > > 首先道歉一下,2018过去这么久了还没有TB过,导致我们现在相当富裕:p > So,年度TB首秀开始报名啦,这次的选择有午餐和KTV,如果KTV足够凑个包厢,下午我们就去嗨一下:) > > 报名地址: > http://www.stdp.css.fujitsu.com:8080/nnnce/schedules/view/360 > -- Sincerely, Cao jin -- To unsubscribe from thi

Re: [PATCH] btrfs-progs: qgroup: swap the argument in the caller of update_qgroup_relation

2018-05-07 Thread Qu Wenruo
On 2018年05月07日 16:50, Lu Fengqi wrote: > The QGROUP_RELATION item is very special, it always exists in pairs > (objectid and offset exchange). Its objectid and offset are the ids of a > pair of parent and child qgroups, respectively. The larger one is > parent and the smaller one is child. After

metadata_ratio mount option?

2018-05-07 Thread Martin Svec
Hi, According to man btrfs [1], I assume that metadata_ratio=1 mount option should force allocation of one metadata chunk after every allocated data chunk. However, when I set this option and start filling btrfs with "dd if=/dev/zero of=dummyfile.dat", only data chunks are allocated but no metad

Re: [PATCH v2 04/10] btrfs-progs: undelete-subvol: introduce is_subvol_intact

2018-05-07 Thread David Sterba
On Mon, May 07, 2018 at 10:20:57AM +0800, Qu Wenruo wrote: > >>> +++ b/undelete-subvol.c > >>> @@ -0,0 +1,53 @@ > >>> +/* > >>> + * Copyright (C) 2018 Fujitsu.  All rights reserved. > >> > >> IIRC David will remove all such copy right line. > >> Is there some principle about this, David? > > > > A

Re: [PATCH v2 04/10] btrfs-progs: undelete-subvol: introduce is_subvol_intact

2018-05-07 Thread Qu Wenruo
On 2018年05月07日 19:40, David Sterba wrote: > On Mon, May 07, 2018 at 10:20:57AM +0800, Qu Wenruo wrote: > +++ b/undelete-subvol.c > @@ -0,0 +1,53 @@ > +/* > + * Copyright (C) 2018 Fujitsu.  All rights reserved. IIRC David will remove all such copy right line. Is ther

Re: metadata_ratio mount option?

2018-05-07 Thread Chris Mason
On 7 May 2018, at 7:40, Martin Svec wrote: Hi, According to man btrfs [1], I assume that metadata_ratio=1 mount option should force allocation of one metadata chunk after every allocated data chunk. However, when I set this option and start filling btrfs with "dd if=/dev/zero of=dummyfile.da

Re: [PATCH] btrfs: Remove devid parameter from btrfs_rmap_block

2018-05-07 Thread David Sterba
On Fri, May 04, 2018 at 10:53:05AM +0300, Nikolay Borisov wrote: > This function is used in only one place and devid argument is always > passed 0. So just remove it, similarly to how it was removed in the > userspace code. > > Signed-off-by: Nikolay Borisov Reviewed-by: David Sterba -- To unsu

Re: [PATCH] btrfs: send: fix spelling mistake: "send_in_progres" -> "send_in_progress"

2018-05-07 Thread David Sterba
On Fri, May 04, 2018 at 12:11:12PM +0100, Colin King wrote: > From: Colin Ian King > > Trivial fix to spelling mistake of function name in btrfs_err message > > Signed-off-by: Colin Ian King Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body

Re: [PATCH] btrfs: qgroup: Allow trace_btrfs_qgroup_account_extent() to record its transid

2018-05-07 Thread David Sterba
On Thu, May 03, 2018 at 09:59:02AM +0800, Qu Wenruo wrote: > When debugging quota rescan race, some times btrfs rescan could account > some old (committed) leaf and then re-account newly committed leaf > in next generation. > > This race needs extra transid to locate, so add @transid for > trace_b

[PATCH] btrfs: remove redundant btrfs_balance_control::fs_info

2018-05-07 Thread David Sterba
The fs_info is always available from the context so we don't need to store it in the structure. Signed-off-by: David Sterba --- fs/btrfs/ioctl.c | 3 +-- fs/btrfs/volumes.c | 7 +++ fs/btrfs/volumes.h | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/ioctl.

Re: metadata_ratio mount option?

2018-05-07 Thread Martin Svec
Hello Chris, Dne 7.5.2018 v 16:49 Chris Mason napsal(a): > On 7 May 2018, at 7:40, Martin Svec wrote: > >> Hi, >> >> According to man btrfs [1], I assume that metadata_ratio=1 mount option >> should >> force allocation of one metadata chunk after every allocated data chunk. >> However, >> when I

Re: metadata_ratio mount option?

2018-05-07 Thread Chris Mason
On 7 May 2018, at 12:16, Martin Svec wrote: Hello Chris, Dne 7.5.2018 v 16:49 Chris Mason napsal(a): On 7 May 2018, at 7:40, Martin Svec wrote: Hi, According to man btrfs [1], I assume that metadata_ratio=1 mount option should force allocation of one metadata chunk after every allocated

Re: [PATCH 0/3] Lowmem fsck repair to fix filetype mismatch

2018-05-07 Thread David Sterba
On Wed, Jan 17, 2018 at 01:17:07PM +0800, Qu Wenruo wrote: > Sebastian reported a filesystem corruption where DIR_INDEX has wrong > filetype against INODE_ITEM. > > Lowmem mode normally handles such problem by checking DIR_INDEX, > DIR_ITEM and INODE_REF/INODE_ITEM to determine the correct file ty

Re: [PATCH v4 00/18] btrfs-progs: lowmem check: avoid extents overwrite

2018-05-07 Thread David Sterba
On Thu, Feb 08, 2018 at 11:27:19AM +0800, Su Yue wrote: > This patchset can be fetched from my github: > https://github.com/Damenly/btrfs-progs/tree/lowmem > based on unmerged patchset whose cover: > [PATCH 0/3] btrfs-progs: Split original mode check to its own > Author: Qu Wenruo >

Re: [PATCH 0/4] btrfs check --check-data-csum enhancement for

2018-05-07 Thread David Sterba
On Tue, Feb 27, 2018 at 05:12:55PM +0800, Qu Wenruo wrote: > Log-writes tool from Josef exposed btrfs data corruption. > > Although still digging, at least enhance --check-data-csum option so > that log-replay --check can stop exactly at the point where btrfs data > get corrupted, instead of manua

Re: [PATCH] btrfs: remove redundant btrfs_balance_control::fs_info

2018-05-07 Thread Anand Jain
On 05/07/2018 11:44 PM, David Sterba wrote: The fs_info is always available from the context so we don't need to store it in the structure. Signed-off-by: David Sterba Reviewed-by: Anand Jain -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message

Re: [PATCH 0/5] Fix delalloc inodes leaking on btrfs unmount

2018-05-07 Thread David Sterba
On Fri, Apr 27, 2018 at 12:21:49PM +0300, Nikolay Borisov wrote: > After investigating crashes on generic/176 it turned that the culprit in fact > is the random failure induced by generic/019. As it happens, if on unmount > the > filesystem is in BTRFS_FS_STATE_ERROR then btrfs_error_commit_super

Btrfs installation advices

2018-05-07 Thread faurepierr
Hi, I'm curious about btrfs, and maybe considering it for my new laptop installation (a Lenovo T470). I was going to install my usual lvm+ext4+full disk encryption setup, but thought I should maybe give a try to btrfs. Is it possible to meet all these criteria? - operating system: debian sid

Re: [PATCH] btrfs-progs: qgroup: swap the argument in the caller of update_qgroup_relation

2018-05-07 Thread Lu Fengqi
On Mon, May 07, 2018 at 07:19:32PM +0800, Qu Wenruo wrote: > > >On 2018年05月07日 16:50, Lu Fengqi wrote: >> The QGROUP_RELATION item is very special, it always exists in pairs >> (objectid and offset exchange). Its objectid and offset are the ids of a >> pair of parent and child qgroups, respectively

Re: Problem with current->journal_info for BTRFS, Null pointer dereference in start_transaction

2018-05-07 Thread Liu Bo
On Mon, May 7, 2018 at 2:49 PM, robbieko wrote: > Hi, > > When send process requires memory allocation, shrinker may be triggered due > to insufficient memory. > Then evict_inode gets called when inode is dropped, and this function may > need to start transaction. > However, the journal_info is al

Re: [PATCH v4 00/18] btrfs-progs: lowmem check: avoid extents overwrite

2018-05-07 Thread Su Yue
On 05/08/2018 02:17 AM, David Sterba wrote: On Thu, Feb 08, 2018 at 11:27:19AM +0800, Su Yue wrote: This patchset can be fetched from my github: https://github.com/Damenly/btrfs-progs/tree/lowmem based on unmerged patchset whose cover: [PATCH 0/3] btrfs-progs: Split original mode check

Re: [PATCH v4 00/18] btrfs-progs: lowmem check: avoid extents overwrite

2018-05-07 Thread Qu Wenruo
On 2018年05月08日 10:09, Su Yue wrote: > > > On 05/08/2018 02:17 AM, David Sterba wrote: >> On Thu, Feb 08, 2018 at 11:27:19AM +0800, Su Yue wrote: >>> This patchset can be fetched from my github: >>> https://github.com/Damenly/btrfs-progs/tree/lowmem >>> based on unmerged patchset whose cover: >>

Re: [PATCH v4 00/18] btrfs-progs: lowmem check: avoid extents overwrite

2018-05-07 Thread Su Yue
On 05/08/2018 10:06 AM, Qu Wenruo wrote: On 2018年05月08日 10:09, Su Yue wrote: On 05/08/2018 02:17 AM, David Sterba wrote: On Thu, Feb 08, 2018 at 11:27:19AM +0800, Su Yue wrote: This patchset can be fetched from my github: https://github.com/Damenly/btrfs-progs/tree/lowmem based on unmerg

[PATCH] btrfs: send, improve rmdir performance for large directory

2018-05-07 Thread robbieko
From: Robbie Ko At present, we check if the directory can be deleted. We need to check whether all the files under this directory have been processed every time we finished processing an entry under that directory. Example: 2,000,000 files in 1 directory. Parent snapshot: | dir/ (ino 257, di

Re: [PATCH 0/5] Fix delalloc inodes leaking on btrfs unmount

2018-05-07 Thread Nikolay Borisov
On 8.05.2018 01:58, David Sterba wrote: > On Fri, Apr 27, 2018 at 12:21:49PM +0300, Nikolay Borisov wrote: >> After investigating crashes on generic/176 it turned that the culprit in fact >> is the random failure induced by generic/019. As it happens, if on unmount >> the >> filesystem is in B

[PATCH v2 1/2] btrfs-progs: qgroup: swap the argument in the caller of update_qgroup_relation

2018-05-07 Thread Lu Fengqi
The QGROUP_RELATION item is very special, it always exists in pairs (objectid and offset exchange). Its objectid and offset are the ids of a pair of parent and child qgroups, respectively. The larger one is parent and the smaller one is child. After the following commit, the order of the parameters

[PATCH 2/2] btrfs-progs: tests: check btrfs qgroup parent-child relation output

2018-05-07 Thread Lu Fengqi
Since commit aaf2dac5ef37 ("btrfs-progs: qgroup: split update_qgroup to reduce arguments") cause qgroup show to output the wrong qgroup parent-child relationship, in addition to fixing the problem, a test case is needed to prevent the similar problem in the future. Signed-off-by: Lu Fengqi --- .

Re: [PATCH v2 1/2] btrfs-progs: qgroup: swap the argument in the caller of update_qgroup_relation

2018-05-07 Thread Qu Wenruo
On 2018年05月08日 13:48, Lu Fengqi wrote: > The QGROUP_RELATION item is very special, it always exists in pairs > (objectid and offset exchange). Its objectid and offset are the ids of a > pair of parent and child qgroups, respectively. The larger one is > parent and the smaller one is child. After

[PATCH v3.1 09/10] btrfs-progs: tests: add testcase for undelete-subvol

2018-05-07 Thread Lu Fengqi
The testcase checks the functionality of "btrfs rescue undelete-subvol", including recovering an intact subvolume, and handling correctly incomplete subvolume. Signed-off-by: Lu Fengqi --- V3.1: remove unnecessary check_prereq btrfs-image V3: rename testcase to 031-undelete-subvol; rename images

Re: [PATCH 2/2] btrfs-progs: tests: check btrfs qgroup parent-child relation output

2018-05-07 Thread Qu Wenruo
On 2018年05月08日 13:48, Lu Fengqi wrote: > Since commit aaf2dac5ef37 ("btrfs-progs: qgroup: split update_qgroup to > reduce arguments") cause qgroup show to output the wrong qgroup > parent-child relationship, in addition to fixing the problem, a test case > is needed to prevent the similar problem

[PATCH RESEND 12/12] btrfs-progs: test/mkfs: Add test case for --rootdir and -R quota

2018-05-07 Thread Qu Wenruo
Nothing interesting, since such combination can be handled easily by qgroup-verify. Signed-off-by: Qu Wenruo --- .../mkfs-tests/017-rootdir-with-quota/test.sh | 51 +++ 1 file changed, 51 insertions(+) create mode 100755 tests/mkfs-tests/017-rootdir-with-quota/test.sh diff --gi

[PATCH RESEND 00/12] mkfs: Quota support through -R|--runtime quota

2018-05-07 Thread Qu Wenruo
Can be fetched from github: https://github.com/adam900710/btrfs-progs/tree/mkfs_qgroup Which is based on v4.16 tag. This patchset adds quota support, which means the result fs will have quota enabled by default, and its accounting is already consistent, no manually rescan or quota enable is neede

[PATCH RESEND 03/12] btrfs-progs: qgroup-verify: Move qgroup classification out of report_qgroups

2018-05-07 Thread Qu Wenruo
The original qgroup-verify integrates qgroup classification into report_qgroups(). This behavior makes silent qgroup repair (or offline rescan) impossible. To repair qgroup, we must call report_qgroups() to trigger bad qgroup classification, which will output error message. This patch moves bad q

[PATCH RESEND 11/12] btrfs-progs: test/mkfs: Add test case for -R quota option

2018-05-07 Thread Qu Wenruo
Only test if btrfs check (which will check qgroup by default) and kernel mount success. Comprehensive qgroup test cases still belongs to fstests. Signed-off-by: Qu Wenruo --- tests/mkfs-tests/001-basic-profiles/test.sh | 10 ++ 1 file changed, 10 insertions(+) diff --git a/tests/mkfs-t

[PATCH RESEND 10/12] btrfs-progs: mkfs: Introduce quota runtime feature

2018-05-07 Thread Qu Wenruo
Introduce quota runtime feature for mkfs. The result fs will has quota enabled, with consistent qgroup accounting. This is quite handy to test quota with fstests, which doesn't support to call ioctl for btrfs at mount time. Signed-off-by: Qu Wenruo --- Documentation/mkfs.btrfs.asciidoc | 7 +++

[PATCH RESEND 07/12] btrfs-progs: mkfs: Introduce function to setup quota root and rescan

2018-05-07 Thread Qu Wenruo
Introduce a new function, setup_quota_root(), which will create quota root, and do an offline rescan to ensure all quota accounting numbers are correct. Signed-off-by: Qu Wenruo --- mkfs/main.c | 86 + 1 file changed, 86 insertions(+) diff --g

[PATCH RESEND 09/12] btrfs-progs: mkfs: Introduce --runtime-features option

2018-05-07 Thread Qu Wenruo
Just like -O|--features, introduce -R|--runtime-features to enable features like qgroup, and maybe space cache later. Currently only mkfs is supported, mainly for test purpose. Convert is not supported yet. Signed-off-by: Qu Wenruo --- Documentation/mkfs.btrfs.asciidoc | 16 + mkfs/main

[PATCH RESEND 01/12] btrfs-progs: qgroup-verify: Also repair qgroup status version

2018-05-07 Thread Qu Wenruo
Current kernel only supports qgroup version 1. Make qgroup-verify to follow this standard. Signed-off-by: Qu Wenruo --- ctree.h | 1 + qgroup-verify.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ctree.h b/ctree.h index fa861ba0b4c3..cf99df1c90a8 100644 --- a/ctree.h +++ b/ctre

[PATCH RESEND 04/12] btrfs-progs: qgroup-verify: Allow repair_qgroups function to do silent repair

2018-05-07 Thread Qu Wenruo
Allow repair_qgroups() to do silent repair, so it can acts as offline qgroup rescan. This provides the basis for later mkfs quota support. Signed-off-by: Qu Wenruo --- check/main.c| 2 +- qgroup-verify.c | 19 +++ qgroup-verify.h | 2 +- 3 files changed, 13 insertions(+),

[PATCH RESEND 08/12] btrfs-progs: fsfeatures: Introduce a new set of features, runtime_features

2018-05-07 Thread Qu Wenruo
Introduce runtime_features for fsfeatures.[ch], and related functions: btrfs_list_all_runtime_features() btrfs_parse_runtime_features() btrfs_process_runtime_features() btrfs_parse_runtime_features_to_string() And rename one function to avoid confusion: btrfs_parse_features_to_string() -> btrfs_pa

[PATCH RESEND 02/12] btrfs-progs: qgroup-verify: Use fs_info->readonly to check if we should repair qgroups

2018-05-07 Thread Qu Wenruo
In fact qgroup-verify is just kind of offline qgroup rescan, and later mkfs qgroup support will reuse it. So qgroup-verify doesn't really need to rely the global variable @repair to check if it should repair qgroups. Instead check fs_info->readonly to do the repair. Signed-off-by: Qu Wenruo ---

[PATCH RESEND 05/12] btrfs-progs: ctree: Introduce function to create an empty tree

2018-05-07 Thread Qu Wenruo
Introduce a new function, btrfs_create_tree(), to create an empty tree. Currently, there is only one caller to create new tree, namely data reloc tree in mkfs. However it's copying fs tree to create a new root. This copy fs tree method is not a good idea if we only need an empty tree. So here in

[PATCH RESEND 06/12] btrfs-progs: mkfs: Introduce function to insert qgroup info and limit items

2018-05-07 Thread Qu Wenruo
Introduce a new function, insert_qgroup_items(), to insert qgroup info item and qgroup limit item for later mkfs qgroup support. Signed-off-by: Qu Wenruo --- mkfs/main.c | 34 ++ 1 file changed, 34 insertions(+) diff --git a/mkfs/main.c b/mkfs/main.c index b65b18