Re: Have 15GB missing in btrfs filesystem.

2018-10-23 Thread Qu Wenruo
On 2018/10/24 上午8:36, Marc MERLIN wrote: > Normally when btrfs fi show will show lost space because > your trees aren't balanced. Not always the case. Btrfs uses two level allocation: 1) Chunk 2 types, data, metadata, and system. And that's "used" space of "btrfs fi show", or "Device

Re: Have 15GB missing in btrfs filesystem.

2018-10-23 Thread Andrei Borzenkov
24.10.2018 3:36, Marc MERLIN пишет: > Normally when btrfs fi show will show lost space because > your trees aren't balanced. > Balance usually reclaims that space, or most of it. > In this case, not so much. > > kernel 4.17.6: > > saruman:/mnt/btrfs_pool1# btrfs fi show . > Label: 'btrfs_pool1'

[PATCH] fstests: btrfs use forget if not reload

2018-10-23 Thread Anand Jain
btrfs reload was introduced to cleanup the device list inside the btrfs kernel module. The problem with the reload approach is that you can't run btrfs test cases 124,125, 154 and 164 on the system with btrfs as root fs. Now as we are introducing the btrfs forget feature as an btrfs device scan

[PATCH] btrfs: introduce feature to forget a btrfs device

2018-10-23 Thread Anand Jain
Support for a new command 'btrfs dev forget [dev]' is proposed here to undo the effects of 'btrfs dev scan [dev]'. For this purpose this patch proposes to use ioctl #5 as it was empty. IOW(BTRFS_IOCTL_MAGIC, 5, ..) This patch adds new ioctl BTRFS_IOC_FORGET_DEV which can be sent from the

[PATCH v10] Add cli and ioctl to forget scanned device(s)

2018-10-23 Thread Anand Jain
v10: Make btrfs-progs changes more readable. With an effort to keep the known bug [1] as it is.. [1] The cli 'btrfs device scan --all /dev/sdb' which should have scanned only one device, ends up scanning all the devices and I am not trying to fix this bug in this patch because.. .

[PATCH] btrfs-progs: add cli to forget one or all scanned devices

2018-10-23 Thread Anand Jain
This patch adds cli btrfs device forget [dev] to remove the given device structure in the kernel if the device is unmounted. If no argument is given it shall remove all stale (device which are not mounted) from the kernel. Signed-off-by: Anand Jain --- cmds-device.c | 59

Re: [PATCH] btrfs: introduce feature to forget a btrfs device

2018-10-23 Thread Anand Jain
On 10/12/2018 04:48 PM, Nikolay Borisov wrote: On 12.10.2018 07:06, Anand Jain wrote: Support for a new command 'btrfs dev forget [dev]' is proposed here to undo the effects of 'btrfs dev scan [dev]'. For this purpose this patch proposes to use ioctl #5 as it was empty.

Re: [PATCH] btrfs-progs: add cli to forget one or all scanned devices

2018-10-23 Thread Anand Jain
On 10/12/2018 05:03 PM, Nikolay Borisov wrote: On 12.10.2018 07:06, Anand Jain wrote: This patch adds cli btrfs device forget [dev] to remove the given device structure in the kernel if the device is unmounted. If no argument is given it shall remove all stale (device which are not

Re: [PATCH v3] Btrfs: fix deadlock on tree root leaf when finding free extent

2018-10-23 Thread Josef Bacik
On Mon, Oct 22, 2018 at 11:05:08PM +0100, Filipe Manana wrote: > On Mon, Oct 22, 2018 at 8:18 PM Josef Bacik wrote: > > > > On Mon, Oct 22, 2018 at 08:10:37PM +0100, fdman...@kernel.org wrote: > > > From: Filipe Manana > > > > > > When we are writing out a free space cache, during the

Have 15GB missing in btrfs filesystem.

2018-10-23 Thread Marc MERLIN
Normally when btrfs fi show will show lost space because your trees aren't balanced. Balance usually reclaims that space, or most of it. In this case, not so much. kernel 4.17.6: saruman:/mnt/btrfs_pool1# btrfs fi show . Label: 'btrfs_pool1' uuid: fda628bc-1ca4-49c5-91c2-4260fe967a23

Re: [PATCH 01/13] btrfs-progs: lowmem: add argument path to punch_extent_hole()

2018-10-23 Thread Su Yue
On 10/23/18 6:04 PM, Qu Wenruo wrote: On 2018/10/23 下午5:41, Su Yue wrote: Since repair will do CoW, the outer path may be invalid, add an argument path to punch_extent_hole(). When punch_extent_hole() returns, path will still point to the item before calling punch_extent_hole();

Re: [PATCH 03/13] btrfs-progs: lowmem: fix false alert if extent item has been repaired

2018-10-23 Thread Su Yue
On 10/23/18 6:30 PM, Qu Wenruo wrote: On 2018/10/23 下午5:41, Su Yue wrote: Previously, @err are assigned immediately after check but before repair. repair_extent_item()'s return value also confuses the caller. If error has been repaired and returns 0, check_extent_item() will try to

Re: [PATCH 11/13] btrfs-progs: check: Delete file extent item with unaligned extent backref

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > From: Su Yanjun > > In original mode, if some file extent item has unaligned extent backref, > fixup_extent_refs can't repair it. This patch will check extent alignment > then delete file extent with unaligned extent backref. This looks a little strange

Re: [PATCH 10/13] btrfs-progs: check: fix bug in find_possible_backrefs

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > From: Su Yanjun > > It may cost more time to search all extent data of correspond files but > should not influence total speed too much cause that only corrupted > extent items are participated in. Sorry, I didn't really get the point of the modification

Re: [PATCH 09/13] btrfs-progs: Revert "btrfs-progs: Record orphan data extent ref to corresponding root."

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > From: Su Yanjun > > The reason for revert is that according to the existing situation, the > probability of problem in the extent tree is higher than in the fs Tree. > So this feature should be removed. > The same problem as previous patch. We need an

Re: [PATCH 08/13] btrfs-progs: Revert "btrfs-progs: Add repair and report function for orphan file extent."

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > From: Su Yanjun > > The reason for revert is that according to the existing situation, the > probability of problem in the extent tree is higher than in the fs tree. In fact we should find a place to address the priority when we check/repair fs trees.

Re: [PATCH 03/13] btrfs-progs: lowmem: fix false alert if extent item has been repaired

2018-10-23 Thread Qu Wenruo
On 2018/10/24 上午9:27, Su Yue wrote: > > > On 10/23/18 6:30 PM, Qu Wenruo wrote: >> >> >> On 2018/10/23 下午5:41, Su Yue wrote: >>> Previously, @err are assigned immediately after check but before >>> repair. >>> repair_extent_item()'s return value also confuses the caller. If >>> error has been

Re: [PATCH 07/13] btrfs-progs: lowmem: delete unaligned bytes extent data under repair

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > If found a extent data item has unaligned part, lowmem repair > just deletes it. Fair enough solution. Much better than the unpredictable original mode solution. > > Signed-off-by: Su Yue Reviewed-by: Qu Wenruo Thanks, Qu > --- >

Re: [PATCH 06/13] btrfs-progs: lowmem: rename delete_extent_tree_item() to delete_item()

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > The function can delete items in trees besides extent tree. > Rename and move it for further use. > > Signed-off-by: Su Yue Reviewed-by: Qu Wenruo > --- > check/mode-lowmem.c | 99 +++-- > 1 file changed, 51

Re: [PATCH 05/13] btrfs-progs: lowmem: check unaligned disk_bytenr for extent_data

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > Add support to check unaligned disk_bytenr for extent_data. > > Signed-off-by: Su Yue Reviewed-by: Qu Wenruo Thanks, Qu > --- > check/mode-lowmem.c | 9 - > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/check/mode-lowmem.c

Re: [PATCH 04/13] btrfs-progs: lowmem: fix false alert about the existence of gaps in the check_file_extent

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > From: Lu Fengqi > > The 'end' parameter of check_file_extent tracks the ending offset of the > last checked extent. This is used to detect gaps between adjacent extents. > > Currently such gaps are wrongly detected since for regular extents only > the

Re: Conversion to btrfs raid1 profile on added ext device renders some systems unable to boot into converted rootfs

2018-10-23 Thread Tony Prokott
The trouble is yet unresolved, symptoms are as they were, but I've diagnosed a step further. Maybe you can help me advance the diagnosis or better pose my question among debian experts, related to adjusting the building of initrd. On Thu, 18 Oct 2018 00:08:08 -0700 Qu Wenruo wrote

Re: [PATCH 00/10] Freespace tree repair support v2

2018-10-23 Thread David Sterba
On Mon, Oct 01, 2018 at 05:46:11PM +0300, Nikolay Borisov wrote: > Here is the v2 of the freespace tree repair support patches. Version 1 can be > found at [0]. For background on the series please refer to the initial cover > letter. This time round a number of changes have been incorporated

Re: [PATCH 05/10] btrfs-progs: Pull free space tree related code from kernel

2018-10-23 Thread David Sterba
On Thu, Oct 04, 2018 at 11:26:36AM -0700, Omar Sandoval wrote: > On Mon, Oct 01, 2018 at 05:46:16PM +0300, Nikolay Borisov wrote: > > To help implement free space tree checker in user space some kernel > > function are necessary, namely iterating/deleting/adding freespace > > items, some internal

Re: [PATCH 03/13] btrfs-progs: lowmem: fix false alert if extent item has been repaired

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > Previously, @err are assigned immediately after check but before > repair. > repair_extent_item()'s return value also confuses the caller. If > error has been repaired and returns 0, check_extent_item() will try > to continue check the nonexistent and cause

Re: [PATCH 02/13] btrfs-progs: lowmem: move nbytes check before isize check

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > For files, lowmem repair will try to check nbytes and isize, > but isize check depends nbytes. > > Once bytes has been repaired, then isize should be checked and > repaired. > So move nbytes check before isize check. Also set nbytes to > extent_size once

Re: [PATCH 01/13] btrfs-progs: lowmem: add argument path to punch_extent_hole()

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > Since repair will do CoW, the outer path may be invalid, > add an argument path to punch_extent_hole(). > When punch_extent_hole() returns, path will still point to the item > before calling punch_extent_hole(); > > Signed-off-by: Su Yue Overall it looks

Re: [PATCH 00/13] btrfs-progs: fixes of file extent in original and lowmem check

2018-10-23 Thread Qu Wenruo
On 2018/10/23 下午5:41, Su Yue wrote: > This patchset can be fetched from my repo: > https://github.com/Damenly/btrfs-progs/tree/file_extent_fixes > which is based on kdave/devel whose HEAD is: > commit 4f20c27ab33aab3efffe13cdae1b8837c821d0d7 (kdave/devel) > Author: Nikolay Borisov > Date:

[PATCH 13/13] btrfs-progs: fsck-test: enable lowmem repair for case 001

2018-10-23 Thread Su Yue
Lowmem can repair after commit 'btrfs-progs: lowmem: move nbytes check before isize check', so add the beacon file. Signed-off-by: Su Yue --- tests/fsck-tests/001-bad-file-extent-bytenr/.lowmem_repairable | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644

[PATCH 08/13] btrfs-progs: Revert "btrfs-progs: Add repair and report function for orphan file extent."

2018-10-23 Thread Su Yue
From: Su Yanjun The reason for revert is that according to the existing situation, the probability of problem in the extent tree is higher than in the fs tree. So this feature should be removed. Signed-off-by: Su Yanjun --- check/main.c | 103

[PATCH 11/13] btrfs-progs: check: Delete file extent item with unaligned extent backref

2018-10-23 Thread Su Yue
From: Su Yanjun In original mode, if some file extent item has unaligned extent backref, fixup_extent_refs can't repair it. This patch will check extent alignment then delete file extent with unaligned extent backref. Signed-off-by: Su Yanjun --- check/main.c | 278

[PATCH 10/13] btrfs-progs: check: fix bug in find_possible_backrefs

2018-10-23 Thread Su Yue
From: Su Yanjun It may cost more time to search all extent data of correspond files but should not influence total speed too much cause that only corrupted extent items are participated in. Signed-off-by: Su Yanjun --- check/main.c | 110 ++- 1

[PATCH 12/13] btrfs-progs: tests: add case for inode lose one file extent

2018-10-23 Thread Su Yue
From: Lu Fengqi The missing extent will lead to the existence of the gap between adjacent extents. The fsck should can detect the gap correctly and repair by punch a hole. Signed-off-by: Lu Fengqi --- .../.lowmem_repairable | 0

[PATCH 02/13] btrfs-progs: lowmem: move nbytes check before isize check

2018-10-23 Thread Su Yue
For files, lowmem repair will try to check nbytes and isize, but isize check depends nbytes. Once bytes has been repaired, then isize should be checked and repaired. So move nbytes check before isize check. Also set nbytes to extent_size once repaired successfully. Signed-off-by: Su Yue ---

[PATCH 06/13] btrfs-progs: lowmem: rename delete_extent_tree_item() to delete_item()

2018-10-23 Thread Su Yue
The function can delete items in trees besides extent tree. Rename and move it for further use. Signed-off-by: Su Yue --- check/mode-lowmem.c | 99 +++-- 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/check/mode-lowmem.c

[PATCH 09/13] btrfs-progs: Revert "btrfs-progs: Record orphan data extent ref to corresponding root."

2018-10-23 Thread Su Yue
From: Su Yanjun The reason for revert is that according to the existing situation, the probability of problem in the extent tree is higher than in the fs Tree. So this feature should be removed. Signed-off-by: Su Yanjun --- check/main.c | 120

[PATCH 04/13] btrfs-progs: lowmem: fix false alert about the existence of gaps in the check_file_extent

2018-10-23 Thread Su Yue
From: Lu Fengqi The 'end' parameter of check_file_extent tracks the ending offset of the last checked extent. This is used to detect gaps between adjacent extents. Currently such gaps are wrongly detected since for regular extents only the size of the extent is added to the 'end' parameter.

[PATCH 01/13] btrfs-progs: lowmem: add argument path to punch_extent_hole()

2018-10-23 Thread Su Yue
Since repair will do CoW, the outer path may be invalid, add an argument path to punch_extent_hole(). When punch_extent_hole() returns, path will still point to the item before calling punch_extent_hole(); Signed-off-by: Su Yue --- check/mode-lowmem.c | 21 - 1 file changed,

[PATCH 05/13] btrfs-progs: lowmem: check unaligned disk_bytenr for extent_data

2018-10-23 Thread Su Yue
Add support to check unaligned disk_bytenr for extent_data. Signed-off-by: Su Yue --- check/mode-lowmem.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 35fe1adf58e6..e8a2e825c0f3 100644 --- a/check/mode-lowmem.c +++

[PATCH 03/13] btrfs-progs: lowmem: fix false alert if extent item has been repaired

2018-10-23 Thread Su Yue
Previously, @err are assigned immediately after check but before repair. repair_extent_item()'s return value also confuses the caller. If error has been repaired and returns 0, check_extent_item() will try to continue check the nonexistent and cause flase alerts. Here make repair_extent_item()'s

[PATCH 00/13] btrfs-progs: fixes of file extent in original and lowmem check

2018-10-23 Thread Su Yue
This patchset can be fetched from my repo: https://github.com/Damenly/btrfs-progs/tree/file_extent_fixes which is based on kdave/devel whose HEAD is: commit 4f20c27ab33aab3efffe13cdae1b8837c821d0d7 (kdave/devel) Author: Nikolay Borisov Date: Fri Jun 15 07:13:50 2018 + btrfs-progs:

[PATCH 07/13] btrfs-progs: lowmem: delete unaligned bytes extent data under repair

2018-10-23 Thread Su Yue
If found a extent data item has unaligned part, lowmem repair just deletes it. Signed-off-by: Su Yue --- check/mode-lowmem.c | 8 1 file changed, 8 insertions(+) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 3c9ecff7e498..5381096fa8b2 100644 --- a/check/mode-lowmem.c

Filesystem corruption?

2018-10-23 Thread Juergen Sauer
Am 22.10.18 um 22:02 schrieb Gervais, Francois: > Hi, > > I think I lost power on my btrfs disk and it looks like it is now in an > unfunctional state. > > Any idea how I could debug that issue? > > Here is what I have: > > kernel 4.4.0-119-generic > btrfs-progs v4.4 > > > > sudo btrfs