Re: [PATCH 10/16] btrfs: remove wrong use of volume_mutex from btrfs_dev_replace_start

2018-04-09 Thread Anand Jain
On 04/04/2018 02:34 AM, David Sterba wrote: The volume mutex does not protect against anything in this case, the comment about scrub is right but not related to locking and looks confusing. The comment in btrfs_find_device_missing_or_by_path is wrong and confusing too. The device_list_mutex

Re: [PATCH] btrfs-progs: let mkfs return nozero value on thin provision device

2018-04-09 Thread David Sterba
On Mon, Apr 09, 2018 at 11:46:32PM +0800, Damenly Su wrote: > Sorry for the previous reply in HTML format which is not delivered to > the mail list. > > I mean there is already xfstests generic/405 for the situation. > Thin provision devices need to call dmsetup to setup. > I wonder If calling

Re: [PATCH 10/16] btrfs: remove wrong use of volume_mutex from btrfs_dev_replace_start

2018-04-09 Thread Anand Jain
On 04/09/2018 07:53 PM, David Sterba wrote: On Mon, Apr 09, 2018 at 04:39:03PM +0800, Anand Jain wrote: On 04/04/2018 02:34 AM, David Sterba wrote: The volume mutex does not protect against anything in this case, the comment about scrub is right but not related to locking and looks

Re: [PATCH 11/16] btrfs: kill btrfs_fs_info::volume_mutex

2018-04-09 Thread Anand Jain
On 04/04/2018 02:34 AM, David Sterba wrote: Mutual exclusion of device add/rm and balance was done by the volume mutex up to version 3.7. The commit 5ac00addc7ac091109 ("Btrfs: disallow mutually exclusive admin operations from user mode") added a bit that essentially tracked the same

Re: [PATCH v2 0/5] btrfs-progs: extent buffer related refactor and cleanup

2018-04-09 Thread David Sterba
On Fri, Mar 30, 2018 at 01:48:52PM +0800, Qu Wenruo wrote: > The patchset can be fetched from github: > https://github.com/adam900710/btrfs-progs/tree/eb_cleanup > > Just like kernel cleanup and refactors, this patchset will embed > btrfs_fs_info structure into extent_buffer. > > And fixes

Re: [PATCH] btrfs-progs: let mkfs return nozero value on thin provision device

2018-04-09 Thread Damenly Su
Sorry for the previous reply in HTML format which is not delivered to the mail list. I mean there is already xfstests generic/405 for the situation. Thin provision devices need to call dmsetup to setup. I wonder If calling dmsetup in progs tests is acceptable or not. If it is, I will do it.

[PATCH] btrfs: print-tree: output enhancement

2018-04-09 Thread Qu Wenruo
This patch enhance the following things: - tree block header * add generation and owner output for node and leaf - node pointer generation output - allow btrfs_print_tree() to not follow nodes * just like btrfs-progs Please note that, although function btrfs_print_tree() is not called by

Re: [PATCH v2] btrfs-progs: dump-super: Refactor print function and add extra check

2018-04-09 Thread Goffredo Baroncelli
Hi Qu, On 04/09/2018 11:19 AM, Qu Wenruo wrote: > When manually patching super blocks, current validation check is pretty > weak (limited to magic number and csum) and doesn't provide extra check > for some obvious corruption (like invalid sectorsize). [...] > > Signed-off-by: Qu Wenruo

Re: [PATCH] Btrfs: do not abort transaction when failing to insert hole extent

2018-04-09 Thread Liu Bo
On Fri, Apr 6, 2018 at 10:43 AM, Liu Bo wrote: > On Fri, Apr 6, 2018 at 6:21 AM, David Sterba wrote: >> On Thu, Apr 05, 2018 at 11:58:16AM -0700, Liu Bo wrote: >>> On Thu, Apr 5, 2018 at 9:48 AM, David Sterba wrote: >>> > On Sat, Mar 31,

Re: [PATCH] btrfs-progs: Use more loose open ctree flags for dump-tree and restore

2018-04-09 Thread Qu Wenruo
On 2018年04月09日 23:05, David Sterba wrote: > On Mon, Apr 09, 2018 at 10:29:34PM +0800, Qu Wenruo wrote: --- a/cmds-inspect-dump-tree.c +++ b/cmds-inspect-dump-tree.c @@ -303,7 +303,9 @@ int cmd_inspect_dump_tree(int argc, char **argv) int uuid_tree_only = 0; int

Re: [PATCH v2] btrfs-progs: dump-super: Refactor print function and add extra check

2018-04-09 Thread Qu Wenruo
On 2018年04月10日 05:50, Goffredo Baroncelli wrote: > Hi Qu, > > On 04/09/2018 11:19 AM, Qu Wenruo wrote: >> When manually patching super blocks, current validation check is pretty >> weak (limited to magic number and csum) and doesn't provide extra check >> for some obvious corruption (like

[PATCH] btrfs-progs: remove meaningless field write of scrub status file

2018-04-09 Thread Gu Jinxiang
Since ret must be 0 when goes to scrub status file's write, so scrub_write_buf(fd, buf, ret) writes nothing. And when I check the process for read scrub status file, there is no process for this field. So, remove it. Signed-off-by: Gu Jinxiang --- cmds-scrub.c | 1 - 1 file

Re: [PATCH] btrfs-progs: Use more loose open ctree flags for dump-tree and restore

2018-04-09 Thread David Sterba
On Mon, Apr 09, 2018 at 10:29:34PM +0800, Qu Wenruo wrote: > >> --- a/cmds-inspect-dump-tree.c > >> +++ b/cmds-inspect-dump-tree.c > >> @@ -303,7 +303,9 @@ int cmd_inspect_dump_tree(int argc, char **argv) > >>int uuid_tree_only = 0; > >>int roots_only = 0; > >>int root_backups = 0; >

Re: [PATCH 16/16] btrfs: open code set_balance_control

2018-04-09 Thread Anand Jain
On 04/04/2018 02:34 AM, David Sterba wrote: The helper is quite simple and I'd like to see the locking in the caller. Signed-off-by: David Sterba For the version at: git://github.com/kdave/btrfs-devel dev/remove-volume-mutex Reviewed-by: Anand Jain

Re: [PATCH] btrfs-progs: Remove duplicate value-get for data_extents_scrubbed

2018-04-09 Thread David Sterba
On Mon, Apr 02, 2018 at 06:11:17PM +0800, Gu Jinxiang wrote: > Get data_extents_scrubbed value for twice, since there is only > one data_extents_scrubbed in struct btrfs_scrub_progress, remove > the duplicate one. > > Signed-off-by: Gu Jinxiang Applied, thanks. -- To

Re: [PATCH] btrfs-progs: Use more loose open ctree flags for dump-tree and restore

2018-04-09 Thread Qu Wenruo
On 2018年04月09日 22:12, David Sterba wrote: > On Fri, Apr 06, 2018 at 02:39:19PM +0800, Qu Wenruo wrote: >> Corrupted extent tree (either the root node or leaf) can normally block >> us from open the fs. >> As normally open_ctree() has the following call chain: >> __open_ctree_fd() >> |-

Re: [PATCH 2/2] btrfs-progs: tests/fsck: Add test case to check if btrfs check can skip data csum verfication for metadata dump

2018-04-09 Thread David Sterba
On Tue, Apr 03, 2018 at 01:39:47PM +0800, Qu Wenruo wrote: > Signed-off-by: Qu Wenruo > --- > .../031-metadatadump-check-data-csum/test.sh | 32 > ++ > 1 file changed, 32 insertions(+) > create mode 100755

Re: [PATCH 1/2] btrfs-progs: check: Skip data csum verification for metadata dump

2018-04-09 Thread David Sterba
On Tue, Apr 03, 2018 at 01:39:46PM +0800, Qu Wenruo wrote: > For metadata dump (fs restored by btrfs-image), since no data is > restored check sum verification will definitely report error. > > Add such check in check_csums() and prompt for user. > > Issue: #103 > Signed-off-by: Qu Wenruo

Re: [PATCH] btrfs-progs: Do not add extra slash if given path end with it

2018-04-09 Thread David Sterba
On Thu, Mar 29, 2018 at 05:11:19PM +0800, Gu Jinxiang wrote: > When use a given path end with a slash like below, > the output of path will have double slash. > > Do not add extra slash if there is already one in the given > path. > > $ btrfs filesystem du ./test/ > output: > Total Exclusive

[PATCH RFC] btrfs-progs: ctree: Don't return error if first key mismatch on leaf

2018-04-09 Thread Qu Wenruo
When running btrfs/074 with enough CPUs, it's possible (around 1%) to hit first key mismatch warning. Most of such warning happens in split_leaf() where it can ignore error from push_leaf_right(), some of such problem also happens in btrfs_search_forward(). Since it could break normal tree

[PATCH v2] btrfs-progs: dump-super: Refactor print function and add extra check

2018-04-09 Thread Qu Wenruo
When manually patching super blocks, current validation check is pretty weak (limited to magic number and csum) and doesn't provide extra check for some obvious corruption (like invalid sectorsize). This patch will enhance dump-super by: 1) Refactor print function and add checker helper macro

Re: [PATCH 10/16] btrfs: remove wrong use of volume_mutex from btrfs_dev_replace_start

2018-04-09 Thread Anand Jain
On 04/09/2018 04:54 PM, Nikolay Borisov wrote: On 9.04.2018 11:39, Anand Jain wrote: On 04/04/2018 02:34 AM, David Sterba wrote: The volume mutex does not protect against anything in this case, the comment about scrub is right but not related to locking and looks confusing. The comment

Re: [PATCH] fstests: generic test for fsync after fallocate

2018-04-09 Thread Dave Chinner
On Sun, Apr 08, 2018 at 10:07:54AM +0800, Eryu Guan wrote: > On Thu, Apr 05, 2018 at 10:56:14PM +0100, fdman...@kernel.org wrote: > > From: Filipe Manana > > > > Test that fsync operations preserve extents allocated with fallocate(2) > > that are placed beyond a file's size. >

Re: [PATCH] fstests: generic test for fsync after fallocate

2018-04-09 Thread Filipe Manana
On Mon, Apr 9, 2018 at 10:51 AM, Dave Chinner wrote: > On Sun, Apr 08, 2018 at 10:07:54AM +0800, Eryu Guan wrote: >> On Thu, Apr 05, 2018 at 10:56:14PM +0100, fdman...@kernel.org wrote: >> > From: Filipe Manana >> > >> > Test that fsync operations preserve

Re: Couldn't read tree root BTRFS - SEED

2018-04-09 Thread Senén Vidal Blanco
Hello Qu, Thank you very much for the answer. I am sorry to answer late because before bothering more, I decided to perform another cloning test. In this time he has joined the second device correctly. The problem has occurred because they are BCACHE devices, and although the SEED disk does not

[PATCH] btrfs-progs: print-tree: remove dead code from btrfs_print_tree

2018-04-09 Thread Lu Fengqi
Since the out label has been deleted, this free_extent_buffer will never be executed. Fixes: f37ae8d275c2 ("btrfs-progs: print-tree: Enhance warning on tree block level mismatch and error handling") Signed-off-by: Lu Fengqi --- print-tree.c | 2 -- 1 file changed, 2

Re: [PATCH] btrfs-progs: dump-super: Refactor print function and add extra check

2018-04-09 Thread Qu Wenruo
On 2018年04月09日 16:06, Nikolay Borisov wrote: > > > On 9.04.2018 10:47, Qu Wenruo wrote: >> When manually patching super blocks, current validation check is pretty >> weak (limited to magic number and csum) and doesn't provide extra check >> for some obvious corruption (like invalid

Re: [PATCH 09/16] btrfs: cleanup helpers that reset balance state

2018-04-09 Thread Anand Jain
On 04/04/2018 02:34 AM, David Sterba wrote: The function __cancel_balance name is confusing with the cancel operation of balance and it really resets the state of balance back to zero. The unset_balance_control helper is called only from one place and simple enough to be inlined.

[PATCH] btrfs-progs: dump-super: Refactor print function and add extra check

2018-04-09 Thread Qu Wenruo
When manually patching super blocks, current validation check is pretty weak (limited to magic number and csum) and doesn't provide extra check for some obvious corruption (like invalid sectorsize). This patch will enhance dump-super by: 1) Refactor print function and add checker helper macro

Re: [PATCH] btrfs-progs: dump-super: Refactor print function and add extra check

2018-04-09 Thread Nikolay Borisov
On 9.04.2018 10:47, Qu Wenruo wrote: > When manually patching super blocks, current validation check is pretty > weak (limited to magic number and csum) and doesn't provide extra check > for some obvious corruption (like invalid sectorsize). > > This patch will enhance dump-super by: > > 1)

Re: [PATCH 08/16] btrfs: add sanity check when resuming balance after mount

2018-04-09 Thread Anand Jain
On 04/04/2018 02:34 AM, David Sterba wrote: Replace a WARN_ON with a proper check and message in case something goes really wrong and resumed balance cannot set up its exclusive status. The check is a user friendly assertion, I don't expect to ever happen under normal circumstances. Also

Re: [PATCH 10/16] btrfs: remove wrong use of volume_mutex from btrfs_dev_replace_start

2018-04-09 Thread Anand Jain
On 04/04/2018 02:34 AM, David Sterba wrote: The volume mutex does not protect against anything in this case, the comment about scrub is right but not related to locking and looks confusing. The comment in btrfs_find_device_missing_or_by_path is wrong and confusing too. The device_list_mutex

Re: [PATCH 10/16] btrfs: remove wrong use of volume_mutex from btrfs_dev_replace_start

2018-04-09 Thread Nikolay Borisov
On 9.04.2018 11:39, Anand Jain wrote: > > > On 04/04/2018 02:34 AM, David Sterba wrote: >> The volume mutex does not protect against anything in this case, the >> comment about scrub is right but not related to locking and looks >> confusing. The comment in

Re: [PATCH 10/16] btrfs: remove wrong use of volume_mutex from btrfs_dev_replace_start

2018-04-09 Thread David Sterba
On Mon, Apr 09, 2018 at 04:39:03PM +0800, Anand Jain wrote: > > > On 04/04/2018 02:34 AM, David Sterba wrote: > > The volume mutex does not protect against anything in this case, the > > comment about scrub is right but not related to locking and looks > > confusing. The comment in

[PATCH 6/7] btrfs: tests: pass fs_info to extent_map tests

2018-04-09 Thread David Sterba
Preparatory work to pass fs_info to btrfs_add_extent_mapping so we can get a better tracepoint message. Extent maps do not need fs_info for anything so we only add a dummy one without any other initialization. Signed-off-by: David Sterba --- fs/btrfs/tests/extent-map-tests.c |

[PATCH 5/7] btrfs: tracepoints, use extended format with UUID where possible

2018-04-09 Thread David Sterba
Most of the strings are prefixed by the UUID of the filesystem that generates the message, however there are a few events that still opencode the macro magic and can be converted to the common macros. Signed-off-by: David Sterba --- include/trace/events/btrfs.h | 30

[PATCH 7/7] btrfs: use fs_info for btrfs_handle_em_exist tracepoint

2018-04-09 Thread David Sterba
We really want to know to which filesystem the extent map events belong, but as it cannot be reached from the extent_map pointers, we need to pass it down the callchain. Signed-off-by: David Sterba --- fs/btrfs/extent_map.c | 6 -- fs/btrfs/extent_map.h

[PATCH 1/7] btrfs: tracepoints, use correct type for inode number

2018-04-09 Thread David Sterba
The size of ino_t depends on 32/64bit architecture type. Btrfs stores the full 64bit inode anyway so we should use it. Signed-off-by: David Sterba --- include/trace/events/btrfs.h | 47 ++-- 1 file changed, 24 insertions(+), 23

[PATCH 4/7] btrfs: tracepoints, fix whitespace in strings

2018-04-09 Thread David Sterba
The preferred style is to avoid spaces between key and value and no commas between key=values. Signed-off-by: David Sterba --- include/trace/events/btrfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/trace/events/btrfs.h

Re: [PATCH] fstests: generic test for fsync after fallocate

2018-04-09 Thread Dave Chinner
On Mon, Apr 09, 2018 at 11:00:52AM +0100, Filipe Manana wrote: > On Mon, Apr 9, 2018 at 10:51 AM, Dave Chinner wrote: > > On Sun, Apr 08, 2018 at 10:07:54AM +0800, Eryu Guan wrote: > >> On Thu, Apr 05, 2018 at 10:56:14PM +0100, fdman...@kernel.org wrote: > > You also cannot

Re: [PATCH 07/16] btrfs: add proper safety check before resuming dev-replace

2018-04-09 Thread David Sterba
On Sat, Apr 07, 2018 at 06:43:19PM +0800, Anand Jain wrote: > On 04/07/2018 02:42 PM, Anand Jain wrote: > > On 04/04/2018 02:34 AM, David Sterba wrote: > >> The device replace is paused by unmount or read only remount, and > >> resumed on next mount or write remount. > >> > >> The exclusive status

[PATCH 0/7] Tracepoint updates

2018-04-09 Thread David Sterba
Switch the inode number type to u64, plus other cleanups and fixups. David Sterba (7): btrfs: tracepoints, use correct type for inode number btrfs: tracepoints, use %llu instead of %Lu btrfs: tracepoints, drop unnecessary ULL casts btrfs: tracepoints, fix whitespace in strings btrfs:

[PATCH 2/7] btrfs: tracepoints, use %llu instead of %Lu

2018-04-09 Thread David Sterba
For consistency, use the %llu form. Signed-off-by: David Sterba --- include/trace/events/btrfs.h | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index dafd58ad86ec..200c45911919

[PATCH 3/7] btrfs: tracepoints, drop unnecessary ULL casts

2018-04-09 Thread David Sterba
The (unsigned long long) casts are not necessary since long ago. Signed-off-by: David Sterba --- include/trace/events/btrfs.h | 124 +-- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/include/trace/events/btrfs.h

Re: [PATCH v2 1/4] btrfs-progs: Remove btrfs-debug-tree command

2018-04-09 Thread David Sterba
On Tue, Mar 27, 2018 at 10:45:43AM +0300, Nikolay Borisov wrote: > There is already a replacement in the face of btrfs inspect-internal > dump-tree. And this command is just a simple wrapper around it. Just > remove it and adjust the show-blocks script to call the main btrfs > binary to achieve

Re: [PATCH] btrfs-progs: Use more loose open ctree flags for dump-tree and restore

2018-04-09 Thread David Sterba
On Fri, Apr 06, 2018 at 02:39:19PM +0800, Qu Wenruo wrote: > Corrupted extent tree (either the root node or leaf) can normally block > us from open the fs. > As normally open_ctree() has the following call chain: > __open_ctree_fd() > |- btrfs_setup_all_roots() >|- btrfs_read_block_groups() >

Re: [PATCH] btrfs-progs: Let function find_device to be consistent with kernel

2018-04-09 Thread David Sterba
On Mon, Apr 02, 2018 at 11:30:12AM +0800, Gu Jinxiang wrote: > Make find_device to be consistent with kernel according > 35c70103a528 ("btrfs: refactor find_device helper") > > And, modify the compare condition from both devid and uuid to > devid or devid and uuid according > 8f18cf13396c

[PATCH v2] fstests: generic test for fsync after fallocate

2018-04-09 Thread fdmanana
From: Filipe Manana Test that fsync operations preserve extents allocated with fallocate(2) that are placed beyond a file's size. This test is motivated by a bug found in btrfs where unwritten extents beyond the inode's i_size were not preserved after a fsync and power

Re: [PATCH] btrfs-progs: let mkfs return nozero value on thin provision device

2018-04-09 Thread David Sterba
On Tue, Apr 03, 2018 at 04:39:45PM +0800, Su Yue wrote: > when mkfs.btrfs on a thin provision device which has very small > backing size and big virtual size, all code works well in > mkfs.btrfs until close_ctree() is called. > close_ctree() fails to sync device due to small backing size > while

Re: [PATCH v2] fstests: test btrfs fsync after hole punching with no-holes mode

2018-04-09 Thread Eryu Guan
On Sun, Apr 08, 2018 at 09:46:24AM +0100, Filipe Manana wrote: > On Sun, Apr 8, 2018 at 8:46 AM, Eryu Guan wrote: > > On Wed, Mar 28, 2018 at 12:55:30PM +0100, fdman...@kernel.org wrote: > >> From: Filipe Manana > >> > >> Test that when we have the no-holes

Re: [PATCH] btrfs-progs: remove unused function path_cat and path_cat3

2018-04-09 Thread David Sterba
On Mon, Apr 09, 2018 at 01:43:30PM +0800, Gu Jinxiang wrote: > Since function path_cat and path_cat3 are not used anymore, remove them. It's good to document when the functions where deprecated, 4.0, which lets us check that the period was long enough for any users to adapt as it's in the public

Re: [PATCH] btrfs: print-tree: output enhancement

2018-04-09 Thread Lu Fengqi
On Mon, Apr 09, 2018 at 02:05:37PM +0800, Qu Wenruo wrote: >This patch enhance the following things: > >- tree block header > * add generation and owner output for node and leaf >- node pointer generation output >- allow btrfs_print_tree() to not follow nodes > * just like btrfs-progs > >Please