[PATCH 0/2] btrfs: Speedup chunk allocation for large fs

2019-01-29 Thread Qu Wenruo
This patchset can be fetched from github: https://github.com/adam900710/linux/tree/falloc_speedup Which is based on v5.0-rc1 tag, with another enospc debug patch. Btrfs falloc can be slower and slower when there are more and more block groups. One cause of this problem is find_free_dev_extent(),

[PATCH RFC 2/2] btrfs: Introduce free dev extent hint to speed up chunk allocation

2019-01-29 Thread Qu Wenruo
[PROBLEM] When allocating a 4G file, falloc() call is slower and slower if the fs is more and more filled. This is going to be super obvious when doing some crazy test. E.g. fallocating a 1PiB file TiB by TiB. The first 16T only takes 10 seconds to finish while the last 16TiB can take over 15min t

[PATCH 1/2] btrfs: Don't search devid for every verify_one_dev_extent() call

2019-01-29 Thread Qu Wenruo
verify_one_dev_extent() will call btrfs_find_device() for each dev extent, this waste some CPU time just searching the devices list. Move the search one level up, into the btrfs_verify_dev_extents(), so for each device we only call btrfs_find_device() once. Signed-off-by: Qu Wenruo --- fs/btrfs

[PATCH RFC] btrfs: Introduce free dev extent hint to speed up chunk allocation

2019-01-29 Thread Qu Wenruo
[PROBLEM] When allocating a 4G file, falloc() call is slower and slower if the fs is more and more filled. This is going to be super obvious when doing some crazy test. E.g. fallocating a 1PiB file TiB by TiB. The first 16T only takes 10 seconds to finish while the last 16TiB can take over 15min t

[PATCH v4 1/3] btrfs: scrub: fix circular locking dependency warning

2019-01-29 Thread Anand Jain
Circular locking dependency check reports warning[1], that's because the btrfs_scrub_dev() calls the stack #0 below with, the fs_info::scrub_lock held. The test case leading to this warning.. mkfs.btrfs -fq /dev/sdb && mount /dev/sdb /btrfs btrfs scrub start -B /btrfs In fact we have fs_info:

[PATCH v4 0/3] btrfs: scrub: fix scrub_lock

2019-01-29 Thread Anand Jain
Fixes the circular locking dependency warning as in patch 1/3, and patch 2/3 adds lockdep_assert_held() to scrub_workers_get(). Patch 3/3 converts scrub_workers_refcnt into refcount_t. Anand Jain (3): btrfs: scrub: fix circular locking dependency warning btrfs: scrub: add scrub_lock lockdep ch

[PATCH v4 2/3] btrfs: scrub: add scrub_lock lockdep check in scrub_workers_get

2019-01-29 Thread Anand Jain
scrub_workers_refcnt is protected by scrub_lock, add lockdep_assert_held() in scrub_workers_get(). Signed-off-by: Anand Jain Suggested-by: Nikolay Borisov --- v4: none v3: none v2: born fs/btrfs/scrub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c in

[PATCH v4 3/3] btrfs: scrub: convert scrub_workers_refcnt to refcount_t

2019-01-29 Thread Anand Jain
Use the refcount_t for fs_info::scrub_workers_refcnt instead of int. Signed-off-by: Anand Jain --- v4: born fs/btrfs/ctree.h | 2 +- fs/btrfs/disk-io.c | 2 +- fs/btrfs/scrub.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h inde

[PATCH] btrfs: Output ENOSPC debug info in inc_block_group_ro()

2019-01-29 Thread Qu Wenruo
Since inc_block_group_ro() would return -ENOSPC, outputting debug info for enospc_debug mount option would be helpful to debug some balance false ENOSPC report. Signed-off-by: Qu Wenruo --- fs/btrfs/extent-tree.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git

Re: RAID56 Warning on "multiple serious data-loss bugs"

2019-01-29 Thread DanglingPointer
Going back to my original email, would the BTRFS wiki admins consider a better more reflective update of the RAID56 status page? It still states "multiple serious data-loss bugs" which as Qu Wenruo has already clarified is not the case.  The only "bug" left is the write hole edge-case problem.

Re: dm-integrity + mdadm + btrfs = no journal?

2019-01-29 Thread Chris Murphy
On Tue, Jan 29, 2019 at 4:15 PM Hans van Kranenburg wrote: > > Hi, > > Thought experiment time... > > I have an HP z820 workstation here (with ECC memory, yay!) and 4x250G > 10k SAS disks (and some spare disks). It's donated hardware, and I'm > going to use it to replace the current server in the

Re: [PATCH 07/11] btrfs: move to fn pointers for get/put workspaces

2019-01-29 Thread Dennis Zhou
Hi Nikolay, On Tue, Jan 29, 2019 at 10:22:34AM +0200, Nikolay Borisov wrote: > > > On 28.01.19 г. 23:24 ч., Dennis Zhou wrote: > > The previous patch added generic helpers for get_workspace() and > > put_workspace(). Now, we can migrate ownership of the workspace_manager > > to be in the compres

dm-integrity + mdadm + btrfs = no journal?

2019-01-29 Thread Hans van Kranenburg
Hi, Thought experiment time... I have an HP z820 workstation here (with ECC memory, yay!) and 4x250G 10k SAS disks (and some spare disks). It's donated hardware, and I'm going to use it to replace the current server in the office of a non-profit organization (so it's not work stuff this time). T

Re: [PATCH 11/11] btrfs: add zstd compression level support

2019-01-29 Thread Dennis Zhou
On Tue, Jan 29, 2019 at 09:25:54AM +0200, Nikolay Borisov wrote: > > > On 28.01.19 г. 23:24 ч., Dennis Zhou wrote: > > Zstd compression requires different amounts of memory for each level of > > compression. The prior patches implemented indirection to allow for each > > compression type to manag

Re: [PATCH 03/11] btrfs: manage heuristic workspace as index 0

2019-01-29 Thread Dennis Zhou
On Tue, Jan 29, 2019 at 09:53:33AM +0200, Nikolay Borisov wrote: > > > On 28.01.19 г. 23:24 ч., Dennis Zhou wrote: > > While the heuristic workspaces aren't really compression workspaces, > > they use the same interface for managing them. So rather than branching, > > let's just handle them once

Re: [PATCH 01/11] btrfs: add macros for compression type and level

2019-01-29 Thread Omar Sandoval
On Mon, Jan 28, 2019 at 04:24:27PM -0500, Dennis Zhou wrote: > It is very easy to miss places that rely on a certain bitshifting for > decyphering the type_level overloading. Make macros handle this instead. > > Signed-off-by: Dennis Zhou > --- > fs/btrfs/compression.c | 2 +- > fs/btrfs/compres

Re: [PATCH 00/11] btrfs: add zstd compression level support

2019-01-29 Thread Nick Terrell
> On Jan 29, 2019, at 9:18 AM, David Sterba wrote: > > On Mon, Jan 28, 2019 at 04:24:26PM -0500, Dennis Zhou wrote: >> As mentioned above, a requirement that differs zstd from zlib is that >> higher levels of compression require more memory. To manage this, each >> compression level has its ow

Re: RAID56 Warning on "multiple serious data-loss bugs"

2019-01-29 Thread Goffredo Baroncelli
On 29/01/2019 20.02, Chris Murphy wrote: > On Mon, Jan 28, 2019 at 3:52 PM Remi Gauvin wrote: >> >> On 2019-01-28 5:07 p.m., DanglingPointer wrote: >> >>> From Qu's statement and perspective, there's no difference to other >>> non-BTRFS software RAID56's out there that are marked as stable (except

Re: RAID56 Warning on "multiple serious data-loss bugs"

2019-01-29 Thread Chris Murphy
On Mon, Jan 28, 2019 at 3:52 PM Remi Gauvin wrote: > > On 2019-01-28 5:07 p.m., DanglingPointer wrote: > > > From Qu's statement and perspective, there's no difference to other > > non-BTRFS software RAID56's out there that are marked as stable (except > > ZFS). > > Also there are no "multiple ser

Re: [PATCH 07/11] btrfs: move to fn pointers for get/put workspaces

2019-01-29 Thread Josef Bacik
On Tue, Jan 29, 2019 at 01:17:17PM -0500, Josef Bacik wrote: > On Mon, Jan 28, 2019 at 04:24:33PM -0500, Dennis Zhou wrote: > > The previous patch added generic helpers for get_workspace() and > > put_workspace(). Now, we can migrate ownership of the workspace_manager > > to be in the compression t

Re: [PATCH 08/11] btrfs: plumb level through the compression interface

2019-01-29 Thread Josef Bacik
On Mon, Jan 28, 2019 at 04:24:34PM -0500, Dennis Zhou wrote: > Zlib compression supports multiple levels, but doesn't require changing > in how a workspace itself is created and managed. Zstd introduces a > different memory requirement such that higher levels of compression > require more memory. T

Re: [PATCH 07/11] btrfs: move to fn pointers for get/put workspaces

2019-01-29 Thread Josef Bacik
On Mon, Jan 28, 2019 at 04:24:33PM -0500, Dennis Zhou wrote: > The previous patch added generic helpers for get_workspace() and > put_workspace(). Now, we can migrate ownership of the workspace_manager > to be in the compression type code as the compression code itself > doesn't care beyond being a

Re: [PATCH 06/11] btrfs: add compression interface in (get/put)_workspace()

2019-01-29 Thread Josef Bacik
On Mon, Jan 28, 2019 at 04:24:32PM -0500, Dennis Zhou wrote: > There are two levels of workspace management. First, alloc()/free() > which are responsible for actually creating and destroy workspaces. > Second, at a higher level, get()/put() which is the compression code > asking for a workspace fr

Re: [PATCH 05/11] btrfs: add helper methods for workspace manager init and cleanup

2019-01-29 Thread Josef Bacik
On Mon, Jan 28, 2019 at 04:24:31PM -0500, Dennis Zhou wrote: > Workspace manager init and cleanup code is open coded inside a for loop > over the compression types. This forces each compression type to rely on > the same workspace manager implementation. This patch creates helper > methods that wil

Re: [PATCH 04/11] btrfs: unify compression ops with workspace_manager

2019-01-29 Thread Josef Bacik
On Mon, Jan 28, 2019 at 04:24:30PM -0500, Dennis Zhou wrote: > Make the workspace_manager own the interface operations rather than > managing index-paired arrays for the workspace_manager and compression > operations. > > Signed-off-by: Dennis Zhou Reviewed-by: Josef Bacik Thanks, Josef

Re: [PATCH 03/11] btrfs: manage heuristic workspace as index 0

2019-01-29 Thread Josef Bacik
On Mon, Jan 28, 2019 at 04:24:29PM -0500, Dennis Zhou wrote: > While the heuristic workspaces aren't really compression workspaces, > they use the same interface for managing them. So rather than branching, > let's just handle them once again as the index 0 compression type. > > Signed-off-by: Den

Re: [PATCH 02/11] btrfs: rename workspaces_list to workspace_manager

2019-01-29 Thread Josef Bacik
On Mon, Jan 28, 2019 at 04:24:28PM -0500, Dennis Zhou wrote: > This is in preparation for zstd compression levels. As each level will > require different sized workspaces, workspaces_list is no longer a > really fitting name. > > Signed-off-by: Dennis Zhou > --- Reviewed-by: Josef Bacik Thanks

Re: [PATCH 01/11] btrfs: add macros for compression type and level

2019-01-29 Thread Josef Bacik
On Mon, Jan 28, 2019 at 04:24:27PM -0500, Dennis Zhou wrote: > It is very easy to miss places that rely on a certain bitshifting for > decyphering the type_level overloading. Make macros handle this instead. > > Signed-off-by: Dennis Zhou Reviewed-by: Josef Bacik Thanks, Josef

Re: [PATCH 00/11] btrfs: add zstd compression level support

2019-01-29 Thread David Sterba
On Mon, Jan 28, 2019 at 04:24:26PM -0500, Dennis Zhou wrote: > As mentioned above, a requirement that differs zstd from zlib is that > higher levels of compression require more memory. To manage this, each > compression level has its own queue of workspaces. A global LRU is used > to help with recl

Re: [PATCH] btrfs: relocation: fix unused variable

2019-01-29 Thread David Sterba
On Tue, Jan 29, 2019 at 04:21:27PM +0100, David Sterba wrote: > On Tue, Jan 29, 2019 at 02:01:46PM +0100, Anders Roxell wrote: > > When CONFIG_BRTFS_ASSERT isn't enabled, variable root_objectid isn't used. > > > > fs/btrfs/relocation.c: In function ‘insert_dirty_subv’: > > fs/btrfs/relocation.c:21

Re: [PATCH] btrfs: relocation: fix unused variable

2019-01-29 Thread David Sterba
On Tue, Jan 29, 2019 at 02:01:46PM +0100, Anders Roxell wrote: > When CONFIG_BRTFS_ASSERT isn't enabled, variable root_objectid isn't used. > > fs/btrfs/relocation.c: In function ‘insert_dirty_subv’: > fs/btrfs/relocation.c:2138:6: warning: unused variable ‘root_objectid’ > [-Wunused-variable] >

[PATCH] btrfs: relocation: fix unused variable

2019-01-29 Thread Anders Roxell
When CONFIG_BRTFS_ASSERT isn't enabled, variable root_objectid isn't used. fs/btrfs/relocation.c: In function ‘insert_dirty_subv’: fs/btrfs/relocation.c:2138:6: warning: unused variable ‘root_objectid’ [-Wunused-variable] u64 root_objectid = root->root_key.objectid; ^ Reworke

[PATCH v2 3/3] btrfs: Test if btrfs will report false ENOSPC error balancing small metadata chunk

2019-01-29 Thread Qu Wenruo
This is a test case for a long existing bug, caused by over-estimated metadata space_info::bytes_may_use. There is one proposed patch for btrfs-progs to fix it, titled: "btrfs-progs: balance: Sync the fs before balancing metadata chunks" The test case itself is almost the same as btrfs/181, which

[PATCH v2 1/3] btrfs: Test if btrfs hits EDQUOT without trying to reclaim some space

2019-01-29 Thread Qu Wenruo
Commit a514d63882c3 ("btrfs: qgroup: Commit transaction in advance to reduce early EDQUOT") is no longer forcing transaction commit to reclaim space, and only commits transaction asynchronously in advance to address it. However the criteria used in async transaction commit is not comprehensive, th

[PATCH v3 2/3] btrfs: Test if btrfs will commit too many transactions for balance

2019-01-29 Thread Qu Wenruo
Kernel commit 64403612b73a ("btrfs: rework btrfs_check_space_for_delayed_refs") is introducing a regression for btrfs balance performance. Since that commit will cause btrfs to commit too many transactions for nothing during balance/relocation, it will slow balance dramatically even we only need t

Re: [PATCH] btrfs: Test if btrfs hits EDQUOT without trying to reclaim some space

2019-01-29 Thread Filipe Manana
On Mon, Jan 28, 2019 at 2:05 AM Qu Wenruo wrote: > > Commit a514d63882c3 ("btrfs: qgroup: Commit transaction in advance to reduce > early EDQUOT") is no longer forcing transaction commit to reclaim space, > and only commits transaction asynchronously in advance to address it. > > However the crite

Re: [PATCH v2] btrfs: Test if btrfs will commit too many transaction for balance

2019-01-29 Thread Filipe Manana
On Tue, Jan 29, 2019 at 7:19 AM Qu Wenruo wrote: > > Kernel commit 64403612b73a ("btrfs: rework > btrfs_check_space_for_delayed_refs") is introducing a regression for > btrfs balance performance. > > Since that commit will cause btrfs to commit transaction for nothing > during transaction, to com

Re: [PATCH] btrfs: Test if btrfs will report false ENOSPC error balnacing small metadata chunk

2019-01-29 Thread Filipe Manana
On Tue, Jan 29, 2019 at 7:28 AM Qu Wenruo wrote: > > This is a long existing bug, caused by over-estimated metadata > space_info::bytes_may_use. Nop, this is a test case :) The sentence should be more like "This is a test case for a long existing bug, ...". > > There is one purposed patch for bt

Re: [PATCH 07/11] btrfs: move to fn pointers for get/put workspaces

2019-01-29 Thread Nikolay Borisov
On 28.01.19 г. 23:24 ч., Dennis Zhou wrote: > The previous patch added generic helpers for get_workspace() and > put_workspace(). Now, we can migrate ownership of the workspace_manager > to be in the compression type code as the compression code itself > doesn't care beyond being able to get a w

Re: [PATCH 10/11] btrfs: zstd use the passed through level instead of default

2019-01-29 Thread Nikolay Borisov
On 28.01.19 г. 23:24 ч., Dennis Zhou wrote: > Zstd currently only supports the default level of compression. This > patch switches to using the level passed in for btrfs zstd > configuration. > > Zstd workspaces now keep track of the requested level as this can differ > from the size of the wor

Re: [PATCH 09/11] btrfs: change set_level() to bound the level passed in

2019-01-29 Thread Nikolay Borisov
On 28.01.19 г. 23:24 ч., Dennis Zhou wrote: > Currently, the only user of set_level() is zlib which sets an internal > workspace parameter. As level is now plumbed into get_workspace(), this > can be handled there rather than separately. > > This repurposes set_level() to bound the level passed

Re: [PATCH 08/11] btrfs: plumb level through the compression interface

2019-01-29 Thread Nikolay Borisov
On 28.01.19 г. 23:24 ч., Dennis Zhou wrote: > Zlib compression supports multiple levels, but doesn't require changing > in how a workspace itself is created and managed. Zstd introduces a > different memory requirement such that higher levels of compression > require more memory. This requires c