Re: [Patch v5 0/7] btrfs: qgroup: Delay subtree scan to reduce overhead

2019-01-22 Thread Qu Wenruo
On 2019/1/23 下午3:15, Qu Wenruo wrote: > This patchset can be fetched from github: > https://github.com/adam900710/linux/tree/qgroup_delayed_subtree > > Which is based on v5.0-rc1. > > This patch address the heavy load subtree scan, but delaying it until > we're going to modify the swapped tree

[Patch v5 4/7] btrfs: qgroup: Refactor btrfs_qgroup_trace_subtree_swap()

2019-01-22 Thread Qu Wenruo
Refactor btrfs_qgroup_trace_subtree_swap() into qgroup_trace_subtree_swap(), which only needs two extent buffer and some other bool to control the behavior. This provides the basis for later delayed subtree scan work. Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 78 +

[Patch v5 1/7] btrfs: qgroup: Move reserved data account from btrfs_delayed_ref_head to btrfs_qgroup_extent_record

2019-01-22 Thread Qu Wenruo
[BUG] Btrfs/139 will fail with a pretty high possibility if the testing machine (VM) only has 2G ram. Resulting the final write success while it should fail due to EDQUOT, and the result fs will has quota exceeding the limit by 16K. The simplified reproducer will be: (needs a 2G ram VM) mkfs.b

[Patch v5 3/7] btrfs: relocation: Delay reloc tree deletion after merge_reloc_roots()

2019-01-22 Thread Qu Wenruo
Relocation code will drop btrfs_root::reloc_root as soon as merge_reloc_root() finishes. However later qgroup code will need to access btrfs_root::reloc_root after merge_reloc_root() for delayed subtree rescan. So alter the timming of resetting btrfs_root:::reloc_root, make it happens after trans

[Patch v5 6/7] btrfs: qgroup: Use delayed subtree rescan for balance

2019-01-22 Thread Qu Wenruo
Before this patch, qgroup code trace the whole subtree of subvolume and reloc trees unconditionally. This makes qgroup numbers consistent, but it could cause tons of unnecessary extent trace, which cause a lot of overhead. However for subtree swap of balance, since both subtree contains the same

[Patch v5 5/7] btrfs: qgroup: Introduce per-root swapped blocks infrastructure

2019-01-22 Thread Qu Wenruo
To allow delayed subtree swap rescan, btrfs needs to record per-root info about which tree blocks get swapped. So this patch introduces per-root btrfs_qgroup_swapped_blocks structure, which records which tree blocks get swapped. The designed workflow will be: 1) Record the subtree root block get

[Patch v5 7/7] btrfs: qgroup: Cleanup old subtree swap code

2019-01-22 Thread Qu Wenruo
Since it's replaced by new delayed subtree swap code, remove the original code. The cleanup is small since most of its core function is still used by delayed subtree swap trace. Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 94 --- fs/btrfs/qgroup.

[Patch v5 0/7] btrfs: qgroup: Delay subtree scan to reduce overhead

2019-01-22 Thread Qu Wenruo
This patchset can be fetched from github: https://github.com/adam900710/linux/tree/qgroup_delayed_subtree Which is based on v5.0-rc1. This patch address the heavy load subtree scan, but delaying it until we're going to modify the swapped tree block. The overall workflow is: 1) Record the subtre

[Patch v5 2/7] btrfs: honor path->skip_locking in backref code

2019-01-22 Thread Qu Wenruo
From: Josef Bacik Qgroups will do the old roots lookup at delayed ref time, which could be while walking down the extent root while running a delayed ref. This should be fine, except we specifically lock eb's in the backref walking code irrespective of path->skip_locking, which deadlocks the sys

Re: [PATCH v4 3/7] btrfs: relocation: Delay reloc tree deletion after merge_reloc_roots()

2019-01-22 Thread Qu Wenruo
On 2019/1/23 上午12:32, David Sterba wrote: > On Tue, Jan 15, 2019 at 04:16:00PM +0800, Qu Wenruo wrote: >> And to co-operate this, also delayed btrfs_drop_snapshot() call on reloc >> tree, btrfs_drop_snapshot() call will also be delayed to >> clean_dirty_subvs(). > > Can you please rephrase this

Re: [PATCH v4 0/7] btrfs: qgroup: Delay subtree scan to reduce overhead

2019-01-22 Thread Qu Wenruo
On 2019/1/23 上午12:28, David Sterba wrote: > On Tue, Jan 15, 2019 at 04:15:57PM +0800, Qu Wenruo wrote: >> This patchset can be fetched from github: >> https://github.com/adam900710/linux/tree/qgroup_delayed_subtree >> >> Which is based on v5.0-rc1. >> >> This patch address the heavy load subtree

Re: [PATCH 5/6 v2] btrfs: merge btrfs_find_device() and find_device()

2019-01-22 Thread Anand Jain
On 01/19/2019 02:48 PM, Anand Jain wrote: Both btrfs_find_device() and find_device() does the same things expect that latter function is not keen in seed device in the scan-context. So merge them. Signed-off-by: Anand Jain A gentle ping. Thanks, Anand --- v2: use bool instead of int.

Re: Do btrfs provide filesystem debugger?

2019-01-22 Thread Qu Wenruo
On 2019/1/23 上午7:41, Matthew Friday wrote: > Hi all, > > I recently started learning BTRFS internals, and one think that I > cannot find is filesystem debugger to browse on disk data structures > (like xfs_db or ext debugfs). You need "btrfs inspect dump-tree" and "btrfs inspect dump-super" >

Do btrfs provide filesystem debugger?

2019-01-22 Thread Matthew Friday
Hi all, I recently started learning BTRFS internals, and one think that I cannot find is filesystem debugger to browse on disk data structures (like xfs_db or ext debugfs). Do BTRFS provide similar way to navigate on disk structures? I can see the btrfs-debug-tree utility which provide whole tree

Re: Nasty corruption on large array, ideas welcome

2019-01-22 Thread Thiago Ramon
On Tue, Jan 22, 2019 at 6:43 PM Chris Murphy wrote: > > On Tue, Jan 22, 2019 at 9:41 AM Thiago Ramon wrote: > > > > Back again with pretty much the same problem, but now without a > > reasonable cause: > > I've bought a couple new 8TB disks, recovered everything I needed from > > my previously da

Re: [PATCH v4 5/7] btrfs: qgroup: Introduce per-root swapped blocks infrastructure

2019-01-22 Thread Qu Wenruo
On 2019/1/23 上午12:55, David Sterba wrote: > On Tue, Jan 15, 2019 at 04:16:02PM +0800, Qu Wenruo wrote: >> + >> +block = kmalloc(sizeof(*block), GFP_NOFS); >> +if (!block) { >> +ret = -ENOMEM; > > This goes to 'out' that marks quota as inconsistent, is this > intentional? Ye

[PATCH] [PATCH] btrfs: remove unused wariable 'num_pages'

2019-01-22 Thread Matthew Friday
Signed-off-by: Matthew Friday --- fs/btrfs/ioctl.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 9c8e1734429c..6243f734c0cd 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3278,7 +3278,6 @@ static int btrfs_extent_same(struct inode *src,

Re: [PATCH v3 0/5] btrfs: Enhancement to tree block validation

2019-01-22 Thread Qu Wenruo
On 2019/1/23 上午1:47, David Sterba wrote: > On Fri, Jan 18, 2019 at 10:19:51AM +0800, Qu Wenruo wrote: >> Patchset can be fetched from github: >> https://github.com/adam900710/linux/tree/write_time_tree_checker >> Which is based on v5.0-rc1 tag. >> >> This patchset has the following two features:

Re: Nasty corruption on large array, ideas welcome

2019-01-22 Thread Chris Murphy
On Tue, Jan 22, 2019 at 9:41 AM Thiago Ramon wrote: > > Back again with pretty much the same problem, but now without a > reasonable cause: > I've bought a couple new 8TB disks, recovered everything I needed from > my previously damaged FS to a new BTRFS on those 2 drives (single copy > mode), dou

Re: Incremental receive completes succesfully despite missing files

2019-01-22 Thread Hugo Mills
On Tue, Jan 22, 2019 at 12:37:34PM -0700, Chris Murphy wrote: > On Tue, Jan 22, 2019 at 10:57 AM Andrei Borzenkov wrote: > > "Related" is in the eye of the beholder. Clone subvolume, delete content > > of clone, reflink content of another volume into clone. Are original > > subvolume and clone rel

Re: Incremental receive completes succesfully despite missing files

2019-01-22 Thread Chris Murphy
On Tue, Jan 22, 2019 at 10:57 AM Andrei Borzenkov wrote: > > 22.01.2019 9:28, Chris Murphy пишет: > > On Mon, Jan 21, 2019 at 11:00 PM Remi Gauvin wrote: > >> > >> On 2019-01-21 11:54 p.m., Chris Murphy wrote: > >> # > >>> > >>> I expect the last command to fail because 1.ro1 is not the parent of

Re: Incremental receive completes succesfully despite missing files

2019-01-22 Thread Andrei Borzenkov
22.01.2019 9:28, Chris Murphy пишет: > On Mon, Jan 21, 2019 at 11:00 PM Remi Gauvin wrote: >> >> On 2019-01-21 11:54 p.m., Chris Murphy wrote: >> # >>> >>> I expect the last command to fail because 1.ro1 is not the parent of >>> 2.ro2. The command completes, and 2.ro2 is on the destination, and at

Re: [PATCH v3 0/5] btrfs: Enhancement to tree block validation

2019-01-22 Thread David Sterba
On Fri, Jan 18, 2019 at 10:19:51AM +0800, Qu Wenruo wrote: > Patchset can be fetched from github: > https://github.com/adam900710/linux/tree/write_time_tree_checker > Which is based on v5.0-rc1 tag. > > This patchset has the following two features: > - Tree block validation output enhancement >

Re: [PATCH v3 3/5] btrfs: extent_io: Kill the BUG_ON() in flush_write_bio()

2019-01-22 Thread David Sterba
On Fri, Jan 18, 2019 at 10:19:54AM +0800, Qu Wenruo wrote: > This BUG_ON() is really just a crappy way to workaround the _must_check > attribute of submit_one_bio(). > > Now kill the BUG_ON() and allow flush_write_bio() to return error > number. > > Also add _must_check attribute to flush_write_b

Re: btrfs receive deadlock and questions

2019-01-22 Thread Filipe Manana
On Tue, Jan 22, 2019 at 5:20 PM Eli V wrote: > > On Tue, Jan 22, 2019 at 11:03 AM Eli V wrote: > > > > On Tue, Jan 22, 2019 at 10:42 AM Filipe Manana wrote: > > > > > > On Tue, Jan 22, 2019 at 3:26 PM Eli V wrote: > > > > > > > > I seem to have it a deadlock trying out btrfs send & receive. Now

Re: btrfs receive deadlock and questions

2019-01-22 Thread Eli V
On Tue, Jan 22, 2019 at 11:03 AM Eli V wrote: > > On Tue, Jan 22, 2019 at 10:42 AM Filipe Manana wrote: > > > > On Tue, Jan 22, 2019 at 3:26 PM Eli V wrote: > > > > > > I seem to have it a deadlock trying out btrfs send & receive. Now I > > > haven't used btrfs send & receive much, so don't have

Re: [PATCH v4 6/7] btrfs: qgroup: Use delayed subtree rescan for balance

2019-01-22 Thread David Sterba
On Tue, Jan 15, 2019 at 04:16:03PM +0800, Qu Wenruo wrote: > +int btrfs_qgroup_trace_subtree_after_cow(struct btrfs_trans_handle *trans, > + struct btrfs_root *root, > + struct extent_buffer *subv_eb) > +{ > + struct btrf

Re: [PATCH v4 5/7] btrfs: qgroup: Introduce per-root swapped blocks infrastructure

2019-01-22 Thread David Sterba
On Tue, Jan 15, 2019 at 04:16:02PM +0800, Qu Wenruo wrote: > +/* > + * Record swapped tree blocks of a file/subvolume tree for delayed subtree > + * trace code. For detail check comment in fs/btrfs/qgroup.c. > + */ > +struct btrfs_qgroup_swapped_blocks { > + spinlock_t lock; > + struct rb_r

Re: Nasty corruption on large array, ideas welcome

2019-01-22 Thread Thiago Ramon
Back again with pretty much the same problem, but now without a reasonable cause: I've bought a couple new 8TB disks, recovered everything I needed from my previously damaged FS to a new BTRFS on those 2 drives (single copy mode), double-checked if everything was fine, then wipefs'd the old disks a

Re: [PATCH v4 4/7] btrfs: qgroup: Refactor btrfs_qgroup_trace_subtree_swap()

2019-01-22 Thread David Sterba
On Tue, Jan 15, 2019 at 04:16:01PM +0800, Qu Wenruo wrote: > Refactor btrfs_qgroup_trace_subtree_swap() into > qgroup_trace_subtree_swap(), which only needs two extent buffer and some > other bool to control the behavior. > > This provides the basis for later delayed subtree scan work. > > Signed

Re: [PATCH v4 3/7] btrfs: relocation: Delay reloc tree deletion after merge_reloc_roots()

2019-01-22 Thread David Sterba
On Tue, Jan 15, 2019 at 04:16:00PM +0800, Qu Wenruo wrote: > And to co-operate this, also delayed btrfs_drop_snapshot() call on reloc > tree, btrfs_drop_snapshot() call will also be delayed to > clean_dirty_subvs(). Can you please rephrase this paragraph? > This patch will increase the size of bt

Re: [PATCH v4 0/7] btrfs: qgroup: Delay subtree scan to reduce overhead

2019-01-22 Thread David Sterba
On Tue, Jan 15, 2019 at 04:15:57PM +0800, Qu Wenruo wrote: > This patchset can be fetched from github: > https://github.com/adam900710/linux/tree/qgroup_delayed_subtree > > Which is based on v5.0-rc1. > > This patch address the heavy load subtree scan, but delaying it until > we're going to modif

Re: btrfs receive deadlock and questions

2019-01-22 Thread Eli V
On Tue, Jan 22, 2019 at 10:42 AM Filipe Manana wrote: > > On Tue, Jan 22, 2019 at 3:26 PM Eli V wrote: > > > > I seem to have it a deadlock trying out btrfs send & receive. Now I > > haven't used btrfs send & receive much, so don't have much experience > > with them. Anyways, bug report and stack

Re: btrfs receive deadlock and questions

2019-01-22 Thread Filipe Manana
On Tue, Jan 22, 2019 at 3:26 PM Eli V wrote: > > I seem to have it a deadlock trying out btrfs send & receive. Now I > haven't used btrfs send & receive much, so don't have much experience > with them. Anyways, bug report and stack traces: > https://bugzilla.kernel.org/show_bug.cgi?id=202383 This

btrfs receive deadlock and questions

2019-01-22 Thread Eli V
I seem to have it a deadlock trying out btrfs send & receive. Now I haven't used btrfs send & receive much, so don't have much experience with them. Anyways, bug report and stack traces: https://bugzilla.kernel.org/show_bug.cgi?id=202383 Seems like the receive is hung as well as several kworkers.

2 enospc errors during balance, with some 20+ TB free space

2019-01-22 Thread Tomasz Chmielewski
Tried to run metadata-only balance a btrfs filesystem with RAID-10 metadata to RAID-1 metadata, it failed with "No space left on device". Seriously, 20 TB of free disk space is not enough to convert some 25 GB of metadata to a different format? O_o Kernel is 4.18.20. # time btrfs balance star

Re: [PATCH v2 2/3] btrfs: add read_mirror_policy parameter devid

2019-01-22 Thread Steven Davies
On 2019-01-22 13:43, Anand Jain wrote: On 01/21/2019 07:56 PM, Steven Davies wrote: On 2018-05-16 11:03, Anand Jain wrote: +    break; +    } I noticed that it's possible to pass this option multiple times at mount, which sets multiple devices as read mirrors. While tha

Re: [PATCH v2 2/3] btrfs: add read_mirror_policy parameter devid

2019-01-22 Thread Anand Jain
On 01/21/2019 07:56 PM, Steven Davies wrote: On 2018-05-16 11:03, Anand Jain wrote: Going back to an old patchset I was testing this weekend: Adds the mount option:   mount -o read_mirror_policy= To set the devid of the device which should be used for read. That means all the normal reads

btrfs RAID5 corrupted fs restore? data is OK

2019-01-22 Thread Artem Mygaiev
[re-posting old message, it seems it was not correctly posted due to subscription issue] Hello I am running Ubuntu Server 16.04 LTS with HWE stack (4.18 kernel). System is running on 2 protected SSDs in RAID1 mode, separate SSD assigned for swap and media download / processing cache and main data

Re: [PATCH 2/2] Btrfs: fix unprotected deletion from pending_chunks list

2019-01-22 Thread Alex Lyakas
Hi Filipe, Thank you for your response. I realize it was a long time, ago, but we are just now in the process of moving to stable kernel 4.14.x. Regarding the fix, I see now the relevant code in "btrfs_remove_block_group": mutex_lock(&fs_info->chunk_mutex); if (!list_empty(&em->list)) {