Re: [PATCH v2] btrfs: Fix error handling in btrfs_cleanup_ordered_extents

2018-11-20 Thread Josef Bacik
On Fri, Oct 26, 2018 at 02:41:55PM +0300, Nikolay Borisov wrote: > Running btrfs/124 in a loop hung up on me sporadically with the > following call trace: > btrfs D0 5760 5324 0x > Call Trace: >? __schedule+0x243/0x800 >schedule+0x33/0x90 >

Re: [PATCH v5 1/3] btrfs: add helper function describe_block_group()

2018-11-20 Thread Anand Jain
Thanks for the review.. more below. On 11/20/2018 01:02 AM, David Sterba wrote: On Wed, Nov 14, 2018 at 09:17:10PM +0800, Anand Jain wrote: Improve on describe_relocation() add a common helper function to describe the block groups. Signed-off-by: Anand Jain Reviewed-by: David Sterba ---

[PATCH] btrfs: qgroup: Skip delayed data ref for reloc trees

2018-11-20 Thread Qu Wenruo
Currently we only check @ref_root in btrfs_add_delayed_data_ref() to determine whether a data delayed ref is for reloc tree. Such check is insufficient as for relocation we could pass @ref_root as the source file tree, causing qgroup to trace unchanged data extents even we're only relocating

[PATCH] btrfs: qgroup: Skip delayed data ref for reloc trees

2018-11-20 Thread Qu Wenruo
Currently we only check @ref_root in btrfs_add_delayed_data_ref() to determine whether a data delayed ref is for reloc tree. Such check is insufficient as for relocation we could pass @ref_root as the source file tree, causing qgroup to trace unchanged data extents even we're only relocating

Re: [PATCH v5 2/3] btrfs: balance: add args info during start and resume

2018-11-20 Thread Anand Jain
On 11/20/2018 01:07 AM, David Sterba wrote: On Wed, Nov 14, 2018 at 09:17:11PM +0800, Anand Jain wrote: Balance arg info is an important information to be reviewed for the system audit. So this patch adds them to the kernel log. Example: ->btrfs bal start -f

[PATCH v6 2/3] btrfs: balance: add args info during start and resume

2018-11-20 Thread Anand Jain
Balance arg info is an important information to be reviewed for the system audit. So this patch adds them to the kernel log. Example: ->btrfs bal start -f -mprofiles=raid1,convert=single,soft -dlimit=10..20,usage=50 /btrfs kernel: BTRFS info (device sdb): balance: start -f

[PATCH v6 1/3] btrfs: add helper function describe_block_group()

2018-11-20 Thread Anand Jain
Improve on describe_relocation() add a common helper function to describe the block groups. Signed-off-by: Anand Jain Reviewed-by: David Sterba --- v5->v6: Use () in the body for the args sent in defines Use right indent to align '\' Use goto to out_overflow instead of return

[PATCH v6 0/3] btrfs: balance: improve kernel logs

2018-11-20 Thread Anand Jain
v5->v6: Mostly the defines non functional changes. Use goto instead of return in middle of the define. Pls ref individual patches 1/3 and 2/3 for more info. v4->v5: Mainly address David review comment [1]. [1] https://patchwork.kernel.org/patch/10425987/ pls ref to individual patch 2/3

[PATCH v6 3/3] btrfs: balance: add kernel log for end or paused

2018-11-20 Thread Anand Jain
Add a kernel log when the balance ends, either for cancel or completed or if it is paused. Signed-off-by: Anand Jain --- v5->v6: Quite soul. nothing. v4->v5: nothing. v3->v4: nothing. v2->v3: nothing. v1->v2: Moved from 2/3 to 3/3 fs/btrfs/volumes.c | 7 +++ 1 file changed, 7 insertions(+)

Re: [PATCH] btrfs: qgroup: Skip delayed data ref for reloc trees

2018-11-20 Thread Nikolay Borisov
On 20.11.18 г. 10:46 ч., Qu Wenruo wrote: > Currently we only check @ref_root in btrfs_add_delayed_data_ref() to > determine whether a data delayed ref is for reloc tree. > > Such check is insufficient as for relocation we could pass @ref_root > as the source file tree, causing qgroup to trace

Re: [PATCH] btrfs: qgroup: Skip delayed data ref for reloc trees

2018-11-20 Thread Qu Wenruo
On 2018/11/20 下午4:51, Nikolay Borisov wrote: > > > On 20.11.18 г. 10:46 ч., Qu Wenruo wrote: >> Currently we only check @ref_root in btrfs_add_delayed_data_ref() to >> determine whether a data delayed ref is for reloc tree. >> >> Such check is insufficient as for relocation we could pass

Re: [RFC] BTRFS_DEV_REPLACE_ITEM_STATE_* doesn't match with on disk

2018-11-20 Thread Anand Jain
David, any comments on this please. Thanks, Anand On 11/13/2018 06:32 PM, Anand Jain wrote: David, Gentle ping. Thanks, Anand On 11/12/2018 03:50 PM, Nikolay Borisov wrote: On 12.11.18 г. 6:58 ч., Anand Jain wrote: The dev_replace_state defines are miss matched between the

Re: [PATCH v2] btrfs: Fix error handling in btrfs_cleanup_ordered_extents

2018-11-20 Thread Nikolay Borisov
On 20.11.18 г. 21:00 ч., Josef Bacik wrote: > On Fri, Oct 26, 2018 at 02:41:55PM +0300, Nikolay Borisov wrote: >> Running btrfs/124 in a loop hung up on me sporadically with the >> following call trace: >> btrfs D0 5760 5324 0x >> Call Trace: >> ?

[PATCH 1/4] btrfs: reada: reorder dev-replace locks before radix tree preload

2018-11-20 Thread David Sterba
The read lock is going to use rw semaphore that might sleep, this is not possible in the radix tree preload section. The lock nesting is now: * device replace * radix tree preload * readahead spinlock Signed-off-by: David Sterba --- fs/btrfs/reada.c | 12 +++- 1 file changed, 7

[PATCH 2/4] btrfs: dev-replace: swich locking to rw semaphore

2018-11-20 Thread David Sterba
The this is first part of removing the custom locking and waiting scheme used for device replace. It was probably copied from extent buffer locking, but there's nothing that would require more than is provided by the common locking primitives. The rw spinlock protects waiting tasks counter in

[PATCH 0/4] Replace custom device-replace locking with rwsem

2018-11-20 Thread David Sterba
The first cleanup part went to 4.19, the actual switch from the custom locking to rswem was postponed as I found performance degradation. This turned out to be related to VM cache settings, so I'm resending the series again. The custom locking is based on rwlock protected reader/writer counters,

[PATCH 3/4] btrfs: dev-replace: remove custom read/write blocking scheme

2018-11-20 Thread David Sterba
After the rw semaphore has been added, the custom blocking using ::blocking_readers and ::read_lock_wq is redundant. The blocking logic in __btrfs_map_block is replaced by extending the time the semaphore is held, that has the same blocking effect on writes as the previous custom scheme that

Re: [PATCH RESEND 0/9 v2] fix warn_on for replace cancel

2018-11-20 Thread David Sterba
On Tue, Nov 20, 2018 at 07:56:14PM +0800, Anand Jain wrote: > These two patches were sent as part of >[PATCH 0/9 v2] fix replace-start and replace-cancel racing > before but as these aren't integrated so I am sending these again. > > The patch [1] which is in misc-next, calls

Re: [PATCH RESEND v2 1/2] btrfs: quieten warn if replace is canceled at finish

2018-11-20 Thread David Sterba
On Tue, Nov 20, 2018 at 07:56:15PM +0800, Anand Jain wrote: > When we successfully cancel the replace its scrub returns -ECANCELED, > which then passed to btrfs_dev_replace_finishing(), it cleans up based > on the scrub returned status and propagates the same -ECANCELED back > the parent function.

[PATCH 4/4] btrfs: dev-replace: open code trivial locking helpers

2018-11-20 Thread David Sterba
The dev-replace locking functions are now trivial wrappers around rw semaphore that can be used directly everywhere. No functional change. Signed-off-by: David Sterba --- fs/btrfs/dev-replace.c | 81 -- fs/btrfs/dev-replace.h | 4 --- fs/btrfs/reada.c

Re: [PATCH] btrfs: qgroup: Skip delayed data ref for reloc trees

2018-11-20 Thread Qu Wenruo
On 2018/11/20 下午5:11, Nikolay Borisov wrote: > > > On 20.11.18 г. 11:07 ч., Qu Wenruo wrote: >> >> >> On 2018/11/20 下午4:51, Nikolay Borisov wrote: > >>> I'm beginning to wonder, should we document >>> btrfs_add_delayed_data_ref/btrfs_add_tree_ref arguments separate for >>> each function, or

[PATCH RESEND v2 1/2] btrfs: quieten warn if replace is canceled at finish

2018-11-20 Thread Anand Jain
When we successfully cancel the replace its scrub returns -ECANCELED, which then passed to btrfs_dev_replace_finishing(), it cleans up based on the scrub returned status and propagates the same -ECANCELED back the parent function. As of now only user can cancel the replace-scrub, so its ok to

[PATCH RESEND v2 2/2] btrfs: user requsted replace cancel is not an error

2018-11-20 Thread Anand Jain
As of now only user requested replace cancel can cancel the replace-scrub so no need to log error for it. Signed-off-by: Anand Jain --- v1->v2: none. fs/btrfs/dev-replace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c

[PATCH RESEND 0/9 v2] fix warn_on for replace cancel

2018-11-20 Thread Anand Jain
These two patches were sent as part of [PATCH 0/9 v2] fix replace-start and replace-cancel racing before but as these aren't integrated so I am sending these again. The patch [1] which is in misc-next, calls btrfs_dev_replace_finishing() after replace is canceled, so the ret argument passed to

Re: [PATCH] btrfs: qgroup: Skip delayed data ref for reloc trees

2018-11-20 Thread Nikolay Borisov
On 20.11.18 г. 11:07 ч., Qu Wenruo wrote: > > > On 2018/11/20 下午4:51, Nikolay Borisov wrote: >> I'm beginning to wonder, should we document >> btrfs_add_delayed_data_ref/btrfs_add_tree_ref arguments separate for >> each function, or should only the differences be documented - in this >> case

Re: [PATCH v6 0/3] btrfs: balance: improve kernel logs

2018-11-20 Thread David Sterba
On Tue, Nov 20, 2018 at 04:12:54PM +0800, Anand Jain wrote: > v5->v6: > Mostly the defines non functional changes. > Use goto instead of return in middle of the define. > Pls ref individual patches 1/3 and 2/3 for more info. > > v4->v5: > Mainly address David review comment [1]. > [1] >