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

2019-10-01 Thread Anand Jain
To help debug device scan issues, add verbose option to btrfs device scan. Signed-off-by: Anand Jain Tested-by: Graham Cobb --- v3.1: Add --help as well. And update the wordings in Documentation. v3: Add --verbose long option and update documentation. Thanks Graham.A Add Tested-by. v2: Use b

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

2019-10-01 Thread Anand Jain
To help debug device scan issues, add verbose option to btrfs device scan. Signed-off-by: Anand Jain Tested-by: Graham Cobb --- v3: Add --verbose long option and update documentation. Thanks Graham.A Add Tested-by. v2: Use bool instead of int as a btrfs_scan_device() argument. Documentatio

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

2019-10-01 Thread Anand Jain
On 10/1/19 6:37 PM, Anand Jain wrote: Shouldn't "--verbose" be accepted as a long version of the option? That would mean adding it to long_options. For verbose we provide -v in    btrfs balance    btrfs convert    btrfs filesystem    btrfs inspect-internal    btrfs rescue and -v|--verbo

[PATCH] btrfs/194: add a test for multi-subvolume fsyncing

2019-10-01 Thread Josef Bacik
From: Josef Bacik I discovered a problem in btrfs where we'd end up pointing at a block we hadn't written out yet. This is triggered by a race when two different files on two different subvolumes fsync. This test exercises this path with dm-log-writes, and then replays the log at every FUA to v

Re: [PATCH][v2] btrfs-progs: add a --check-bg-usage option to fsck

2019-10-01 Thread David Sterba
On Fri, Aug 02, 2019 at 12:09:53PM -0400, Josef Bacik wrote: > Sometimes when messing with the chunk allocator code we can end up > over-allocating chunks. Generally speaking I'll notice this when a > random xfstest fails with ENOSPC when it shouldn't, but I'm super > worried that I won't catch a

Re: [PATCH][v3] btrfs: add a force_chunk_alloc to space_info's sysfs

2019-10-01 Thread Josef Bacik
On Tue, Oct 01, 2019 at 08:23:51PM +0200, David Sterba wrote: > On Mon, Aug 05, 2019 at 02:31:53PM -0400, Josef Bacik wrote: > > In testing various things such as the btrfsck patch to detect over > > allocation of chunks, empty block group deletion, and balance I've had > > various ways to force ch

Re: [PATCH][v3] btrfs: add a force_chunk_alloc to space_info's sysfs

2019-10-01 Thread David Sterba
On Mon, Aug 05, 2019 at 02:31:53PM -0400, Josef Bacik wrote: > In testing various things such as the btrfsck patch to detect over > allocation of chunks, empty block group deletion, and balance I've had > various ways to force chunk allocations for debug purposes. Add a sysfs > file to enable forc

Re: [PATCH] btrfs: nofs inode allocations

2019-10-01 Thread David Sterba
On Mon, Sep 09, 2019 at 10:12:04AM -0400, Josef Bacik wrote: > A user reported a lockdep splat > > == > WARNING: possible circular locking dependency detected > 5.2.11-gentoo #2 Not tainted > --

Re: BTRFS Raid5 error during Scrub.

2019-10-01 Thread Chris Murphy
On Mon, Sep 30, 2019 at 3:37 AM Robert Krig wrote: > > I've upgraded to btrfs-progs v5.2.1 > Here is the output from btrfs check -p --readonly /dev/sda > > > Opening filesystem to check... > Checking filesystem on /dev/sda > UUID: f7573191-664f-4540-a830-71ad654d9301 > [1/7] checking root items

Re: [PATCH] btrfs: nofs inode allocations

2019-10-01 Thread David Sterba
On Mon, Sep 09, 2019 at 05:28:11PM +0300, Nikolay Borisov wrote: > > This is because btrfs_new_inode() calls new_inode() under the > > transaction. We could probably move the new_inode() outside of this but > > for now just wrap it in memalloc_nofs_save(). > > If I'm understanding correctly what

[PATCH 3/3] btrfs: add __pure attribute to functions

2019-10-01 Thread David Sterba
The attribute is more relaxed than const and the functions could dereference pointers, as long as the observable state is not changed. We do have such functions, based on -Wsuggest-attribute=pure . The visible effects of this patch are negligible, there are differences in the assembly but hard to

[PATCH 2/3] btrfs: add const function attribute

2019-10-01 Thread David Sterba
For some reason the attribute is called __attribute_const__ and not __const, marks functions that have no observable effects on program state, IOW not reading pointers, just the arguments and calculating a value. Allows the compiler to do some optimizations, based on -Wsuggest-attribute=const . The

[PATCH 1/3] btrfs: add __cold attribute to more functions

2019-10-01 Thread David Sterba
The attribute can mark functions supposed to be called rarely if at all and the text can be moved to sections far from the other code. The attribute has been added to several functions already, this patch is based on hints given by gcc -Wsuggest-attribute=cold. The net effect of this patch is decr

[PATCH 0/3] Coldify, constify, purify (function attributes)

2019-10-01 Thread David Sterba
There's a gcc option -Wsuggest-attribute that, as it says, suggests some function attributes to provide some hints and allowing more optimizations. Debug build textdata bss dec hex filename 1514058 146768 27496 1688322 19c302 pre/btrfs.ko 1512603 146736 27496 1686835 19

[PATCH 1/2] btrfs: add 64bit safe helper for power of two checks

2019-10-01 Thread David Sterba
As is_power_of_two takes unsigned long, it's not safe on 32bit architectures, but we could pass any u64 value in seveal places. Add a separate helper and also an alias that better expresses the purpose for which the helper is used. Signed-off-by: David Sterba --- fs/btrfs/misc.h | 11 +++

[PATCH 0/2] Bit helpers cleanup

2019-10-01 Thread David Sterba
Depends on patch "btrfs: fix balance convert to single on 32-bit host CPUs" that's now in misc-next and cleans up the helpers as discussed at https://lore.kernel.org/linux-btrfs/20190912235507.3de79423...@james.kirk.hungrycats.org/ David Sterba (2): btrfs: add 64bit safe helper for power of two

[PATCH 2/2] btrfs: use has_single_bit_set for clarity

2019-10-01 Thread David Sterba
Replace is_power_of_2 with the helper that is self-documenting and remove the open coded call in alloc_profile_is_valid. Signed-off-by: David Sterba --- fs/btrfs/tree-checker.c | 15 --- fs/btrfs/volumes.c | 7 +-- 2 files changed, 9 insertions(+), 13 deletions(-) diff --g

Re: [PATCH] btrfs: fix balance convert to single on 32-bit host CPUs

2019-10-01 Thread David Sterba
On Mon, Sep 23, 2019 at 05:14:04PM +0200, David Sterba wrote: > On Thu, Sep 12, 2019 at 07:55:01PM -0400, Zygo Blaxell wrote: > > Currently, the command: > > > > btrfs balance start -dconvert=single,soft . > > > > on a Raspberry Pi produces the following kernel message: > > > > BTRFS err

[PATCH AUTOSEL 5.3 71/71] Btrfs: fix selftests failure due to uninitialized i_mode in test inodes

2019-10-01 Thread Sasha Levin
From: Filipe Manana [ Upstream commit 9f7fec0ba89108b9385f1b9fb167861224912a4a ] Some of the self tests create a test inode, setup some extents and then do calls to btrfs_get_extent() to test that the corresponding extent maps exist and are correct. However btrfs_get_extent(), since the 5.2 merg

[PATCH AUTOSEL 5.2 63/63] Btrfs: fix selftests failure due to uninitialized i_mode in test inodes

2019-10-01 Thread Sasha Levin
From: Filipe Manana [ Upstream commit 9f7fec0ba89108b9385f1b9fb167861224912a4a ] Some of the self tests create a test inode, setup some extents and then do calls to btrfs_get_extent() to test that the corresponding extent maps exist and are correct. However btrfs_get_extent(), since the 5.2 merg

Re: [PATCH] btrfs: fix incorrect updating of log root tree

2019-10-01 Thread David Sterba
On Mon, Sep 30, 2019 at 04:27:25PM -0400, Josef Bacik wrote: > We've historically had reports of being unable to mount file systems > because the tree log root couldn't be read. Usually this is the "parent > transid failure", but could be any of the related errors, including > "fsid mismatch" or "

Re: [PATCH 2/2] btrfs: use btrfs_block_group_cache_done in update_block_group

2019-10-01 Thread Nikolay Borisov
On 24.09.19 г. 23:50 ч., Josef Bacik wrote: > When free'ing extents in a block group we check to see if the block > group is not cached, and then cache it if we need to. However we'll > just carry on as long as we're loading the cache. This is problematic > because we are dirtying the block gr

Re: [PATCH] btrfs: fix incorrect updating of log root tree

2019-10-01 Thread Filipe Manana
On Mon, Sep 30, 2019 at 11:25 PM Josef Bacik wrote: > > We've historically had reports of being unable to mount file systems > because the tree log root couldn't be read. Usually this is the "parent > transid failure", but could be any of the related errors, including > "fsid mismatch" or "bad tr

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

2019-10-01 Thread Anand Jain
Shouldn't "--verbose" be accepted as a long version of the option? That would mean adding it to long_options. For verbose we provide -v in btrfs balance btrfs convert btrfs filesystem btrfs inspect-internal btrfs rescue and -v|--verbose in btrfs send btrfs restore btr

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

2019-10-01 Thread Graham Cobb
On 01/10/2019 08:52, Anand Jain wrote: > Ping? > > > On 9/25/19 4:07 PM, Anand Jain wrote: >> To help debug device scan issues, add verbose option to btrfs device >> scan. >> >> Signed-off-by: Anand Jain >> --- >> v2: Use bool instead of int as a btrfs_scan_device() argument. >> >>   cmds/device

Re: [PATCH v2 2/2] btrfs: Add test for btrfs balance convert functionality

2019-10-01 Thread Nikolay Borisov
On 1.10.19 г. 12:04 ч., Nikolay Borisov wrote: > Add basic test to ensure btrfs conversion functionality is tested. This test > exercies conversion to all possible types of the data portion. This is > sufficient > since from the POV of relocation we are only moving blockgroups. > > Signed-off

[PATCH v2 2/2] btrfs: Add test for btrfs balance convert functionality

2019-10-01 Thread Nikolay Borisov
Add basic test to ensure btrfs conversion functionality is tested. This test exercies conversion to all possible types of the data portion. This is sufficient since from the POV of relocation we are only moving blockgroups. Signed-off-by: Nikolay Borisov --- tests/btrfs/194 | 84 ++

[PATCH v2 1/2] common/rc: Remove special handing of 'dup' argument for btrfs

2019-10-01 Thread Nikolay Borisov
_scratch_pool_mkfs special cases the command executed when 'dup' option is used when creating a filesystem. This is wrong since 'dup' works for all profiles and number of devices. This bug manifested while exercising btrfs' balance argument combinations test. Signed-off-by: Nikolay Borisov --- V2

Re: [PATCH] btrfs-progs: drop unique uuid test for btrfstune -M

2019-10-01 Thread Anand Jain
Ping. Just found that- an image with metadata_uuid can't be a seed device - does not make any sense to me as to why. And test_uuid_unique() blocks undo of metadata_uuid on certain systems. Moreover the reason to use test_uuid_unique() in the first place is arbitrary. Thanks, Anand On 9/

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

2019-10-01 Thread Anand Jain
Ping? On 9/25/19 4:07 PM, Anand Jain wrote: To help debug device scan issues, add verbose option to btrfs device scan. Signed-off-by: Anand Jain --- v2: Use bool instead of int as a btrfs_scan_device() argument. cmds/device.c| 8 ++-- cmds/filesystem.c| 2 +- common/devic

Re: [PATCH v2] btrfs: removed unused return variable

2019-10-01 Thread Aliasgar Surti
On Mon, Sep 30, 2019 at 03:33:35PM +0200, David Sterba wrote: > On Mon, Sep 30, 2019 at 06:30:21PM +0530, Aliasgar Surti wrote: > > From: Aliasgar Surti > > > > Removed unused return variable and replaced it with returning > > the value directly > > This change has been sent several times and I