[PATCH 3/4] btrfs: Drop fs_info parameter from btrfs_finish_extent_commit

2018-03-15 Thread Nikolay Borisov
It's provided by the trans handle. Signed-off-by: Nikolay Borisov --- fs/btrfs/ctree.h | 3 +-- fs/btrfs/extent-tree.c | 4 ++-- fs/btrfs/transaction.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index b037541

[PATCH 4/4] btrfs: Drop fs_info parameter from __btrfs_run_delayed_refs

2018-03-15 Thread Nikolay Borisov
It's provided by trans handle Signed-off-by: Nikolay Borisov --- fs/btrfs/extent-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 71d59ec02f08..89d640cb313e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/

[PATCH v2] btrfs: drop fs_info parameter from btrfs_run_delayed_refs

2018-03-15 Thread Nikolay Borisov
It's provided by the trans handle Signed-off-by: Nikolay Borisov --- V2: Fixed some build failures. fs/btrfs/ctree.h | 2 +- fs/btrfs/extent-tree.c | 9 + fs/btrfs/inode.c | 4 +--- fs/btrfs/transaction.c | 23 +++ 4 files changed, 18 inser

Re: [PATCH v4 2/2] Remove false-positive VLAs when using max()

2018-03-16 Thread Nikolay Borisov
ing, so this refactors these uses of max() to use the > new const_max() instead. > > [1] https://lkml.org/lkml/2018/3/7/621 For the btrfs portion : Reviewed-by: Nikolay Borisov > > Signed-off-by: Kees Cook > --- > drivers/input/touchscreen/cyttsp4_core.c | 2 +- > fs/btrfs/

Re: [PATCH 1/1] btrfs-progs: Fix typos in docs and user-facing strings

2018-03-16 Thread Nikolay Borisov
On 16.03.2018 02:39, Nicholas D Steeves wrote: > Signed-off-by: Nicholas D Steeves All look fine except one nit, see below. > --- > Documentation/btrfs-balance.asciidoc | 2 +- > Documentation/btrfs-check.asciidoc | 2 +- > Documentation/btrfs-man5.asciidoc| 8 > cmds-subvolum

Re: [PATCH] btrfs: Document parameters of btrfs_reserve_extent

2018-03-16 Thread Nikolay Borisov
On 16.03.2018 20:43, Liu Bo wrote: > On Tue, Mar 13, 2018 at 3:22 AM, Nikolay Borisov wrote: >> This function is the entry to the extent allocator and as such has >> quite a number of parameters. Some of those have subtle effects on the >> allocation algorithm. Do

Re: [PATCH] btrfs: fix lockdep splat in btrfs_alloc_subvolume_writers

2018-03-16 Thread Nikolay Borisov
On 16.03.2018 20:36, je...@suse.com wrote: > From: Jeff Mahoney > > While running btrfs/011, I hit the following lockdep splat. > > This is the important bit: >pcpu_alloc+0x1ac/0x5e0 >__percpu_counter_init+0x4e/0xb0 >btrfs_init_fs_root+0x99/0x1c0 [btrfs] >btrfs_get_fs_root.part

Re: High CPU usage of RT threads...

2018-03-19 Thread Nikolay Borisov
there is anything else you can think of, based > on the above data. > > Regards, > Shyam > > > On Thu, Mar 15, 2018 at 12:59 PM, Nikolay Borisov wrote: >> >> >> On 15.03.2018 09:23, Shyam Prasad N wrote: >>> Hi, >>> >>> Our servers run so

Re: Kernel warning - not sure if this is important

2018-03-19 Thread Nikolay Borisov
On 19.03.2018 10:21, Peter Chant wrote: > I got this kernel warning overnight. Possibly during or after a dedup > using duperemove. I'm not sure if that is relevent. Seems to relate to > fs/btrfs/backref.c line 1266. > > Don't know if it is important. Thought I'd post it just in case. > > I

Re: [PATCH] btrfs-progs: print-tree: Do correct offset output for ROOT_ITEM

2018-03-19 Thread Nikolay Borisov
offset. > > For tree reloc tree, it's indeed subvolume id. > But for other trees, it's the transid of when it's created. > > Fix it. > > Reported-by: Nikolay Borisov > Signed-off-by: Qu Wenruo > --- > print-tree.c | 11 ++- > 1 file cha

Re: [PATCH] btrfs-progs: print-tree: Do correct offset output for ROOT_ITEM

2018-03-19 Thread Nikolay Borisov
On 19.03.2018 12:50, Qu Wenruo wrote: > What about this value? > 18446744073709551607 > > It's data reloc tree objectid. > And it's pretty long since it's -9ULL. > > At least this makes 2 objectid more readable. Fair enough. -- To unsubscribe from this list: send the line "unsubscribe linux-bt

Re: [PATCH] btrfs-progs: print-tree: Do correct offset output for ROOT_ITEM

2018-03-19 Thread Nikolay Borisov
On 19.03.2018 12:54, Nikolay Borisov wrote: > > > On 19.03.2018 12:50, Qu Wenruo wrote: >> What about this value? >> 18446744073709551607 >> >> It's data reloc tree objectid. >> And it's pretty long since it's -9ULL. >> >&

Re: High CPU usage of RT threads...

2018-03-19 Thread Nikolay Borisov
On 19.03.2018 13:48, Shyam Prasad N wrote: > On Mon, Mar 19, 2018 at 4:37 PM, Nikolay Borisov wrote: >> >> >> On 19.03.2018 13:02, Shyam Prasad N wrote: >>> Hi, >>> >>> Attaching the sysrq-trigger output. >> >> Has this been obtained w

Re: [PATCH] btrfs-progs: print-tree: Do correct offset output for ROOT_ITEM

2018-03-19 Thread Nikolay Borisov
offset. > > For tree reloc tree, it's indeed subvolume id. > But for other trees, it's the transid of when it's created. > > Fix it. > > Reported-by: Nikolay Borisov > Signed-off-by: Qu Wenruo > --- > print-tree.c | 11 ++- > 1 file cha

[PATCH] btrfs-progs: Beautify owner when printing leaf/nodes

2018-03-20 Thread Nikolay Borisov
owner DATA_RELOC_TREE Signed-off-by: Nikolay Borisov --- print-tree.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/print-tree.c b/print-tree.c index d59f9002f54c..a2f6bfc027c9 100644 --- a/print-tree.c +++ b/print-tree.c @@ -1188,11 +1188,12 @@ void

Re: [PATCH 1/3] btrfs: cleanup btrfs_check_super_csum() to check the csum_type to the type

2018-03-20 Thread Nikolay Borisov
On 20.03.2018 11:53, Anand Jain wrote: > %csum_type is being checked to check the number of csum types we support, > which is 1 as of now. Instead just check if the type matches with the > only type we support, that is BTRFS_CSUM_TYPE_CRC32. And further adds > cleanup. > > Signed-off-by: Anand J

Re: [PATCH 1/3] btrfs: cleanup btrfs_check_super_csum() to check the csum_type to the type

2018-03-20 Thread Nikolay Borisov
On 20.03.2018 12:11, Nikolay Borisov wrote: > > > On 20.03.2018 11:53, Anand Jain wrote: >> %csum_type is being checked to check the number of csum types we support, >> which is 1 as of now. Instead just check if the type matches with the >> only type we support, th

Re: [PATCH 2/3] btrfs: return required error from btrfs_check_super_csum

2018-03-20 Thread Nikolay Borisov
On 20.03.2018 11:53, Anand Jain wrote: > Return the required -EINVAL from the function btrfs_check_super_csum() > and move the error logging into the btrfs_check_super_csum() itself. > > Signed-off-by: Anand Jain > --- > fs/btrfs/disk-io.c | 13 +++-- > 1 file changed, 7 insertions(+),

Re: [PATCH 3/3] btrfs: refactor btrfs_check_super_csum() for scan

2018-03-20 Thread Nikolay Borisov
On 20.03.2018 11:53, Anand Jain wrote: > In preparation to use the function btrfs_check_super_csum() for > the device scan context, make it nonstatic and pass the > struct block_device instead of the struct fs_info. > > Signed-off-by: Anand Jain > --- > fs/btrfs/disk-io.c | 12 ++-- >

Re: [PATCH v2 1/2] btrfs: cleanup btrfs_check_super_csum() to check the csum_type to the type

2018-03-20 Thread Nikolay Borisov
gned-off-by: Anand Jain Reviewed-by: Nikolay Borisov > --- > fs/btrfs/disk-io.c | 41 +++-- > 1 file changed, 19 insertions(+), 22 deletions(-) > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index 1657d6aa4fa6..582ed6af3c50 10064

Re: [PATCH v2 2/2] btrfs: return required error from btrfs_check_super_csum

2018-03-20 Thread Nikolay Borisov
On 21.03.2018 01:33, Anand Jain wrote: > Return the required -EINVAL and -EUCLEAN from the function > btrfs_check_super_csum(). And more the error log into the > parent function. > > Signed-off-by: Anand Jain > --- > fs/btrfs/disk-io.c | 28 +--- > 1 file changed, 17 in

Re: [PATCH 1/2] btrfs: remove dead create_space_info calls

2018-03-20 Thread Nikolay Borisov
time. I'm glad you were able to prove it's not really done at any other time. Reviewed-by: Nikolay Borisov > --- > fs/btrfs/ctree.h | 6 +++--- > fs/btrfs/extent-tree.c | 16 ++-- > 2 files changed, 5 insertions(+), 17 deletions(-) > > diff --git a/fs/bt

Re: [PATCH 2/2] btrfs: defer adding raid type kobject until after chunk relocation

2018-03-20 Thread Nikolay Borisov
On 20.03.2018 21:25, je...@suse.com wrote: > From: Jeff Mahoney > > Any time the first block group of a new type is created, we add a new > kobject to sysfs to hold the attributes for that type. Kobject-internal > allocations always use GFP_KERNEL, making them prone to fs-reclaim races. > Whil

[PATCH] btrfs: Remove obsolete function declaration

2018-03-21 Thread Nikolay Borisov
This function was removed in 24bc2843edd5 ("btrfs: Refactor __get_raid_index() to btrfs_bg_flags_to_raid_index()") what remains is a defunct declaration. Remove it. Signed-off-by: Nikolay Borisov --- David, This is a fixlet to the aforementioned patch which is only in your misc-

Re: [PATCH] btrfs: Remove obsolete function declaration

2018-03-21 Thread Nikolay Borisov
On 21.03.2018 09:16, Qu Wenruo wrote: > > > On 2018年03月21日 15:03, Nikolay Borisov wrote: >> This function was removed in 24bc2843edd5 ("btrfs: >> Refactor __get_raid_index() to btrfs_bg_flags_to_raid_index()") what >> remains is a defunct declaration. Remo

Re: [PATCH] btrfs: Allow non-privileged user to delete empty subvolume by default

2018-03-21 Thread Nikolay Borisov
On 20.03.2018 22:06, Goffredo Baroncelli wrote: > On 03/20/2018 07:45 AM, Misono, Tomohiro wrote: >> Deletion of subvolume by non-privileged user is completely restricted >> by default because we can delete a subvolume even if it is not empty >> and may cause data loss. In other words, when user_

[PATCH 3/8] btrfs: Use init_delayed_ref_common in add_delayed_data_ref

2018-03-21 Thread Nikolay Borisov
Use the newly introduced helper and remove the duplicate code. No functional changes Signed-off-by: Nikolay Borisov --- fs/btrfs/delayed-ref.c | 34 ++ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c

[PATCH 0/8] Delayed refs cleanups/streamlining

2018-03-21 Thread Nikolay Borisov
as somewhat reduced critical section under delayed_refs->lock spinlock. Nikolay Borisov (8): btrfs: Factor out common delayed refs init code btrfs: Use init_delayed_ref_common in add_delayed_tree_ref btrfs: Use init_delayed_ref_common in add_delayed_data_ref btrfs: Open-c

[PATCH 2/8] btrfs: Use init_delayed_ref_common in add_delayed_tree_ref

2018-03-21 Thread Nikolay Borisov
Use the newly introduced common helper. No functional changes Signed-off-by: Nikolay Borisov --- fs/btrfs/delayed-ref.c | 35 +++ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index d41d979f277b

[PATCH 4/8] btrfs: Open-code add_delayed_tree_ref

2018-03-21 Thread Nikolay Borisov
point of view - the code is unchanged. Signed-off-by: Nikolay Borisov --- fs/btrfs/delayed-ref.c | 66 -- 1 file changed, 21 insertions(+), 45 deletions(-) diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 7ec2282d2fe0..54bed13

[PATCH 7/8] btrfs: Use init_delayed_ref_head in add_delayed_ref_head

2018-03-21 Thread Nikolay Borisov
Use the newly introduced function when initialising the head_ref in add_delayed_ref_head. No functional changes. Signed-off-by: Nikolay Borisov --- fs/btrfs/delayed-ref.c | 62 -- 1 file changed, 4 insertions(+), 58 deletions(-) diff --git a/fs

[PATCH 8/8] btrfs: split delayed ref head initialization and addition

2018-03-21 Thread Nikolay Borisov
ally it's equivalent to the old WARN_ON and allows to remove the two args from add_delayed_ref_head. Signed-off-by: Nikolay Borisov --- fs/btrfs/delayed-ref.c | 38 +- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/fs/btrfs/delayed-ref.

[PATCH 1/8] btrfs: Factor out common delayed refs init code

2018-03-21 Thread Nikolay Borisov
THe majority of the init code for struct btrfs_delayed_ref_node is duplicated in add_delayed_data_ref and add_delayed_tree_ref. Factor out the common bits in init_delayed_ref_common. This function is going to be used in future patches to clean that up. No functional changes Signed-off-by: Nikolay

[PATCH 6/8] btrfs: Introduce init_delayed_ref_head

2018-03-21 Thread Nikolay Borisov
. Begin untangling it by first extracting the initialization only code in its own function. It's more or less verbatim copy of the first part of add_delayed_ref_head. Signed-off-by: Nikolay Borisov --- fs/btrfs/delayed-ref.c | 68 ++ 1 file change

[PATCH 5/8] btrfs: Open-code add_delayed_data_ref

2018-03-21 Thread Nikolay Borisov
ation. 2. The only piece of code that remains in the critical section is insert_delayed_ref call. 3. Tracing and memory freeing code is moved outside of the critical section. No functional changes, just an overall shorter critical section. Signed-off-by: Nikolay Borisov --- fs/btrfs/delayed-

Re: [PATCH] btrfs-progs: wipe all copies of the stale superblock

2018-03-21 Thread Nikolay Borisov
On 21.03.2018 12:19, Anand Jain wrote: > Recovering from the other copies of the superblock is fundamental > to BTRFS, which provides resilient against single LBA failure in nit: s/resilient/resilience. > the DUP group profile. Furthermore, the number of superblock copies doesn't really depend o

Re: [PATCH 1/2] btrfs-progs: print-tree: Use macro to replace immediate number for readable flags string buffer length

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 09:37, Qu Wenruo wrote: > In print-tree, we have a lot of parsers to convert numeric flags to > human readable string. > > For the buffer size we're using immediate numbers for all their callers. > Change this to macro so it will be much easier for us to expand the > buffer size. >

Re: [PATCH 2/2] btrfs-progs: print-tree: Add output for node flags and backref version

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 09:37, Qu Wenruo wrote: > Just like what we did for leaf, also add this output to make it easier > to distinguish tree reloc tree blocks. > > Signed-off-by: Qu Wenruo Reviewed-by: Nikolay Borisov > --- > print-tree.c | 8 > 1 file changed, 8 in

Re: [PATCH 1/2] btrfs-progs: print-tree: Use macro to replace immediate number for readable flags string buffer length

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 10:32, Qu Wenruo wrote: > > > On 2018年03月22日 16:20, Nikolay Borisov wrote: >> >> >> On 22.03.2018 09:37, Qu Wenruo wrote: >>> In print-tree, we have a lot of parsers to convert numeric flags to >>> human readable string. >>>

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Nikolay Borisov
On 19.03.2018 11:18, Qu Wenruo wrote: > We have several reports about node pointer points to incorrect child > tree blocks, which could have even wrong owner and level but still with > valid generation and checksum. > > Although btrfs check could handle it and print error message like: > leaf pa

Re: [PATCH] btrfs-progs: wipe all copies of the stale superblock

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 14:14, Anand Jain wrote: > > >  Ok. Will update the change log. > >> A better place for this code is really inside btrfs_wipe_existing_sb. >> Furthermore looking at libblkid it supports a way to wipe multiple >> superblocks by way of: blkid_do_wipe. I.e >> https://mirrors.edge.ke

Re: [PATCH v2] btrfs: check if the fsid in the primary sb and copy sb are same

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 15:01, Anand Jain wrote: > During the btrfs dev scan make sure that other copies of superblock > contain the same fsid as the primary SB. So that we bring to the > users notice if the superblock has been overwritten. > > mkfs.btrfs -fq /dev/sdc > mkfs.btrfs -fq /dev/sdb > dd if=

Re: [PATCH v2] btrfs-progs: wipe stale sb copy beyond -b size

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 15:01, Anand Jain wrote: > During the mkfs.btrfs -b btrfs_prepare_device() zeros all > the superblock bytenr locations only if the bytenr is below the > blockcount. The problem with this is that if the BTRFS is recreated > with a smaller size then we will leave the stale superblock

[PATCH 1/3] btrfs-progs: Remove deprecated btrfs-zero-log standalone tool

2018-03-22 Thread Nikolay Borisov
Its function has been subsumed by "btrfs rescue zero-log". Remove its source file and adjust make/tests soruces accordingly. --- Makefile | 4 +- btrfs-zero-log.c | 78 --- tests/misc-tests.sh | 1

[PATCH 2/3] btrfs-progs: Remove deprecated btrfs-show-super

2018-03-22 Thread Nikolay Borisov
Its function has been superseded by btrfs inspect-internal show-super. Furthermore the tools is currently not built by default. Just remove it. --- Makefile | 2 +- btrfs-show-super.c | 39 --- 2 files changed, 1 insertion(+), 40 deletions(-) delete

[PATCH 3/3] btrfs-progs: Remove deprecated btrfs-calc-size tool

2018-03-22 Thread Nikolay Borisov
Its function has been superseded by btrfs inspect-internal tree-stats. Just remove it. --- Makefile | 2 +- btrfs-calc-size.c | 39 --- 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 btrfs-calc-size.c diff --git a/Makefile b/Make

Re: [PATCH 1/3] btrfs-progs: Remove deprecated btrfs-zero-log standalone tool

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 15:31, David Sterba wrote: > On Thu, Mar 22, 2018 at 09:29:46PM +0800, Qu Wenruo wrote: >> >> >> On 2018年03月22日 21:18, Nikolay Borisov wrote: >>> Its function has been subsumed by "btrfs rescue zero-log". Remove its >>> sour

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 16:17, Qu Wenruo wrote: > > > On 2018年03月22日 22:00, David Sterba wrote: >> On Thu, Mar 22, 2018 at 09:53:46PM +0800, Qu Wenruo wrote: > diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c > index 26484648d090..3866b8ab20f1 100644 > --- a/fs/btrfs/backref.c > +++ b

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 16:26, Qu Wenruo wrote: > > > On 2018年03月22日 22:20, Nikolay Borisov wrote: >> >> >> On 22.03.2018 16:17, Qu Wenruo wrote: >>> >>> >>> On 2018年03月22日 22:00, David Sterba wrote: >>>> On Thu, Mar 22, 2018 at 09:53:46

Re: [PATCH] btrfs: Allow rmdir(2) to delete a subvolume

2018-03-23 Thread Nikolay Borisov
On 23.03.2018 10:28, Misono Tomohiro wrote: > This patch changes the behavior of rmdir(2) to allow it to delete > an empty subvolume. > > In order to do that the core logic of subvolume deletion is moved from > ioctl.c to inode.c and named as btrfs_delete_subvolume(), which is > also called in t

Re: [PATCH v2] btrfs: Validate child tree block's level and first key

2018-03-23 Thread Nikolay Borisov
On 23.03.2018 03:31, Qu Wenruo wrote: > We have several reports about node pointer points to incorrect child > tree blocks, which could have even wrong owner and level but still with > valid generation and checksum. > > Although btrfs check could handle it and print error message like: > leaf pa

[PATCH 1/2] btrfs-progs: Fix DIR_ITEM checking in lowmem

2018-03-23 Thread Nikolay Borisov
NIP- Fix this by moving the code setting index at the beginning of the while loop. This ensure that for each item in DIR_ITEM we have index set correctly. Fixes: 564901eac7a4 ("btrfs-progs: check: introduce print_dir_item_err()") Signed-off-by: Nikolay Borisov --

[PATCH 2/2] btrfs-progs: Add test for collision DIR_ITEM handling

2018-03-23 Thread Nikolay Borisov
Verify that if we have an otherwise clean filesystem, containging collided DIR_ITEM, btrfs check lowmem's mode can correctly handle those and not produce any false positives. This if fixed by commit titled: "btrfs-progs: Fix DIR_ITEM checking in lowmem" Signed-off-by:

Re: [PATCH v2 1/3] btrfs: Move may_destroy_subvol() from ioctl.c to inode.c

2018-03-26 Thread Nikolay Borisov
On 26.03.2018 11:28, Misono Tomohiro wrote: > This is a preparation work to allow rmdir(2) to delete a subvolume. > > Signed-off-by: Tomohiro Misono > --- > fs/btrfs/ctree.h | 1 + > fs/btrfs/inode.c | 54 ++ > fs/btrfs/ioctl.c | 54

Re: [PATCH 2/2] btrfs-progs: Add test for collision DIR_ITEM handling

2018-03-26 Thread Nikolay Borisov
On 25.03.2018 14:44, Qu Wenruo wrote: > > > On 2018年03月23日 22:48, Nikolay Borisov wrote: >> Verify that if we have an otherwise clean filesystem, containging collided >> DIR_ITEM, btrfs check lowmem's mode can correctly handle those and not >> produce >&g

[PATCH v2] btrfs-progs: Add test for collision DIR_ITEM handling

2018-03-26 Thread Nikolay Borisov
Verify that if we have an otherwise clean filesystem, containging collided DIR_ITEM, btrfs check lowmem's mode can correctly handle those and not produce any false positives. This if fixed by commit titled: "btrfs-progs: Fix DIR_ITEM checking in lowmem" Signed-off-by:

Re: [PATCH] btrfs-progs: wipe copies of the stale superblock beyond -b size

2018-03-26 Thread Nikolay Borisov
On 26.03.2018 11:27, Anand Jain wrote: > During the mkfs.btrfs -b btrfs_prepare_device() zeros all > the superblock bytenr locations only if the bytenr is below the > blockcount. The problem with this is that if the BTRFS is recreated > with a smaller size then we will leave the stale superblock

Re: [PATCH] btrfs-progs: wipe copies of the stale superblock beyond -b size

2018-03-26 Thread Nikolay Borisov
On 27.03.2018 02:50, Anand Jain wrote: > > >> I told you this code can be made a lot simpler, simply by modifying the >> last argument passed to zero_dev_clamped. I even posted the resulting >> diff which was just 3 lines changed. >> >> I agree that it's a good idea to wipe all available superb

[PATCH 06/10] btrfs-progs: Remove ext_ref param from walk_down_tree

2018-03-27 Thread Nikolay Borisov
It's no longer used so just remove it. Signed-off-by: Nikolay Borisov --- check/mode-lowmem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 29c55e202f2b..76365a214e34 100644 --- a/check/mode-lowmem.c +++ b/check

[PATCH 05/10] btrfs-progs: Remove ext_ref param from check_fs_first_inode

2018-03-27 Thread Nikolay Borisov
It's no longer use and can be dropped. Signed-off-by: Nikolay Borisov --- check/mode-lowmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 34519f30a4aa..29c55e202f2b 100644 --- a/check/mode-lowmem.c +++ b/check

[PATCH 10/10] btrfs-progs: Make __btrfs_fs_incompat return bool

2018-03-27 Thread Nikolay Borisov
First this function does the '!!' trick to turn its value into a bool, yet the return type is int. Second, the kernel counterpart also returns bool. Signed-off-by: Nikolay Borisov --- ctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctree.h b/ctr

[PATCH 00/10] Simplify function interfaces

2018-03-27 Thread Nikolay Borisov
ch just changes signature of __btrfs_fs_incompat to better match the logic of the code and be identical to its kernel counterpart. All in all this series doesn't introduce any functional changes per-se. Nikolay Borisov (10): btrfs-progs: Drop ext_ref parameter from find_inode_ref btrfs-progs

[PATCH 01/10] btrfs-progs: Drop ext_ref parameter from find_inode_ref

2018-03-27 Thread Nikolay Borisov
This is a boolean parameter which signals whether the fs has the EXTENDED_IREF feature flag toggled or not. Since a reference to fs_info can be obtained there is no need to pollute the interface. Signed-off-by: Nikolay Borisov --- check/mode-lowmem.c | 13 ++--- 1 file changed, 6

[PATCH 07/10] btrfs-progs: Drop ext_ref param from check_fs_first_inode

2018-03-27 Thread Nikolay Borisov
It's no longer used in that function so can be dropped altogether. Signed-off-by: Nikolay Borisov --- check/mode-lowmem.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 76365a214e34..daa088c056b6 100644

[PATCH 04/10] btrfs-progs: Drop unused ext_ref parameter from process_one_leaf

2018-03-27 Thread Nikolay Borisov
It's no longer used in the function so just remove it Signed-off-by: Nikolay Borisov --- check/mode-lowmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index e26e9bdf3bb3..34519f30a4aa 100644 --- a/check/mode-lowmem.c

[PATCH 09/10] btrfs-progs: Remove ext_ref local variable from check_fs_roots_lowmem

2018-03-27 Thread Nikolay Borisov
All real consumers of that variable have inlined the checks since they are simple enough. So just remove it. Signed-off-by: Nikolay Borisov --- check/mode-lowmem.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index eb6ca6453dc5..4f463d4f726f

[PATCH 03/10] btrfs-progs: Drop ext_ref argument from check_inode_item

2018-03-27 Thread Nikolay Borisov
We can derive this argument from root->fs_info and also make it local to the sole switch case it's used. Signed-off-by: Nikolay Borisov --- check/mode-lowmem.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem

[PATCH 02/10] btrfs-progs: Drop ext_ref param from check_dir_item

2018-03-27 Thread Nikolay Borisov
This parameter is no longer used in this function, so drop it Signed-off-by: Nikolay Borisov --- check/mode-lowmem.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index a8a2f76549a2..2c7b270a3ffa 100644 --- a/check/mode

[PATCH 08/10] btrfs-progs: Drop ext_ref arument from check_fs_root

2018-03-27 Thread Nikolay Borisov
It's no longer used so just remove it. Signed-off-by: Nikolay Borisov --- check/mode-lowmem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index daa088c056b6..eb6ca6453dc5 100644 --- a/check/mode-lowmem.c +++ b/check

[PATCH v2 2/4] btrfs-progs: Remove deprecated btrfs-zero-log standalone tool

2018-03-27 Thread Nikolay Borisov
Its function has been subsumed by "btrfs rescue zero-log". Remove its source file and adjust make/tests soruces accordingly. Signed-off-by: Nikolay Borisov --- .gitignore| 1 - Documentation/Makefile.in | 1 - Documentation/btrfs.asciidoc

[PATCH v2 4/4] btrfs-progs: Remove deprecated btrfs-calc-size tool

2018-03-27 Thread Nikolay Borisov
Its function has been superseded by btrfs inspect-internal tree-stats. Just remove it. Signed-off-by: Nikolay Borisov --- .gitignore| 1 - Makefile | 2 +- btrfs-calc-size.c | 39 --- 3 files changed, 1 insertion(+), 41 deletions(-) delete

[PATCH v2 3/4] btrfs-progs: Remove deprecated btrfs-show-super

2018-03-27 Thread Nikolay Borisov
Its function has been superseded by btrfs inspect-internal show-super. Furthermore the tools is currently not built by default. Just remove it. Signed-off-by: Nikolay Borisov --- .gitignore| 1 - Documentation/Makefile.in | 1 - Documentation

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

2018-03-27 Thread Nikolay Borisov
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 the same effect. Signed-off-by: Nikolay Borisov --- V2 (analogical

Re: [PATCH v2 1/2] btrfs-progs: print-tree: Use macro to replace immediate number for readable flags string buffer length

2018-03-27 Thread Nikolay Borisov
nd the > buffer size. > > Signed-off-by: Qu Wenruo Reviewed-by: Nikolay Borisov > --- > changelog: > v2: > Move all buffer length macros to the header part. > Change comment to refer to the buffer length marco for late

Re: [PATCH 2/8] btrfs: return required error from btrfs_check_super_csum

2018-03-27 Thread Nikolay Borisov
On 26.03.2018 11:27, Anand Jain wrote: > Return the required -EINVAL and -EUCLEAN from the function > btrfs_check_super_csum(). And more the error log into the > parent function. > > Signed-off-by: Anand Jain > --- > fs/btrfs/disk-io.c | 27 --- > 1 file changed, 16 ins

Re: [PATCH 3/8] btrfs: cleanup btrfs_read_disk_super() to return std error

2018-03-27 Thread Nikolay Borisov
On 26.03.2018 11:27, Anand Jain wrote: > The only caller btrfs_scan_one_device() sets -EINVAL for error from > btrfs_read_disk_super(), so this patch returns -EINVAL from the latter > function. > > A preparatory patch to add csum check in btrfs_read_disk_super(). > > Signed-off-by: Anand Jain

Re: [PATCH 5/8] btrfs: check if the fsid in the primary sb and copy sb are same

2018-03-27 Thread Nikolay Borisov
On 26.03.2018 11:27, Anand Jain wrote: > During the btrfs dev scan make sure that other copies of superblock > contain the same fsid as the primary SB. So that we bring to the > user notice if the superblock has been overwritten. > > mkfs.btrfs -fq /dev/sdc > mkfs.btrfs -fq /dev/sdb > dd if=/

Re: [PATCH 6/8] btrfs: verify checksum when superblock is read for scan

2018-03-27 Thread Nikolay Borisov
On 26.03.2018 11:27, Anand Jain wrote: > During the scan context, we aren't verifying the superblock- > checksum when read. > This patch fixes it by adding the checksum verification function > btrfs_check_super_csum() in the function btrfs_read_disk_super(). > And makes device scan to error fail

Re: [PATCH 1/8] btrfs: cleanup btrfs_check_super_csum() for better code flow

2018-03-27 Thread Nikolay Borisov
> Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov > --- > fs/btrfs/disk-io.c | 38 +- > 1 file changed, 17 insertions(+), 21 deletions(-) > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index 1657d6aa4fa6..b9b4355795

Re: [PATCH 6/8] btrfs: verify checksum when superblock is read for scan

2018-03-27 Thread Nikolay Borisov
On 27.03.2018 14:30, Nikolay Borisov wrote: > > > On 26.03.2018 11:27, Anand Jain wrote: >> During the scan context, we aren't verifying the superblock- >> checksum when read. >> This patch fixes it by adding the checksum verification function >> bt

Re: [PATCH 4/8] btrfs: make btrfs_check_super_csum() non-static

2018-03-27 Thread Nikolay Borisov
On 26.03.2018 11:27, Anand Jain wrote: > In preparation to add the superblock csum verification for the > scan context, make btrfs_check_super_csum() non-static. > > Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov > --- > fs/btrfs/disk-io.c | 2 +- > fs/btrfs

Re: [PATCH 7/8] btrfs: verify checksum for all devices in mount context

2018-03-27 Thread Nikolay Borisov
worth it documenting them in the changelog. > > Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov > --- > fs/btrfs/disk-io.c | 35 +-- > 1 file changed, 17 insertions(+), 18 deletions(-) > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/d

Re: [PATCH v2 2/3] btrfs: Allow rmdir(2) to delete a subvolume

2018-03-27 Thread Nikolay Borisov
On 26.03.2018 11:30, Misono Tomohiro wrote: > This patch changes the behavior of rmdir(2) to allow it to delete > an empty subvolume by default, unless it is not a default subvolume > and send is not in progress. > > New function btrfs_delete_subvolume() is almost equal to the second half > of b

Re: [PATCH 5/8] btrfs: check if the fsid in the primary sb and copy sb are same

2018-03-27 Thread Nikolay Borisov
On 28.03.2018 01:06, Anand Jain wrote: > > > On 03/27/2018 04:49 PM, Nikolay Borisov wrote: >> >> >> On 26.03.2018 11:27, Anand Jain wrote: >>> During the btrfs dev scan make sure that other copies of superblock >>> contain the same fsid as the

Re: [PATCH 6/8] btrfs: verify checksum when superblock is read for scan

2018-03-27 Thread Nikolay Borisov
On 28.03.2018 02:01, Anand Jain wrote: > > Test script:   Corrupt primary superblock and check if device scan and mount   fails:   mkfs.btrfs -fq /dev/sdc   dd if=/dev/urandom of=/dev/sdc ibs=1 obs=1 count=1 seek=64K   btrfs dev scan   mount /dev/sdb /btr

Re: [PATCH v2 3/8] btrfs: cleanup btrfs_read_disk_super() to return std error

2018-03-28 Thread Nikolay Borisov
ed-off-by: Anand Jain Reviewed-by: Nikolay Borisov > --- > v1->v2: > Check btrfs_read_disk_super() to be more explicit ret < 0 > > fs/btrfs/volumes.c | 15 +++ > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/fs/btrfs/volumes.c b/fs

Re: [PATCH v2 5/8] btrfs: check if the fsid in the primary sb and copy sb are same

2018-03-28 Thread Nikolay Borisov
On 28.03.2018 02:39, Anand Jain wrote: > During the btrfs dev scan make sure that other copies of superblock > contain the same fsid as the primary SB. So that we bring to the > user notice if the superblock has been overwritten. > > mkfs.btrfs -fq /dev/sdc > mkfs.btrfs -fq /dev/sdb > dd if=/

Re: [PATCH v2 6/8] btrfs: verify superblock checksum during scan

2018-03-28 Thread Nikolay Borisov
On 28.03.2018 02:39, Anand Jain wrote: > During the scan context, we aren't verifying the superblock- > checksum when read. > This patch fixes it by adding the checksum verification function > btrfs_check_super_csum() in the function btrfs_read_disk_super(). > And makes device scan to error fail

Re: [PATCH] Btrfs: print error messages when failing to read trees

2018-03-28 Thread Nikolay Borisov
On 29.03.2018 01:11, Liu Bo wrote: > When mount fails to read trees like fs tree, checksum tree, extent > tree, etc, there is not enough information about where went wrong. > > With this, messages like > > "BTRFS warning (device sdf): failed to read root (objectid=7): -5" > > would help us a b

Re: [PATCH v2 1/3] btrfs-progs: fi usage: change warning message more appropriately

2018-03-29 Thread Nikolay Borisov
On 29.03.2018 11:22, Misono Tomohiro wrote: > "fi usage" shows the warning "RAID5/6 numbers will be incorrect" when > running without root privilege even if raid5/6 is not used. What > happens is it cannot get the per device profile usage info, so change > the message more appropriately. > > Re

Re: [PATCH v2 2/7] btrfs: return required error from btrfs_check_super_csum

2018-03-29 Thread Nikolay Borisov
t; Fix pr_err split string The change log has to go below the scissors line. I guess it can be fixed at merge time so I don't think a resubmit is warranted. There is one nit below but I don't think it's critical so : Reviewed-by: Nikolay Borisov > --- > fs/btrfs/disk-io.c

Re: [PATCH v2 4/7] btrfs: check if the fsid in the primary sb and copy sb are same

2018-03-29 Thread Nikolay Borisov
rwriting superblock during mkfs. > > Signed-off-by: Anand Jain > v1->v2: > Do an explicit read for primary superblock. Drop kzalloc(). > Fix split pr_err(). Same thing about the change log as in 2/7. Otherwise : Reviewed-by: Nikolay Borisov > --- > fs/btrfs/volumes.c

Re: [PATCH v3 5/7] btrfs: verify superblock checksum during scan

2018-03-29 Thread Nikolay Borisov
string. > Fix typo in the git commit log. > Move the csum check after bytenr and btrfs magic verified. > > btrfs: make btrfs_check_super_csum() non-static > > In preparation to add the superblock csum verification for the > scan context, make btrfs_check_super_csum() non-sta

Re: [PATCH] btrfs-progs: Remove unused parameter

2018-03-29 Thread Nikolay Borisov
On 30.03.2018 05:56, Gu Jinxiang wrote: > Parameter usagestr is not used, remove it. > > Signed-off-by: Gu Jinxiang Reviewed-by: Nikolay Borisov > --- > cmds-filesystem.c | 2 +- > help.c| 2 +- > help.h| 3 +-- > 3 files changed, 3 in

[PATCH] btrfs: Replace owner argument in add_pinned_bytes with a boolean

2018-03-30 Thread Nikolay Borisov
irectly when we know the type of extents we are working with (i.e. in btrfs_free_tree_block). In cases when the parent function can be called on both metadata/data extents perform the check in the caller. This hopefully makes the interface of add_pinned_bytes more intuitive. Signed-off-by: Nikolay B

Re: [PATCH] Btrfs: fix NULL pointer dereference in log_dir_items

2018-04-01 Thread Nikolay Borisov
On 31.03.2018 01:11, Liu Bo wrote: > 0, 1 and <0 can be returned by btrfs_next_leaf(), and when <0 is > returned, path->nodes[0] could be NULL, log_dir_items lacks such a > check for <0 and we may run into a null pointer dereference panic. > > Signed-off-by: Liu Bo R

Re: [PATCH] Btrfs: bail out on error during replay_dir_deletes

2018-04-01 Thread Nikolay Borisov
On 31.03.2018 01:11, Liu Bo wrote: > If errors were returned by btrfs_next_leaf(), replay_dir_deletes needs > to bail out, otherwise @ret would be forced to be 0 after 'break;' and > the caller won't be aware of it. > > Signed-off-by: Liu Bo Reviewed-by: Nikolay

Re: [PATCH] btrfs: rename btrfs_get_block_group_info and make it static

2018-04-02 Thread Nikolay Borisov
tl.c now. > Its parameter type btrfs_ioctl_space_info* is only for ioctl. > > So, make it static and rename it to be original name > get_block_group_info. > > No functional change. > > Signed-off-by: Su Yue Reviewed-by: Nikolay Borisov > --- > fs/btrfs/ctree.h | 2

Re: [PATCH] Btrfs: fix NULL pointer dereference in log_dir_items

2018-04-02 Thread Nikolay Borisov
On 2.04.2018 20:51, Liu Bo wrote: > On Sun, Apr 1, 2018 at 3:03 AM, Nikolay Borisov wrote: >> >> >> On 31.03.2018 01:11, Liu Bo wrote: >>> 0, 1 and <0 can be returned by btrfs_next_leaf(), and when <0 is >>> returned, path->nodes[0] could be N

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

2018-04-02 Thread Nikolay Borisov
On 3.04.2018 08:39, 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

<    4   5   6   7   8   9   10   11   12   13   >