Re: [PATCH v3] btrfs-progs: add verbose option to btrfs device scan

2019-10-14 Thread Anand Jain
On 10/14/19 11:24 PM, David Sterba wrote: On Tue, Oct 08, 2019 at 10:53:37AM +0800, Anand Jain wrote: On 10/8/19 1:41 AM, David Sterba wrote: On Wed, Oct 02, 2019 at 12:11:52PM +0800, Anand Jain wrote: To help debug device scan issues, add verbose option to btrfs device scan. The common opti

Re: 5.3.0 deadlock: btrfs_sync_file / btrfs_async_reclaim_metadata_space / btrfs_page_mkwrite

2019-10-14 Thread Chris Murphy
On Mon, Oct 14, 2019 at 7:05 PM James Harvey wrote: > > On Sun, Oct 13, 2019 at 9:46 PM Chris Murphy wrote: > > > > On Sat, Oct 12, 2019 at 5:29 PM James Harvey > > wrote: > > > > > > Was using a temporary BTRFS volume to compile mongodb, which is quite > > > intensive and takes quite a bit of

Re: 5.3.0 deadlock: btrfs_sync_file / btrfs_async_reclaim_metadata_space / btrfs_page_mkwrite

2019-10-14 Thread James Harvey
On Sun, Oct 13, 2019 at 9:46 PM Chris Murphy wrote: > > On Sat, Oct 12, 2019 at 5:29 PM James Harvey wrote: > > > > Was using a temporary BTRFS volume to compile mongodb, which is quite > > intensive and takes quite a bit of time. The volume has been > > deadlocked for about 12 hours. > > > > Be

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

2019-10-14 Thread Qu Wenruo
On 2019/10/14 下午11:17, David Sterba wrote: > On Tue, Oct 08, 2019 at 12:49:29PM +0800, Qu Wenruo wrote: >> 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 infras

Re: [PATCH 15/19] btrfs: load block_groups into discard_list on mount

2019-10-14 Thread David Sterba
On Mon, Oct 14, 2019 at 04:17:46PM -0400, Dennis Zhou wrote: > On Thu, Oct 10, 2019 at 01:11:38PM -0400, Josef Bacik wrote: > > On Mon, Oct 07, 2019 at 04:17:46PM -0400, Dennis Zhou wrote: > > > Async discard doesn't remember the discard state of a block_group when > > > unmounting or when we crash

Re: [RFC PATCH 00/19] btrfs: async discard support

2019-10-14 Thread Dennis Zhou
On Fri, Oct 11, 2019 at 10:49:20AM +0300, Nikolay Borisov wrote: > > > On 7.10.19 г. 23:17 ч., Dennis Zhou wrote: > > Hello, > > > > > > > > > With async discard, we try to emphasize discarding larger regions > > and reusing the lba (implicit discard). The first is done by using the > > free

Re: [PATCH 15/19] btrfs: load block_groups into discard_list on mount

2019-10-14 Thread Dennis Zhou
On Thu, Oct 10, 2019 at 01:11:38PM -0400, Josef Bacik wrote: > On Mon, Oct 07, 2019 at 04:17:46PM -0400, Dennis Zhou wrote: > > Async discard doesn't remember the discard state of a block_group when > > unmounting or when we crash. So, any block_group that is not fully used > > may have undiscarded

Re: [PATCH 13/19] btrfs: have multiple discard lists

2019-10-14 Thread Dennis Zhou
On Thu, Oct 10, 2019 at 12:51:01PM -0400, Josef Bacik wrote: > On Mon, Oct 07, 2019 at 04:17:44PM -0400, Dennis Zhou wrote: > > Non-block group destruction discarding currently only had a single list > > with no minimum discard length. This can lead to caravaning more > > meaningful discards behind

Re: [PATCH 12/19] btrfs: limit max discard size for async discard

2019-10-14 Thread Dennis Zhou
On Thu, Oct 10, 2019 at 12:16:38PM -0400, Josef Bacik wrote: > On Mon, Oct 07, 2019 at 04:17:43PM -0400, Dennis Zhou wrote: > > Throttle the maximum size of a discard so that we can provide an upper > > bound for the rate of async discard. While the block layer is able to > > split discards into th

Re: [PATCH 11/19] btrfs: add bps discard rate limit

2019-10-14 Thread Dennis Zhou
On Thu, Oct 10, 2019 at 11:47:19AM -0400, Josef Bacik wrote: > On Mon, Oct 07, 2019 at 04:17:42PM -0400, Dennis Zhou wrote: > > Provide an ability to rate limit based on mbps in addition to the iops > > delay calculated from number of discardable extents. > > > > Signed-off-by: Dennis Zhou > > --

Re: [PATCH 08/19] btrfs: track discardable extents for asnyc discard

2019-10-14 Thread Dennis Zhou
On Thu, Oct 10, 2019 at 11:36:54AM -0400, Josef Bacik wrote: > On Mon, Oct 07, 2019 at 04:17:39PM -0400, Dennis Zhou wrote: > > The number of discardable extents will serve as the rate limiting metric > > for how often we should discard. This keeps track of discardable extents > > in the free space

Re: [PATCH 07/19] btrfs: discard one region at a time in async discard

2019-10-14 Thread Dennis Zhou
On Thu, Oct 10, 2019 at 11:22:44AM -0400, Josef Bacik wrote: > On Mon, Oct 07, 2019 at 04:17:38PM -0400, Dennis Zhou wrote: > > The prior two patches added discarding via a background workqueue. This > > just piggybacked off of the fstrim code to trim the whole block at once. > > Well inevitably th

Re: [PATCH] Setup GitLab-CI for btrfs-progs

2019-10-14 Thread Lakshmipathi.G
On Mon, Oct 07, 2019 at 07:52:35PM +0200, David Sterba wrote: > > Is it possible to move the files to ci/gitlab? .gitlab-ci.yml must be > probably in the top-level dir but that's acceptable. > Ok added these changes to Patch V2. > > The scripts look good to me but I have limited knowledge of th

Re: Massive filesystem corruption since kernel 5.2 (ARCH)

2019-10-14 Thread Chris Murphy
On Sun, Oct 13, 2019 at 8:07 PM Adam Bahe wrote: > > > Until the fix gets merged to 5.2 kernels (and 5.3), I don't really > > recommend running 5.2 or 5.3. > > I know fixes went in to distro specific kernels. But wanted to verify > if the fix went into the vanilla kernel.org kernel? If so, what >

[PATCH v2] Setup GitLab-CI for btrfs-progs

2019-10-14 Thread Lakshmipathi.G
Make use of GitLab-CI nested virutal environment to start QEMU instance inside containers and perform btrfs-progs build, execute unit test cases and save the logs. More details can be found at https://github.com/kdave/btrfs-progs/issues/171 Signed-off-by: Lakshmipathi.G --- .gitlab-ci.yml

Re: [PATCH v3] btrfs-progs: add verbose option to btrfs device scan

2019-10-14 Thread David Sterba
On Tue, Oct 08, 2019 at 10:53:37AM +0800, Anand Jain wrote: > On 10/8/19 1:41 AM, David Sterba wrote: > > On Wed, Oct 02, 2019 at 12:11:52PM +0800, Anand Jain wrote: > >> To help debug device scan issues, add verbose option to btrfs device scan. > > > > The common options like --verbose are going

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

2019-10-14 Thread David Sterba
On Tue, Oct 08, 2019 at 12:49:29PM +0800, Qu Wenruo wrote: > 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

[PATCH 15/15] btrfs: compression: remove ops pointer from workspace_manager

2019-10-14 Thread David Sterba
We can infer the ops from the type that is now passed to all functions that would need it, this makes workspace_manager::ops redundant and can be removed. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 6 ++ fs/btrfs/compression.h | 1 - 2 files changed, 2 insertions(+), 5 deletion

[PATCH 13/15] btrfs: compression: pass type to btrfs_put_workspace

2019-10-14 Thread David Sterba
We can infer the workspace_manager from type and the type will be used in the following patch to call a common helper for free_workspace. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 13 ++--- fs/btrfs/compression.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) d

[PATCH 11/15] btrfs: compression: pass type to btrfs_get_workspace

2019-10-14 Thread David Sterba
We can infer the workspace_manager from type and the type will be used in the following patch to call a common helper for alloc_workspace. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 12 +--- fs/btrfs/compression.h | 3 +-- fs/btrfs/zlib.c| 2 +- 3 files changed, 7

[PATCH 12/15] btrfs: compression: inline alloc_workspace

2019-10-14 Thread David Sterba
Replace indirect calls to alloc_workspace by switch and calls to the specific callbacks. This is mainly to get rid of the indirection due to spectre vulnerability mitigations. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 21 ++--- fs/btrfs/compression.h | 2 -- fs/bt

[PATCH 14/15] btrfs: compression: inline free_workspace

2019-10-14 Thread David Sterba
Replace indirect calls to free_workspace by switch and calls to the specific callbacks. This is mainly to get rid of the indirection due to spectre vulnerability mitigations. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 21 ++--- fs/btrfs/compression.h | 2 -- fs/btr

[PATCH 09/15] btrfs: compression: inline get_workspace

2019-10-14 Thread David Sterba
Majority of the callbacks is trivial, we don't gain anything by the indirection, so replace them by a switch function. ZLIB needs to adjust level in the callback and ZSTD workspace management is complex, the rest is call to the helper. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 23

[PATCH 10/15] btrfs: compression: inline put_workspace

2019-10-14 Thread David Sterba
Similar to get_workspace, majority of the callbacks is trivial, we don't gain anything by the indirection, so replace them by a switch function. Trivial callback implementations use the helper. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 24 +++- fs/btrfs/compres

[PATCH 08/15] btrfs: compression: export alloc/free/get/put callbacks of all algos

2019-10-14 Thread David Sterba
The indirect calls will be replaced by a switch in compression.c. (Switch is faster than indirect calls with when Spectre mitigations are enabled). Signed-off-by: David Sterba --- fs/btrfs/compression.c | 12 fs/btrfs/lzo.c | 8 fs/btrfs/zlib.c| 8

[PATCH 01/15] btrfs: export compression and decompression callbacks

2019-10-14 Thread David Sterba
Export compress_pages, decompress_bio and decompress callbacks for all compression algos. The indirect calls will be replaced by a switch. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 24 fs/btrfs/lzo.c | 19 +++ fs/btrfs/zlib.c

[PATCH 04/15] btrfs: compression: let workspace manager init take only the type

2019-10-14 Thread David Sterba
With the access to the workspace structures, we can look it up together with the compression ops inside the workspace manager init helper. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 7 --- fs/btrfs/compression.h | 3 +-- fs/btrfs/lzo.c | 2 +- fs/btrfs/zlib.c| 2

[PATCH 06/15] btrfs: compression: let workspace manager cleanup take only the type

2019-10-14 Thread David Sterba
With the access to the workspace structures, we can look it up together with the compression ops inside the workspace manager cleanup helper. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 6 -- fs/btrfs/compression.h | 2 +- fs/btrfs/lzo.c | 2 +- fs/btrfs/zlib.c|

[PATCH 07/15] btrfs: compression: inline cleanup_workspace_manager

2019-10-14 Thread David Sterba
Replace loop calling to all algos with a list of direct calls to the cleanup manager callback. When that becomes trivial it is replaced by direct call to the helper. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 17 ++--- fs/btrfs/compression.h | 3 --- fs/btrfs/lzo.c

[PATCH 02/15] btrfs: switch compression callbacks to direct calls

2019-10-14 Thread David Sterba
The indirect calls bring some overhead due to spectre vulnerability mitigations. The number of cases is small and below the threshold (10-20) where indirect call would be better. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 77 +- fs/btrfs/comp

[PATCH 05/15] btrfs: compression: inline init_workspace_manager

2019-10-14 Thread David Sterba
Replace loop calling to all algos with a list of direct calls to the init manager callback. When that becomes trivial it is replaced by direct call to the helper. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 17 ++--- fs/btrfs/compression.h | 3 --- fs/btrfs/lzo.c

[PATCH 03/15] btrfs: compression: attach workspace manager to the ops

2019-10-14 Thread David Sterba
There's a lot of indirection when the generic code calls into algo-specific callbacks to reach the private workspace manager structure and back to the generic code. To simplify that, export the workspace manager for heuristic, LZO and ZLIB, while ZSTD is going to use it's own manager. Signed-off-

[PATCH 00/15] Remove callback indirections in compression code

2019-10-14 Thread David Sterba
The series removes all per-compression algorithm callbacks and replaces them with a switches. Lots of indirections are simplified and while it looks nice from design POV, we don't need to over-engineer it as we have only fixed known number of the users and not public API. The cost of indirect func

Re: [PATCH] fs: use READ_ONCE/WRITE_ONCE with the i_size helpers

2019-10-14 Thread David Sterba
On Fri, Oct 11, 2019 at 04:20:50PM -0400, Josef Bacik wrote: > I spent the last few weeks running down a weird regression in btrfs we > were seeing in production. It turned out to be introduced by > 62b37622718c, which took the following > > loff_t isize = i_size_read(inode); > > actual_end = mi

Re: [PATCH] btrfs: save i_size in compress_file_range

2019-10-14 Thread David Sterba
On Fri, Oct 11, 2019 at 09:03:54AM -0400, Josef Bacik wrote: > this is happening because the page is not locked when doing > clear_page_dirty_for_io. Looking at the core dump it was because our > async_extent had a ram_size of 24576 but our async_chunk range only > spanned 20480, so we had a whole

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

2019-10-14 Thread Anand Jain
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 044981cf6df9..1c5728e6a660 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1570,6 +1570,8 @@ struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info, if (location->objectid == BTRFS_FREE_SPACE_TREE_OB

Re: [PATCH] fs: use READ_ONCE/WRITE_ONCE with the i_size helpers

2019-10-14 Thread Jan Kara
On Fri 11-10-19 16:20:50, Josef Bacik wrote: > I spent the last few weeks running down a weird regression in btrfs we > were seeing in production. It turned out to be introduced by > 62b37622718c, which took the following > > loff_t isize = i_size_read(inode); > > actual_end = min_t(u64, isize,