Re: [RFC PATCH] btrfs: Remove __extent_readpages

2019-02-10 Thread Nikolay Borisov
On 3.12.18 г. 12:25 ч., Nikolay Borisov wrote: > When extent_readpages is called from the generic readahead code it first > builds a batch of 16 pages (which might or might not be consecutive, > depending on whether add_to_page_cache_lru failed) and submits them to > __extent_readpages. The latt

Re: corruption with multi-device btrfs + single bcache, won't mount

2019-02-10 Thread STEVE LEUNG
- Original Message - > From: "Qu Wenruo" > On 2019/2/10 下午2:56, STEVE LEUNG wrote: >> Hi all, >> >> I decided to try something a bit crazy, and try multi-device raid1 btrfs on >> top of dm-crypt and bcache. That is: >> >> btrfs -> dm-crypt -> bcache -> physical disks >> >> I have

Re: corruption with multi-device btrfs + single bcache, won't mount

2019-02-10 Thread STEVE LEUNG
- Original Message - > From: "Thiago Ramon" > On Sun, Feb 10, 2019 at 5:07 AM STEVE LEUNG wrote: >> >> Hi all, >> >> I decided to try something a bit crazy, and try multi-device raid1 btrfs on >> top of dm-crypt and bcache. That is: >> >> btrfs -> dm-crypt -> bcache -> physical disk

[PATCH v3 3/9] btrfs: delayed-ref: Use btrfs_ref to refactor btrfs_add_delayed_tree_ref()

2019-02-10 Thread Qu Wenruo
btrfs_add_delayed_tree_ref() has a longer and longer parameter list, and some caller like btrfs_inc_extent_ref() are using @owner as level for delayed tree ref. Instead of making the parameter list longer and longer, use btrfs_ref to refactor it, so each parameter assignment should be self-explain

[PATCH v3 4/9] btrfs: delayed-ref: Use btrfs_ref to refactor btrfs_add_delayed_data_ref()

2019-02-10 Thread Qu Wenruo
Just like btrfs_add_delayed_tree_ref(), use btrfs_ref to refactor btrfs_add_delayed_data_ref(). Signed-off-by: Qu Wenruo --- fs/btrfs/delayed-ref.c | 20 ++-- fs/btrfs/delayed-ref.h | 7 +++ fs/btrfs/extent-tree.c | 23 ++- 3 files changed, 27 insertions(

[PATCH v3 1/9] btrfs: delayed-ref: Introduce better documented delayed ref structures

2019-02-10 Thread Qu Wenruo
Current delayed ref interface has several problems: - Longer and longer parameter lists bytenr num_bytes parent -- so far so good ref_root owner offset -- I don't feel good now - Different interpretation for the same parameter Above @owner for data ref is inode nu

[PATCH v3 9/9] btrfs: qgroup: Don't scan leaf if we're modifying reloc tree

2019-02-10 Thread Qu Wenruo
Since reloc tree doesn't contribute to qgroup numbers, just skip them. This should catch the final cause of unnecessary data refs for qgroup + metadata balance. The 4G data 16 snapshots test (*) should explain it pretty well: | delayed subtree | refactor delayed ref | this patch ---

[PATCH v3 0/9] btrfs: Refactor delayed ref parameter list

2019-02-10 Thread Qu Wenruo
This patchset can be fetched from github: https://github.com/adam900710/linux/tree/refactor_delayed_ref_parameter Which is based on David's misc-next branch, the base commit is: commit eb3e579e28f1c58e79176fbf5afe1cf3ee227190 (david/misc-next, david/misc-5.1) Author: Anand Jain Date: Fri Feb 8

[PATCH v3 2/9] btrfs: extent-tree: Open-code process_func in __btrfs_mod_ref

2019-02-10 Thread Qu Wenruo
The process_func function pointer is local to __btrfs_mod_ref() and points to either btrfs_inc_extent_ref() or btrfs_free_extent(). Open code it to make later delayed ref refactor easier, so we can refactor btrfs_inc_extent_ref() and btrfs_free_extent() in different patches. Signed-off-by: Qu Wen

[PATCH v3 6/9] btrfs: extent-tree: Use btrfs_ref to refactor add_pinned_bytes()

2019-02-10 Thread Qu Wenruo
Since add_pinned_bytes() only needs to know if the extent is metadata and if it's a chunk tree extent, btrfs_ref is a perfect match for it, as we don't need various owner/level trick to determine extent type. Signed-off-by: Qu Wenruo Reviewed-by: Nikolay Borisov --- fs/btrfs/extent-tree.c | 26

[PATCH v3 5/9] btrfs: ref-verify: Use btrfs_ref to refactor btrfs_ref_tree_mod()

2019-02-10 Thread Qu Wenruo
It's a perfect match for btrfs_ref_tree_mod() to use btrfs_ref, as btrfs_ref describes a metadata/data reference update comprehensively. Now we have one less function use confusing owner/level trick. Signed-off-by: Qu Wenruo --- fs/btrfs/extent-tree.c | 27 +++-- fs/btrfs/ref-ve

[PATCH v3 8/9] btrfs: extent-tree: Use btrfs_ref to refactor btrfs_free_extent()

2019-02-10 Thread Qu Wenruo
Similar to btrfs_inc_extent_ref(), just use btrfs_ref to replace the long parameter list and the confusing @owner parameter. Signed-off-by: Qu Wenruo --- fs/btrfs/ctree.h | 5 +--- fs/btrfs/extent-tree.c | 52 +++--- fs/btrfs/file.c| 22

[PATCH v3 7/9] btrfs: extent-tree: Use btrfs_ref to refactor btrfs_inc_extent_ref()

2019-02-10 Thread Qu Wenruo
Now we don't need to play the dirty game of reusing @owner for tree block level. Signed-off-by: Qu Wenruo --- fs/btrfs/ctree.h | 5 ++-- fs/btrfs/extent-tree.c | 57 -- fs/btrfs/file.c| 17 + fs/btrfs/inode.c | 10 +---

Re: Cannot 'mount -o degraded /dev/replacement' after a replace

2019-02-10 Thread Qu Wenruo
On 2019/2/11 上午2:44, Chris Murphy wrote: > On Sat, Feb 9, 2019 at 3:36 AM Jakob Schöttl wrote: >> >> Replace device 2 with device 3: >> >>mount -o degraded /dev/loop1 /mnt >>btrfs filesystem show # to get devid of device 2 >>btrfs replace start -Br 2 /dev/loop3 /mnt >>btrfs rep

Re: Cannot 'mount -o degraded /dev/replacement' after a replace

2019-02-10 Thread Chris Murphy
On Sat, Feb 9, 2019 at 3:36 AM Jakob Schöttl wrote: > > Replace device 2 with device 3: > >mount -o degraded /dev/loop1 /mnt >btrfs filesystem show # to get devid of device 2 >btrfs replace start -Br 2 /dev/loop3 /mnt >btrfs replace status /mnt # check success >umount /mnt

Re: btrfs as / filesystem in RAID1

2019-02-10 Thread Chris Murphy
On Sat, Feb 9, 2019 at 5:13 AM waxhead wrote: > Understood, but that is not quite what I meant - let me rephrase... > If BTRFS still can't mount, why would it blindly accept a previously > non-existing disk to take part of the pool?! It doesn't do it blindly. It only ever mounts when the user sp

Re: corruption with multi-device btrfs + single bcache, won't mount

2019-02-10 Thread Qu Wenruo
On 2019/2/10 下午2:56, STEVE LEUNG wrote: > Hi all, > > I decided to try something a bit crazy, and try multi-device raid1 btrfs on > top of dm-crypt and bcache. That is: > > btrfs -> dm-crypt -> bcache -> physical disks > > I have a single cache device in front of 4 disks. Maybe this wasn't

Re: corruption with multi-device btrfs + single bcache, won't mount

2019-02-10 Thread Thiago Ramon
On Sun, Feb 10, 2019 at 5:07 AM STEVE LEUNG wrote: > > Hi all, > > I decided to try something a bit crazy, and try multi-device raid1 btrfs on > top of dm-crypt and bcache. That is: > > btrfs -> dm-crypt -> bcache -> physical disks > > I have a single cache device in front of 4 disks. Maybe th