Help needed, server is unresponsive after btrfs balance

2019-02-04 Thread Moritz M
Hi, I'm running a Ubuntu server with a btrfs RAID1 consisting of three HDDs. I do balancing daily via btrfs balance start -dusage=50 -dlimit=2 -musage=50 -mlimit=4 / It usually takes between 1 - 10 minutes. But today the server was unresponsive (no ssh connect possible, no direct login via

Re: Help needed, server is unresponsive after btrfs balance

2019-02-04 Thread Qu Wenruo
On 2019/2/4 下午7:47, Moritz M wrote: > Hi, > > I'm running a Ubuntu server with a btrfs RAID1 consisting of three HDDs. > > I do balancing daily via > >> btrfs balance start -dusage=50 -dlimit=2 -musage=50 -mlimit=4 / > > It usually takes between 1 - 10 minutes. > > But today the server was u

Re: Help needed, server is unresponsive after btrfs balance

2019-02-04 Thread Moritz M
You're using qgroups, it's known to cause huge performance overhead for balance. We have upcoming patches to solve it, but it not going to mainline before v5.1 kernel. So please disable qgroups if you're not using it actively. Thanks, was not aware that I turned it on. Is btrfs quota disabl

Re: [PATCH 02/15] btrfs: Make WARN_ON in a canonical form

2019-02-04 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes ThumshirnSUSE Labs Filesystems jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG N

Re: [PATCH 03/15] btrfs: Remove EXTENT_FIRST_DELALLOC bit

2019-02-04 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes ThumshirnSUSE Labs Filesystems jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG N

Re: [PATCH 04/15] btrfs: combine device update operations during transaction commit

2019-02-04 Thread Johannes Thumshirn
On 30/01/2019 15:50, Nikolay Borisov wrote: > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index 888d72dda794..25dab68070dc 100644 > --- a/fs/btrfs/disk-io.c > +++ b/fs/btrfs/disk-io.c > @@ -4498,6 +4498,15 @@ void btrfs_cleanup_one_transaction(struct > btrfs_transaction *cur_trans, >

Re: [PATCH 05/15] btrfs: Handle pending/pinned chunks before blockgroup relocation during device shrink

2019-02-04 Thread Johannes Thumshirn
Looks good to me, Reviewed-by: Johannes Thumshirn -- Johannes ThumshirnSUSE Labs Filesystems jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 2128

Re: [PATCH 06/15] btrfs: Rename and export clear_btree_io_tree

2019-02-04 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes ThumshirnSUSE Labs Filesystems jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG N

Re: [PATCH 11/15] btrfs: Factor out in_range macro

2019-02-04 Thread Johannes Thumshirn
On 30/01/2019 15:50, Nikolay Borisov wrote: > This is used in more than one places so let's factor it out in ctree.h. > No functional changes. You could move this before 9/15 of your series so you don't need to duplicate the macro in 9/15. And also (wanted to comment this to 9/15 but OK here as w

Re: [PATCH 14/15] btrfs: Implement find_first_clear_extent_bit

2019-02-04 Thread Johannes Thumshirn
On 30/01/2019 15:51, Nikolay Borisov wrote: [...] > > +/* find_first_clear_extent_bit - finds the first range that has @bits not set > + * and that starts after @start > + * NIT: Shouldn't kerneldoc comments start with a /** and a newline afterwards? -- Johannes Thumshirn

[PATCH] Btrfs: fix file corruption after snapshotting

2019-02-04 Thread fdmanana
From: Filipe Manana When we are mixing buffered writes with direct IO writes against the same file and snapshotting is happening concurrently, we can end up with a corrupt file content in the snapshot. Example: 1) Inode/file is empty. 2) Snapshotting starts. 2) Buffered write at offset 0 lengt

Re: [PATCH 10/15] btrfs: Remove 'trans' argument from find_free_dev_extent(_start)

2019-02-04 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes ThumshirnSUSE Labs Filesystems jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nü

Re: [PATCH 04/15] btrfs: combine device update operations during transaction commit

2019-02-04 Thread Nikolay Borisov
On 4.02.19 г. 15:25 ч., Johannes Thumshirn wrote: > On 30/01/2019 15:50, Nikolay Borisov wrote: >> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c >> index 888d72dda794..25dab68070dc 100644 >> --- a/fs/btrfs/disk-io.c >> +++ b/fs/btrfs/disk-io.c >> @@ -4498,6 +4498,15 @@ void btrfs_cleanup_

Re: [PATCH 14/15] btrfs: Implement find_first_clear_extent_bit

2019-02-04 Thread Nikolay Borisov
On 30.01.19 г. 16:51 ч., Nikolay Borisov wrote: > This function is very similar to find_first_extent_bit except that it > locates the first contiguous span of space which does not have bits set. > It's intended use is in the freespace trimming code. > > Signed-off-by: Nikolay Borisov > --- >

Re: btrfs as / filesystem in RAID1

2019-02-04 Thread Patrik Lundquist
On Sun, 3 Feb 2019 at 01:24, Chris Murphy wrote: > > 1. At least with raid1/10, a particular device can only be mounted > rw,degraded one time and from then on it fails, and can only be ro > mounted. There are patches for this but I don't think they've been > merged still. That should be fixed si

Re: btrfs as / filesystem in RAID1

2019-02-04 Thread Austin S. Hemmelgarn
On 2019-02-04 12:47, Patrik Lundquist wrote: On Sun, 3 Feb 2019 at 01:24, Chris Murphy wrote: 1. At least with raid1/10, a particular device can only be mounted rw,degraded one time and from then on it fails, and can only be ro mounted. There are patches for this but I don't think they've been

[PATCH 12/12] btrfs: add zstd compression level support

2019-02-04 Thread Dennis Zhou
Zstd compression requires different amounts of memory for each level of compression. The prior patches implemented indirection to allow for each compression type to manage their workspaces independently. This patch uses this indirection to implement compression level support for zstd. To manage th

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

2019-02-04 Thread Dennis Zhou
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: Dennis Zhou Reviewed-by: Nikolay Borisov Reviewed-by: Josef Bacik --- v

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

2019-02-04 Thread Dennis Zhou
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 workspace. Signed-off-by: Dennis Zhou Reviewed-by: Nikolay B

[PATCH 11/12] btrfs: make zstd memory requirements monotonic

2019-02-04 Thread Dennis Zhou
It is possible based on the level configurations that a higher level workspace uses less memory than a lower level workspace. In order to reuse workspaces, this must be made a monotonic relationship. This precomputes the required memory for each level and enforces the monotonicity between level and

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

2019-02-04 Thread Dennis Zhou
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 workspace. The init/cleanup and get/put methods are abst

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

2019-02-04 Thread Dennis Zhou
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 changes in how the alloc()/get() methods work for zstd.

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

2019-02-04 Thread Dennis Zhou
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 in so it can be used when setting the mounts compression

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

2019-02-04 Thread Dennis Zhou
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 will be the generic implementation for btrfs workspace management. Sign

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

2019-02-04 Thread Dennis Zhou
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: Nikolay Borisov Reviewed-by: Josef Bacik --- fs/btrfs/compression.c | 11 +++ 1 file changed, 7

[PATCH v2 00/12] btrfs: add zstd compression level support

2019-02-04 Thread Dennis Zhou
Hi everyone, V2 had only a handful of changes outside of minor feedback. 0001: - use functions over macros 0003: - BTRFS_NR_WORKSPACE_MANAGERS is added instead of overriding BTRFS_COMPRESS_TYPES 0011 (new): - address monotonic memory requirement for zstd workspaces 0012: - increase reclaim timer

[PATCH 02/12] btrfs: rename workspaces_list to workspace_manager

2019-02-04 Thread Dennis Zhou
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: Nikolay Borisov Reviewed-by: Josef Bacik --- fs/btrfs/compression.c | 46 +-

[PATCH 01/12] btrfs: add helpers for compression type and level

2019-02-04 Thread Dennis Zhou
It is very easy to miss places that rely on a certain bitshifting for decyphering the type_level overloading. Add helpers to do this instead. Signed-off-by: Dennis Zhou Reviewed-by: Nikolay Borisov Reviewed-by: Josef Bacik Cc: Omar Sandoval --- fs/btrfs/compression.c | 2 +- fs/btrfs/compres

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

2019-02-04 Thread Dennis Zhou
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 from a workspace_manager. The compression code shouldn't really care h

Re: btrfs as / filesystem in RAID1

2019-02-04 Thread Patrik Lundquist
On Mon, 4 Feb 2019 at 18:55, Austin S. Hemmelgarn wrote: > > On 2019-02-04 12:47, Patrik Lundquist wrote: > > On Sun, 3 Feb 2019 at 01:24, Chris Murphy wrote: > >> > >> 1. At least with raid1/10, a particular device can only be mounted > >> rw,degraded one time and from then on it fails, and can

Re: btrfs as / filesystem in RAID1

2019-02-04 Thread Chris Murphy
On Mon, Feb 4, 2019 at 3:19 PM Patrik Lundquist wrote: > > On Mon, 4 Feb 2019 at 18:55, Austin S. Hemmelgarn > wrote: > > > > On 2019-02-04 12:47, Patrik Lundquist wrote: > > > On Sun, 3 Feb 2019 at 01:24, Chris Murphy wrote: > > >> > > >> 1. At least with raid1/10, a particular device can only

[PATCH 1/2] btrfs-progs: Port kernel fs_devices::total_rw_bytes to btrfs-progs

2019-02-04 Thread Qu Wenruo
Unlike kernel, btrfs-progs doesn't (yet) support devices grow/shrink, the port only needs to handle open_ctree() time initialization (at read_one_dev()), and btrfs_add_device() used for mkfs. This provide the basis for incoming unification of chunk allocator behavior. Signed-off-by: Qu Wenruo --

[PATCH 2/2] btrfs-progs: Unify metadata chunk size with kernel

2019-02-04 Thread Qu Wenruo
Mkfs tends to create pretty large metadata chunk compared to kernel: Node size: 16384 Sector size:4096 Filesystem size:10.00GiB Block group profiles: Data: single8.00MiB Metadata: DUP 1.00GiB System: DU

Re: btrfs as / filesystem in RAID1

2019-02-04 Thread Chris Murphy
On Mon, Feb 4, 2019 at 11:46 PM Chris Murphy wrote: > > After remounting both devices and scrubbing, it's dog slow. 14 minutes > to scrub a 4GiB file system, complaining the whole time about > checksums on the files not replicated. All it appears to be doing is > replicating metadata at a snails p