Re: [PATCH v3 00/12] FITRIM improvements

2019-03-26 Thread Nikolay Borisov
[CC'ing Filipe as he should now better ] On 25.03.19 г. 20:44 ч., Darrick J. Wong wrote: > On Mon, Mar 25, 2019 at 02:31:20PM +0200, Nikolay Borisov wrote: >> Here is v3 of the fitrim patches. Change since v2 [0]: >> >> * Replaced BUG_ON with WARN_ON in patch 2 >> >> * Added RB to patches 04/05

Re: WARNING at fs/btrfs/delayed-ref.c:296 btrfs_merge_delayed_refs+0x3dc/0x410 (new on 5.0.4, not in 5.0.3)

2019-03-26 Thread Nikolay Borisov
On 26.03.19 г. 6:30 ч., Zygo Blaxell wrote: > On Mon, Mar 25, 2019 at 10:50:28PM -0400, Zygo Blaxell wrote: >> Running balance, rsync, and dedupe, I get kernel warnings every few >> minutes on 5.0.4. No warnings on 5.0.3 under similar conditions. >> >> Mount options are: flushoncommit,space_ca

Re: backup uuid_tree generation not consistent across multi device (raid0) btrfs - won´t mount

2019-03-26 Thread berodual_xyz
Thank you both for your input. see below. > > You sda and sdb are at gen 60233 while sdd and sde are at gen 60234. > > It's possible to allow kernel to manually assemble its device list using > > "device=" mount option. > > Since you're using RAID6, it's possible to recover using 2 devices only,

Re: backup uuid_tree generation not consistent across multi device (raid0) btrfs - won´t mount

2019-03-26 Thread berodual_xyz
Mount messages below. Thanks for your input, Qu! ## [42763.884134] BTRFS info (device sdd): disabling free space tree [42763.884138] BTRFS info (device sdd): force clearing of disk cache [42763.884140] BTRFS info (device sdd): has skinny extents [42763.885207] BTRFS error (device sdd): parent tra

[PATCH] Btrfs: do not allow trimming when a fs is mounted with the nologreplay option

2019-03-26 Thread fdmanana
From: Filipe Manana Whan a filesystem is mounted with the nologreplay mount option, which requires it to be mounted in RO mode as well, we can not allow discard on free space inside block groups, because log trees refer to extents that are not pinned in a block group's free space cache (pinning t

Re: [PATCH v3 00/12] FITRIM improvements

2019-03-26 Thread Filipe Manana
On Tue, Mar 26, 2019 at 8:10 AM Nikolay Borisov wrote: > > [CC'ing Filipe as he should now better ] > > On 25.03.19 г. 20:44 ч., Darrick J. Wong wrote: > > On Mon, Mar 25, 2019 at 02:31:20PM +0200, Nikolay Borisov wrote: > >> Here is v3 of the fitrim patches. Change since v2 [0]: > >> > >> * Repl

Re: [PATCH v2] Btrfs: fix data bytes_may_use underflow with fallocate due to failed quota reserve

2019-03-26 Thread Filipe Manana
On Tue, Mar 26, 2019 at 3:57 AM robbieko wrote: > > From: Robbie Ko > > When doing fallocate, we first add the range to the reserve_list > and then reserve the quota. > If quota reservation fails, we'll release all reserved parts of > reserve_list. > However, cur_offset is not updated to indicate

Re: [PATCH] Btrfs: do not allow trimming when a fs is mounted with the nologreplay option

2019-03-26 Thread Nikolay Borisov
On 26.03.19 г. 12:49 ч., fdman...@kernel.org wrote: > From: Filipe Manana > > Whan a filesystem is mounted with the nologreplay mount option, which > requires it to be mounted in RO mode as well, we can not allow discard on > free space inside block groups, because log trees refer to extents t

Re: [PATCH] Btrfs: do not allow trimming when a fs is mounted with the nologreplay option

2019-03-26 Thread Filipe Manana
On Tue, Mar 26, 2019 at 12:17 PM Nikolay Borisov wrote: > > > > On 26.03.19 г. 12:49 ч., fdman...@kernel.org wrote: > > From: Filipe Manana > > > > Whan a filesystem is mounted with the nologreplay mount option, which > > requires it to be mounted in RO mode as well, we can not allow discard on >

Re: [PATCH] Btrfs: do not allow trimming when a fs is mounted with the nologreplay option

2019-03-26 Thread Nikolay Borisov
On 26.03.19 г. 14:35 ч., Filipe Manana wrote: > On Tue, Mar 26, 2019 at 12:17 PM Nikolay Borisov wrote: >> >> >> >> On 26.03.19 г. 12:49 ч., fdman...@kernel.org wrote: >>> From: Filipe Manana >>> >>> Whan a filesystem is mounted with the nologreplay mount option, which >>> requires it to be mo

Re: backup uuid_tree generation not consistent across multi device (raid0) btrfs - won´t mount

2019-03-26 Thread Qu Wenruo
On 2019/3/26 下午6:24, berodual_xyz wrote: > Mount messages below. > > Thanks for your input, Qu! > > ## > [42763.884134] BTRFS info (device sdd): disabling free space tree > [42763.884138] BTRFS info (device sdd): force clearing of disk cache > [42763.884140] BTRFS info (device sdd): has skinny

Re: [PATCH] Btrfs: do not allow trimming when a fs is mounted with the nologreplay option

2019-03-26 Thread Qu Wenruo
On 2019/3/26 下午8:17, Nikolay Borisov wrote: > > > On 26.03.19 г. 12:49 ч., fdman...@kernel.org wrote: >> From: Filipe Manana >> >> Whan a filesystem is mounted with the nologreplay mount option, which >> requires it to be mounted in RO mode as well, we can not allow discard on >> free space ins

Re: [PATCH] Btrfs: do not allow trimming when a fs is mounted with the nologreplay option

2019-03-26 Thread David Sterba
On Tue, Mar 26, 2019 at 09:40:08PM +0800, Qu Wenruo wrote: > > > On 2019/3/26 下午8:17, Nikolay Borisov wrote: > > > > > > On 26.03.19 г. 12:49 ч., fdman...@kernel.org wrote: > >> From: Filipe Manana > >> > >> Whan a filesystem is mounted with the nologreplay mount option, which > >> requires it t

Re: [PATCH v2] fstests: Verify that removed device has its superblocks deleted

2019-03-26 Thread Nikolay Borisov
On 25.03.19 г. 23:55 ч., Anand Jain wrote: > > > On 3/25/19 10:07 PM, Nikolay Borisov wrote: >> When a device is removed from a btrfs filesystem its superblock copies >> must be deleted. > > AFAIK this bug was fixed a long time back in the kernel. Is there any > newer fix in the kernel? No

Re: [PATCh v2 1/9] btrfs: Move btrfs_check_chunk_valid() to tree-check.[ch] and export it

2019-03-26 Thread David Sterba
On Tue, Mar 26, 2019 at 07:02:20AM +0800, Qu Wenruo wrote: > On 2019/3/26 上午1:06, David Sterba wrote: > > On Wed, Mar 20, 2019 at 02:37:09PM +0800, Qu Wenruo wrote: > >> By function, chunk item verification is more suitable to be done inside > >> tree-checker. > >> > >> So move btrfs_check_chunk_va

Re: [PATCH] btrfs: Enable btrfs/003

2019-03-26 Thread Nikolay Borisov
On 19.03.19 г. 12:58 ч., Nikolay Borisov wrote: > For a long time this test has been failing on all kinds of VM configuration, > which are using virtio_blk devices. This is due to the fact that scsi > devices are deletable and virtio_blk are not. However, this only prevents > device replace case

Re: [PATCh v2 2/9] btrfs: tree-checker: Make chunk item checker more readable

2019-03-26 Thread David Sterba
On Wed, Mar 20, 2019 at 11:41:44AM +0100, Johannes Thumshirn wrote: > Looks good, > Reviewed-by: Johannes Thumshirn > > Although I think it would've been worth to explicitly mention that you > increased the severity level from error to critical. Agreed, changelog updated.

Re: WARNING at fs/btrfs/delayed-ref.c:296 btrfs_merge_delayed_refs+0x3dc/0x410 (new on 5.0.4, not in 5.0.3)

2019-03-26 Thread Zygo Blaxell
On Tue, Mar 26, 2019 at 10:42:31AM +0200, Nikolay Borisov wrote: > > > On 26.03.19 г. 6:30 ч., Zygo Blaxell wrote: > > On Mon, Mar 25, 2019 at 10:50:28PM -0400, Zygo Blaxell wrote: > >> Running balance, rsync, and dedupe, I get kernel warnings every few > >> minutes on 5.0.4. No warnings on 5.0.

Re: WARNING at fs/btrfs/delayed-ref.c:296 btrfs_merge_delayed_refs+0x3dc/0x410 (new on 5.0.4, not in 5.0.3)

2019-03-26 Thread Nikolay Borisov
On 26.03.19 г. 17:09 ч., Zygo Blaxell wrote: > On Tue, Mar 26, 2019 at 10:42:31AM +0200, Nikolay Borisov wrote: >> >> >> On 26.03.19 г. 6:30 ч., Zygo Blaxell wrote: >>> On Mon, Mar 25, 2019 at 10:50:28PM -0400, Zygo Blaxell wrote: Running balance, rsync, and dedupe, I get kernel warnings ev

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-26 Thread David Sterba
On Wed, Mar 20, 2019 at 02:37:16PM +0800, Qu Wenruo wrote: > @@ -1539,6 +1539,8 @@ do { >\ > #define BTRFS_INODE_COMPRESS (1 << 11) > > #define BTRFS_INODE_ROOT_ITEM_INIT (1 << 31) > +#define BTRFS_INODE_FLAG_MASK

BUG: workqueue lockup - pool cpus=0-3 flags=0x4 nice=0 stuck for 20915s! (on 4.20+)

2019-03-26 Thread Zygo Blaxell
On Tue, Mar 26, 2019 at 12:30:07AM -0400, Zygo Blaxell wrote: > On Mon, Mar 25, 2019 at 10:50:28PM -0400, Zygo Blaxell wrote: > > Running balance, rsync, and dedupe, [...] > > > > Mount options are: flushoncommit,space_cache=v2,compress=zstd. [snip] The 5.0.4 test machine locked up overnight.

Re: WARNING at fs/btrfs/delayed-ref.c:296 btrfs_merge_delayed_refs+0x3dc/0x410 (new on 5.0.4, not in 5.0.3)

2019-03-26 Thread Zygo Blaxell
On Tue, Mar 26, 2019 at 05:13:53PM +0200, Nikolay Borisov wrote: > > > On 26.03.19 г. 17:09 ч., Zygo Blaxell wrote: > > On Tue, Mar 26, 2019 at 10:42:31AM +0200, Nikolay Borisov wrote: > >> > >> > >> On 26.03.19 г. 6:30 ч., Zygo Blaxell wrote: > >>> On Mon, Mar 25, 2019 at 10:50:28PM -0400, Zygo

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-26 Thread David Sterba
On Mon, Mar 25, 2019 at 12:27:24PM +0800, Qu Wenruo wrote: > > > On 2019/3/20 下午2:37, Qu Wenruo wrote: > > There is a report in kernel bugzilla about mismatch file type in dir > > item and inode item. > > > > This inspires us to check inode mode in inode item. > > > > This patch will check the fo

Re: backup uuid_tree generation not consistent across multi device (raid0) btrfs - won´t mount

2019-03-26 Thread Chris Murphy
On Tue, Mar 26, 2019 at 12:44 AM Andrei Borzenkov wrote: > > > He has btrfs raid0 profile on top of hardware RAID6 devices. sys_chunk_array[2048]: item 0 key (FIRST_CHUNK_TREE CHUNK_ITEM 1048576) length 4194304 owner 2 stripe_len 65536 type SYSTEM io_align

Re: backup uuid_tree generation not consistent across multi device (raid0) btrfs - won´t mount

2019-03-26 Thread Chris Murphy
On Tue, Mar 26, 2019 at 11:38 AM Chris Murphy wrote: > > On Tue, Mar 26, 2019 at 12:44 AM Andrei Borzenkov wrote: > > > > > > He has btrfs raid0 profile on top of hardware RAID6 devices. > > sys_chunk_array[2048]: > item 0 key (FIRST_CHUNK_TREE CHUNK_ITEM 1048576) > length

[PATCH 05/15] btrfs: return whether extent is nocow or not

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues We require this to set the IOMAP_F_COW flag in iomap structure, in the later patches. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 2 +- fs/btrfs/inode.c | 9 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs

[PATCH 06/15] btrfs: Rename __endio_write_update_ordered() to btrfs_update_ordered_extent()

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Since we will be using it in another part of the code, use a better name to declare it non-static Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 7 +-- fs/btrfs/inode.c | 14 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/f

[PATCH 02/15] btrfs: Carve out btrfs_get_extent_map_write() out of btrfs_get_blocks_write()

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This makes btrfs_get_extent_map_write() independent of Direct I/O code. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/inode.c | 40 +++- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/fs/btr

[PATCH 03/15] btrfs: basic dax read

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Perform a basic read using iomap support. The btrfs_iomap_begin() finds the extent at the position and fills the iomap data structure with the values. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/Makefile | 1 + fs/btrfs/ctree.h | 5 + fs/btrfs/dax.c| 49 +++

[no subject]

2019-03-26 Thread Goldwyn Rodrigues
Subject: [PATCH v2 00/15] btrfs dax support This patch set adds support for dax on the BTRFS filesystem. In order to support for CoW for btrfs, there were changes which had to be made to the dax handling. The important one is copying blocks into the same dax device before using them. I have some

[PATCH 04/15] dax: Introduce IOMAP_F_COW for copy-on-write

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues The IOMAP_F_COW is a flag to notify dax that it needs to copy the data from iomap->cow_addr to iomap->addr, if the start/end of I/O are not page aligned. This also introduces dax_to_dax_copy() which performs a copy from one part of the device to another, to a maximum of o

[PATCH 01/15] btrfs: create a mount option for dax

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This sets S_DAX in inode->i_flags, which can be used with IS_DAX(). The dax option is restricted to non multi-device mounts. dax interacts with the device directly instead of using bio, so all bio-hooks which we use for multi-device cannot be performed here. While regular

[PATCH 14/15] btrfs: Disable dax-based defrag and send

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This is temporary, and a TODO. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ioctl.c | 13 + fs/btrfs/send.c | 4 2 files changed, 17 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 2e5137b01561..f532a8df2026 100644 --- a/fs/btrf

[PATCH 09/15] btrfs: add dax mmap support

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Add a new vm_operations struct btrfs_dax_vm_ops specifically for dax files. Since we will be removing(nulling) readpages/writepages for dax return ENOEXEC only for non-dax files. dax_insert_entry() looks ugly. Do you think we should break it into dax_insert_cow_entry() a

[PATCH 08/15] dax: add dax_iomap_cow to copy a mmap page before writing

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues dax_iomap_cow copies a page before presenting for mmap. Signed-off-by: Goldwyn Rodrigues --- fs/dax.c | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index e254535dd830..21ee3df6f02c 100644 --- a/

[PATCH 15/15] btrfs: Writeprotect mmap pages on snapshot

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Inorder to make sure mmap'd files don't change after snapshot, writeprotect the mmap pages on snapshot. This is done by performing a data writeback on the pages (which simply mark the pages are wrprotected). This way if the user process tries to access the memory we will g

[PATCH 10/15] btrfs: Add dax specific address_space_operations

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/inode.c | 34 +++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f721fc1e3f7f..21780ea14e5a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs

[PATCH 12/15] btrfs: trace functions for btrfs_iomap_begin/end

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This is for debug purposes only and can be skipped. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/dax.c | 3 +++ include/trace/events/btrfs.h | 56 2 files changed, 59 insertions(+) diff --git a/fs/btrfs/dax.c

[PATCH 13/15] btrfs: handle dax page zeroing

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs_dax_zero_block() zeros part of the page, either from the front or the regular rest of the block. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 1 + fs/btrfs/dax.c| 29 +++-- fs/btrfs/inode.c | 4 fs/dax.c

[PATCH 07/15] btrfs: add dax write support

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues IOMAP_F_COW allows to inform the dax code, to first perform a copy which are not page-aligned before performing the write. A new struct btrfs_iomap is passed from iomap_begin() to iomap_end(), which contains all the accounting and locking information for CoW based writes.

[PATCH 11/15] fs: dedup file range to use a compare function

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues With dax we cannot deal with readpage() etc. So, we create a funciton callback to perform the file data comparison and pass it to generic_remap_file_range_prep() so it can use iomap-based functions. This may not be the best way to solve this. Suggestions welcome. Signed-

[PATCH v2 00/15] btrfs dax support

2019-03-26 Thread Goldwyn Rodrigues
Sorry, messed up the subject the first time. This patch set adds support for dax on the BTRFS filesystem. In order to support for CoW for btrfs, there were changes which had to be made to the dax handling. The important one is copying blocks into the same dax device before using them. I have some

Re: [PATCH 01/15] btrfs: create a mount option for dax

2019-03-26 Thread Matthew Wilcox
On Tue, Mar 26, 2019 at 02:02:47PM -0500, Goldwyn Rodrigues wrote: > This sets S_DAX in inode->i_flags, which can be used with > IS_DAX(). > > The dax option is restricted to non multi-device mounts. > dax interacts with the device directly instead of using bio, so > all bio-hooks which we use for

Re: [PATCH 07/10] dax: export functions for use with btrfs

2019-03-26 Thread Dan Williams
On Wed, Dec 5, 2018 at 4:29 AM Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > These functions are required for btrfs dax support. > > Signed-off-by: Goldwyn Rodrigues > --- > fs/dax.c| 35 --- > include/linux/dax.h | 16 > 2

[PATCH v6 07/07] btrfs: use common file type conversion

2019-03-26 Thread Phillip Potter
Deduplicate the btrfs file type conversion implementation - file systems that use the same file types as defined by POSIX do not need to define their own versions and can use the common helper functions decared in fs_types.h and implemented in fs_types.c Common implementation can be found via comm

Re: Kernels 4.15..5.0.3: "WARNING: CPU: 2 PID: 4150 at fs/fs-writeback.c:2363 __writeback_inodes_sb_nr+0xa9/0xc0"

2019-03-26 Thread Zygo Blaxell
On Fri, Mar 22, 2019 at 05:26:52PM +, Filipe Manana wrote: > On Fri, Mar 22, 2019 at 3:59 PM David Sterba wrote: > > > > On Fri, Mar 22, 2019 at 09:32:37AM +0200, Nikolay Borisov wrote: > > > On 22.03.19 г. 6:17 ч., Zygo Blaxell wrote: > > > > When filesystems are mounted flushoncommit, I get

Re: Kernels 4.15..5.0.3: "WARNING: CPU: 2 PID: 4150 at fs/fs-writeback.c:2363 __writeback_inodes_sb_nr+0xa9/0xc0"

2019-03-26 Thread Filipe Manana
On Tue, Mar 26, 2019 at 11:13 PM Zygo Blaxell wrote: > > On Fri, Mar 22, 2019 at 05:26:52PM +, Filipe Manana wrote: > > On Fri, Mar 22, 2019 at 3:59 PM David Sterba wrote: > > > > > > On Fri, Mar 22, 2019 at 09:32:37AM +0200, Nikolay Borisov wrote: > > > > On 22.03.19 г. 6:17 ч., Zygo Blaxell

Re: [PATCH v6 07/07] btrfs: use common file type conversion

2019-03-26 Thread David Sterba
On Tue, Mar 26, 2019 at 09:39:34PM +, Phillip Potter wrote: > Deduplicate the btrfs file type conversion implementation - file systems > that use the same file types as defined by POSIX do not need to define > their own versions and can use the common helper functions decared in > fs_types.h an

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-26 Thread Qu Wenruo
On 2019/3/27 上午12:02, David Sterba wrote: > On Mon, Mar 25, 2019 at 12:27:24PM +0800, Qu Wenruo wrote: >> >> >> On 2019/3/20 下午2:37, Qu Wenruo wrote: >>> There is a report in kernel bugzilla about mismatch file type in dir >>> item and inode item. >>> >>> This inspires us to check inode mode in

Re: [PATCH v6 07/07] btrfs: use common file type conversion

2019-03-26 Thread Phillip Potter
On Wed, Mar 27, 2019 at 12:55:39AM +0100, David Sterba wrote: > On Tue, Mar 26, 2019 at 09:39:34PM +, Phillip Potter wrote: > > Deduplicate the btrfs file type conversion implementation - file systems > > that use the same file types as defined by POSIX do not need to define > > their own versi

Re: A collection of btrfs lockup stack traces (4.14.106, no __sb_start_write)

2019-03-26 Thread Zygo Blaxell
On Tue, Mar 19, 2019 at 11:39:59PM -0400, Zygo Blaxell wrote: > I haven't been able to easily reproduce these in a test environment; > however, they have been happening several times a year on servers in > production. > > Kernel: most recent observation on 4.14.105 + cherry-picked deadlock > and

[PATCH -next] btrfs: remove set but not used variable 'fs_devices'

2019-03-26 Thread YueHaibing
Fixes gcc '-Wunused-but-set-variable' warning: fs/btrfs/volumes.c: In function 'btrfs_grow_device': fs/btrfs/volumes.c:2824:27: warning: variable 'fs_devices' set but not used [-Wunused-but-set-variable] It's not used after 6f32a50a232b ("btrfs: combine device update operations during transactio