[PATCH v3 2/7] btrfs-progs: Refactor btrfs_read_block_groups()

2019-10-09 Thread Qu Wenruo
This patch does the following refactor: - Refactor parameter from @root to @fs_info - Refactor the large loop body into another function Now we have a helper function, read_one_block_group(), to handle block group cache and space info related routine. - Refactor the return value Even we hav

[PATCH v3 7/7] btrfs-progs: btrfstune: Allow to enable bg-tree feature offline

2019-10-09 Thread Qu Wenruo
Add a new option '-b' for btrfstune, to enable bg-tree feature for a unmounted fs. This feature will convert all BLOCK_GROUP_ITEMs in extent tree to bg tree, by reusing the existing btrfs_convert_to_bg_tree() function. Signed-off-by: Qu Wenruo --- Documentation/btrfstune.asciidoc | 6 + bt

[PATCH v3 3/7] btrfs-progs: Enable read-write ability for 'bg_tree' feature

2019-10-09 Thread Qu Wenruo
Allow btrfs-progs to open, read and write 'bg_tree' enabled fs. The modification itself is not large, as block groups items are only used at 4 timing: 1) open_ctree() We only need to populate fs_info->bg_root and read block group items from fs_info->bg_root. The obvious change is, we don'

[PATCH v3 4/7] btrfs-progs: mkfs: Introduce -O bg-tree

2019-10-09 Thread Qu Wenruo
This allow mkfs.btrfs to create a btrfs with bg-tree feature. This patch introduce a global function, btrfs_convert_to_bg_tree() in extent-tree.c, to do the work. The workflow is pretty simple: - Create a new tree block for bg tree - Set the BG_TREE feature for superblock - Set the fs_info->conve

[PATCH v3 1/7] btrfs-progs: Refactor excluded extent functions to use fs_info

2019-10-09 Thread Qu Wenruo
The following functions are just using @root to reach fs_info: - exclude_super_stripes - free_excluded_extents - add_excluded_extent Refactor them to use fs_info directly. Signed-off-by: Qu Wenruo Reviewed-by: Johannes Thumshirn --- check/main.c | 4 ++-- ctree.h | 4 ++-- extent-tree

[PATCH v3 5/7] btrfs-progs: dump-tree/dump-super: Introduce support for bg tree

2019-10-09 Thread Qu Wenruo
Just a new tree called BLOCK_GROUP_TREE. Signed-off-by: Qu Wenruo --- cmds/inspect-dump-super.c | 3 ++- cmds/inspect-dump-tree.c | 5 + print-tree.c | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmds/inspect-dump-super.c b/cmds/inspect-dump-super.c in

[PATCH v3 6/7] btrfs-progs: check: Introduce support for bg-tree feature

2019-10-09 Thread Qu Wenruo
Just some minor modification. - original mode: * Block group item can occur in extent tree and bg tree. - lowmem mode: * search block group items in bg tree if BG_TREE feature is set. Signed-off-by: Qu Wenruo --- check/main.c| 3 ++- check/mode-lowmem.c | 9 +++-- 2 files change

[PATCH v3 0/7] btrfs-progs: Support for BG_TREE feature

2019-10-09 Thread Qu Wenruo
This patchset can be fetched from github: https://github.com/adam900710/btrfs-progs/tree/bg_tree Which is based on v5.2.2 tag. This patchset provides the needed user space infrastructure for BG_TREE feature. Since it's an new incompatible feature, unlike SKINNY_METADATA, btrfs-progs is needed to

[PATCH] fstests: btrfs/15[78]: Detect non-raid6 data chunks before doing the test

2019-10-09 Thread Qu Wenruo
[BUG] When certain older mkfs.btrfs is used, btrfs/157 and btrfs/158 fails like below: btrfs/157 2s ... - output mismatch (see xfstests-dev/results//btrfs/157.out.bad) --- tests/btrfs/157.out 2019-07-22 14:13:44.65326 +0800 +++ results//btrfs/157.out.bad 2019-10-10 13:5

Re: [PATCH v3 3/3] btrfs: Introduce new incompat feature, BG_TREE, to speed up mount time

2019-10-09 Thread Naohiro Aota
On Thu, Oct 10, 2019 at 10:39:28AM +0800, Qu Wenruo wrote: diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h index b65c7ee75bc7..1d1e50c42d0e 100644 --- a/include/uapi/linux/btrfs_tree.h +++ b/include/uapi/linux/btrfs_tree.h @@ -48,6 +48,9 @@ /* tracks free space in b

Re: [PATCH v3 1/3] btrfs: block-group: Fix a memory leak due to missing btrfs_put_block_group()

2019-10-09 Thread Anand Jain
On 10/10/19 10:39 AM, Qu Wenruo wrote: In btrfs_read_block_groups(), if we have an invalid block group which has mixed type (DATA|METADATA) while the fs doesn't have MIX_BGS feature, we error out without freeing the block group cache. This patch will add the missing btrfs_put_block_group() to pr

Re: [PATCH v3 2/3] btrfs: block-group: Refactor btrfs_read_block_groups()

2019-10-09 Thread Anand Jain
On 10/10/19 10:39 AM, Qu Wenruo wrote: Refactor the work inside the loop of btrfs_read_block_groups() into one separate function, read_one_block_group(). This allows read_one_block_group to be reused for later BG_TREE feature. The refactor does the following extra fix: - Use btrfs_fs_incompat()

Re: [PATCH v3 0/3] btrfs: Introduce new incompat feature BG_TREE to hugely reduce mount time

2019-10-09 Thread Qu WenRuo
On 2019/10/10 上午10:39, Qu Wenruo wrote: > This patchset can be fetched from: > https://github.com/adam900710/linux/tree/bg_tree > Which is based on v5.4-rc1 tag. > > This patchset will hugely reduce mount time of large fs by putting all > block group items into its own tree. > > The old behavio

Re: [PATCH] btrfs: use bool argument in free_root_pointers()

2019-10-09 Thread Qu Wenruo
On 2019/10/10 上午10:39, Anand Jain wrote: > We don't need int argument bool shall do in free_root_pointers(). > And rename the argument as it confused two people. Victim here. :) Although it's mostly caused by my stupidness. :( > > Signed-off-by: Anand Jain Reviewed-by: Qu Wenruo Thanks, Qu

[PATCH v3 3/3] btrfs: Introduce new incompat feature, BG_TREE, to speed up mount time

2019-10-09 Thread Qu Wenruo
The overall idea of the new BG_TREE is pretty simple: Put BLOCK_GROUP_ITEMS into a separate tree. This brings one obvious enhancement: - Reduce mount time of large fs Although it could be possible to accept BLOCK_GROUP_ITEMS in either trees (extent root or bg root), I'll leave that kernel convert

[PATCH v3 2/3] btrfs: block-group: Refactor btrfs_read_block_groups()

2019-10-09 Thread Qu Wenruo
Refactor the work inside the loop of btrfs_read_block_groups() into one separate function, read_one_block_group(). This allows read_one_block_group to be reused for later BG_TREE feature. The refactor does the following extra fix: - Use btrfs_fs_incompat() to replace open-coded feature check Sig

[PATCH v3 0/3] btrfs: Introduce new incompat feature BG_TREE to hugely reduce mount time

2019-10-09 Thread Qu Wenruo
This patchset can be fetched from: https://github.com/adam900710/linux/tree/bg_tree Which is based on v5.4-rc1 tag. This patchset will hugely reduce mount time of large fs by putting all block group items into its own tree. The old behavior will try to read out all block group items at mount time

[PATCH v3 1/3] btrfs: block-group: Fix a memory leak due to missing btrfs_put_block_group()

2019-10-09 Thread Qu Wenruo
In btrfs_read_block_groups(), if we have an invalid block group which has mixed type (DATA|METADATA) while the fs doesn't have MIX_BGS feature, we error out without freeing the block group cache. This patch will add the missing btrfs_put_block_group() to prevent memory leak. Fixes: 49303381f19a (

[PATCH] btrfs: use bool argument in free_root_pointers()

2019-10-09 Thread Anand Jain
We don't need int argument bool shall do in free_root_pointers(). And rename the argument as it confused two people. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f314f

Re: [PATCH v2 2/3] btrfs: disk-io: Remove unnecessary check before freeing chunk root

2019-10-09 Thread Qu Wenruo
On 2019/10/10 上午10:00, Anand Jain wrote: > On 8/10/19 12:49 PM, Qu Wenruo wrote: >> In free_root_pointers(), free_root_extent_buffers() has checked if the >> @root parameter is NULL. >> So there is no need checking chunk_root before freeing it. > > um.. Oh, my bad, I get confused with the param

Re: [PATCH v2 2/3] btrfs: disk-io: Remove unnecessary check before freeing chunk root

2019-10-09 Thread Anand Jain
On 8/10/19 12:49 PM, Qu Wenruo wrote: In free_root_pointers(), free_root_extent_buffers() has checked if the @root parameter is NULL. So there is no need checking chunk_root before freeing it. um.. Signed-off-by: Qu Wenruo --- fs/btrfs/disk-io.c | 3 +-- 1 file changed, 1 insertion(+), 2

Re: [PATCH 2/2] Btrfs: keep pages dirty when using btrfs_writepage_fixup_worker

2019-10-09 Thread Holger Hoffstätte
On 6/20/18 4:56 PM, Chris Mason wrote: For COW, btrfs expects pages dirty pages to have been through a few setup steps. This includes reserving space for the new block allocations and marking the range in the state tree for delayed allocation. A few places outside btrfs will dirty pages directl

[PATCH] Btrfs: fix negative subv_writers counter and data space leak after buffered write

2019-10-09 Thread fdmanana
From: Filipe Manana When doing a buffered write it's possible to leave the subv_writers counter of the root, used for synchronization between buffered nocow writers and snapshotting. This happens in an exceptional case like the following: 1) We fail to allocate data space for the write, since th

[PATCH] Btrfs: fix metadata space leak on fixup worker failure to set range as delalloc

2019-10-09 Thread fdmanana
From: Filipe Manana In the fixup worker, if we fail to mark the range as delalloc in the io tree, we must release the previously reserved metadata, as well as update the outstanding extents counter for the inode, otherwise we leak metadata space. In pratice we can't return an error from btrfs_se

[PATCH] Btrfs: add missing extents release on file extent cluster relocation error

2019-10-09 Thread fdmanana
From: Filipe Manana If we error out when finding a page at relocate_file_extent_cluster(), we need to release the outstanding extents counter on the relocation inode, set by the previous call to btrfs_delalloc_reserve_metadata(), otherwise the inode's block reserve size can never decrease to zero

Re: Domain eyecamera.de

2019-10-09 Thread Matthias Jung
Sehr geehrte Damen und Herren eyecamera.de Domain Name ist jetzt verfügbar und ist jetzt zu verkaufen. Ich freue mich auf Ihre Antwort! Es grüßt herzlich Matthias Jung ___

Re: [PATCH 1/3] btrfs: block-group: Refactor btrfs_read_block_groups()

2019-10-09 Thread Filipe Manana
On Wed, Oct 9, 2019 at 2:09 PM Qu Wenruo wrote: > > Refactor the work inside the loop of btrfs_read_block_groups() into one > separate function, read_one_block_group(). > > This allows read_one_block_group to be reused for later BG_TREE feature. > > The refactor does the following extra fixes: > -

[PATCH 1/3] btrfs: block-group: Refactor btrfs_read_block_groups()

2019-10-09 Thread Qu Wenruo
Refactor the work inside the loop of btrfs_read_block_groups() into one separate function, read_one_block_group(). This allows read_one_block_group to be reused for later BG_TREE feature. The refactor does the following extra fixes: - Use btrfs_fs_incompat() to replace open-coded feature check -

Re: [PATCH v2 1/3] btrfs: block-group: Refactor btrfs_read_block_groups()

2019-10-09 Thread Qu WenRuo
On 2019/10/9 下午8:08, Anand Jain wrote: > On 10/8/19 12:49 PM, Qu Wenruo wrote: >> Refactor the work inside the loop of btrfs_read_block_groups() into one >> separate function, read_one_block_group(). >> >> This allows read_one_block_group to be reused for later BG_TREE feature. >> >> Signed-off-b

Re: [PATCH v2 1/3] btrfs: block-group: Refactor btrfs_read_block_groups()

2019-10-09 Thread Anand Jain
On 10/8/19 12:49 PM, Qu Wenruo wrote: Refactor the work inside the loop of btrfs_read_block_groups() into one separate function, read_one_block_group(). This allows read_one_block_group to be reused for later BG_TREE feature. Signed-off-by: Qu Wenruo Nit: Change log didn't mention about thin

Re: [PATCH v2 0/3] btrfs: Introduce new incompat feature BG_TREE to hugely reduce mount time

2019-10-09 Thread Qu Wenruo
On 2019/10/9 下午4:08, Felix Niederwanger wrote: > Hi Qu, > > I'm afraid the system is now in a very different configuration and > already in production, which makes it impossible to run specific tests > on it. > > At the time the problem occurred, we were using about 57/82 TB filled > with appro

Re: [PATCH 2/5] btrfs: get bdev from latest_dev for dio bh_result

2019-10-09 Thread Nikolay Borisov
On 7.10.19 г. 22:37 ч., David Sterba wrote: > To remove use of extent_map::bdev we need to find a replacement, and the > latest_bdev is the only one we can use here, because inode::i_bdev and > superblock::s_bdev are NULL. > > The only thing that DIO code uses from the bdev is the blocksize to

Re: [PATCH v2 0/3] btrfs: Introduce new incompat feature BG_TREE to hugely reduce mount time

2019-10-09 Thread Felix Niederwanger
Hi Qu, I'm afraid the system is now in a very different configuration and already in production, which makes it impossible to run specific tests on it. At the time the problem occurred, we were using about 57/82 TB filled with approx 20-30 million individual files with varying file sized. I creat

Re: [PATCH v2 0/3] btrfs: Introduce new incompat feature BG_TREE to hugely reduce mount time

2019-10-09 Thread Qu Wenruo
On 2019/10/9 下午3:07, Felix Niederwanger wrote: > Hey Johannes, > > glad to hear back from you :-) > > As discussed I try to elaborate the setup where we experienced the > issue, that btrfs mount takes more than 5 minutes. The initial bug > report is at https://bugzilla.opensuse.org/show_bug.cgi

Re: [PATCH] btrfs: opencode extent_buffer_get

2019-10-09 Thread Anand Jain
On 10/8/19 7:35 PM, Johannes Thumshirn wrote: On 08/10/2019 13:28, David Sterba wrote: The helper is trivial and we can understand what the atomic_inc on something named refs does. Signed-off-by: David Sterba --- quiz: find where and how is the refs are decremented free_extent_buffer(), fr