Re: [PATCH] btrfs: list usage cleanup

2018-09-27 Thread David Sterba
On Wed, Sep 26, 2018 at 04:35:45PM +0800, zhong jiang wrote: > Trival cleanup, list_move_tail will implement the same function that > list_del() + list_add_tail() will do. hence just replace them. Thanks, I've checked that this is the only instance where this cleanup is applicable. Reviewed-by: D

Re: [PATCH 00/11] Cleanup dev-replace locking

2018-09-27 Thread David Sterba
On Fri, Sep 07, 2018 at 04:54:59PM +0200, David Sterba wrote: > The series peels off the custom locking that's used for dev-replace and > uses read-write semaphore in the end. > > I've mainly focused on correctness and haven't measured the performance > effects. There should be none as the blockin

Re: [PATCH 0/7] eb reference count cleanups

2018-09-27 Thread David Sterba
On Wed, Aug 15, 2018 at 06:26:50PM +0300, Nikolay Borisov wrote: > Here is a series which simplifies the way eb are used in > EXTENT_BUFFER_UNMAPPED > context. The end goal was to remove the special "if we have ref count of 2 > and > EXTENT_BUFFER_UNMAPPED flag then act as if this is the last re

Re: [PATCH 1/9] btrfs: Add support for reading a filesystem with a RAID 5 or RAID 6 profile.

2018-09-27 Thread Daniel Kiper
On Wed, Sep 26, 2018 at 10:40:32PM +0200, Goffredo Baroncelli wrote: > On 25/09/2018 17.31, Daniel Kiper wrote: > > On Wed, Sep 19, 2018 at 08:40:32PM +0200, Goffredo Baroncelli wrote: > >> From: Goffredo Baroncelli > >> > >> Signed-off-by: Goffredo Baroncelli > >> --- > >> grub-core/fs/btrfs.c

Re: [PATCH 4/9] btrfs: Avoid a rescan for a device which was already not found.

2018-09-27 Thread Daniel Kiper
On Wed, Sep 26, 2018 at 09:55:54PM +0200, Goffredo Baroncelli wrote: > On 25/09/2018 19.29, Daniel Kiper wrote: > > On Wed, Sep 19, 2018 at 08:40:35PM +0200, Goffredo Baroncelli wrote: > >> From: Goffredo Baroncelli > >> > >> If a device is not found, do not return immediately but > >> record this

Re: [PATCH 7/9] btrfs: Add support for recovery for a RAID 5 btrfs profiles.

2018-09-27 Thread Daniel Kiper
On Wed, Sep 26, 2018 at 09:55:57PM +0200, Goffredo Baroncelli wrote: > On 25/09/2018 21.10, Daniel Kiper wrote: > > On Wed, Sep 19, 2018 at 08:40:38PM +0200, Goffredo Baroncelli wrote: > >> From: Goffredo Baroncelli > >> > >> Add support for recovery for a RAID 5 btrfs profile. In addition > >> it

Re: [PATCH 9/9] btrfs: Add RAID 6 recovery for a btrfs filesystem.

2018-09-27 Thread Daniel Kiper
On Wed, Sep 26, 2018 at 09:56:07PM +0200, Goffredo Baroncelli wrote: > On 25/09/2018 21.20, Daniel Kiper wrote: > > On Wed, Sep 19, 2018 at 08:40:40PM +0200, Goffredo Baroncelli wrote: > >> From: Goffredo Baroncelli > >> > [] > >> * - stripe_offset is the disk offset, > >>

Re: [PATCH 1/9] mm: infrastructure for page fault page caching

2018-09-27 Thread Matthew Wilcox
On Wed, Sep 26, 2018 at 05:08:48PM -0400, Josef Bacik wrote: > We want to be able to cache the result of a previous loop of a page > fault in the case that we use VM_FAULT_RETRY, so introduce > handle_mm_fault_cacheable that will take a struct vm_fault directly, add > a ->cached_page field to vm_fa

Re: [PATCH v4 0/7] btrfs: qgroup: Reduce dirty extents for metadata

2018-09-27 Thread David Sterba
On Thu, Sep 27, 2018 at 02:42:28PM +0800, Qu Wenruo wrote: > This patchset can be fetched from github: > https://github.com/adam900710/linux/tree/qgroup_balance_skip_trees > The base commit is v4.19-rc1 tag. > > There are a lot of reports of system hang for balance on quota enabled > fs. > It's mo

[PATCH v9 3/6] vfs: update swap_{,de}activate documentation

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval The documentation for these functions is wrong in several ways: - swap_activate() is called with the inode locked - swap_activate() takes a swap_info_struct * and a sector_t * - swap_activate() can also return a positive number of extents it added itself - swap_deactivate()

[PATCH v9 4/6] Btrfs: prevent ioctls from interfering with a swap file

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval A later patch will implement swap file support for Btrfs, but before we do that, we need to make sure that the various Btrfs ioctls cannot change a swap file. When a swap file is active, we must make sure that the extents of the file are not moved and that they don't become s

[PATCH v9 0/6] Btrfs: implement swap file support

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval Hi, This series implements swap file support for Btrfs. Changes from v8 [1]: - Fixed a bug in btrfs_swap_activate() which would cause us to miss some file extents if they were merged into one extent map entry. - Fixed build for !CONFIG_SWAP. - Changed all error messages t

[PATCH v9 2/6] mm: export add_swap_extent()

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval Btrfs currently does not support swap files because swap's use of bmap does not work with copy-on-write and multiple devices. See commit 35054394c4b3 ("Btrfs: stop providing a bmap operation to avoid swapfile corruptions"). However, the swap code has a mechanism for the filesy

[PATCH v9 1/6] mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval The SWP_FILE flag serves two purposes: to make swap_{read,write}page() go through the filesystem, and to make swapoff() call ->swap_deactivate(). For Btrfs, we want the latter but not the former, so split this flag into two. This makes us always call ->swap_deactivate() if ->s

[PATCH v9 5/6] Btrfs: rename get_chunk_map() and make it non-static

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval The Btrfs swap code is going to need it, so give it a btrfs_ prefix and make it non-static. Reviewed-by: Nikolay Borisov Signed-off-by: Omar Sandoval --- fs/btrfs/volumes.c | 29 ++--- fs/btrfs/volumes.h | 2 ++ 2 files changed, 20 insertions(+), 1

[PATCH v9 6/6] Btrfs: support swap files

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval Btrfs has not allowed swap files since commit 35054394c4b3 ("Btrfs: stop providing a bmap operation to avoid swapfile corruptions"). However, now that the proper restrictions are in place, Btrfs can support swap files through the swap file a_ops, similar to iomap in commit 674

[PATCH V8] Add support for BTRFS raid5/6 to GRUB

2018-09-27 Thread Goffredo Baroncelli
i All, the aim of this patches set is to provide support for a BTRFS raid5/6 filesystem in GRUB. The first patch, implements the basic support for raid5/6. I.e this works when all the disks are present. The next 5 patches, are preparatory ones. The 7th patch implements the raid5 recovery for

[PATCH 1/9] btrfs: Add support for reading a filesystem with a RAID 5 or RAID 6 profile.

2018-09-27 Thread Goffredo Baroncelli
From: Goffredo Baroncelli Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 74 1 file changed, 74 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index be195448d..9bc6d399d 100644 --- a/grub-core/fs/btrfs.c +++ b/

[PATCH 2/9] btrfs: Add helper to check the btrfs header.

2018-09-27 Thread Goffredo Baroncelli
From: Goffredo Baroncelli This helper is used in a few places to help the debugging. As conservative approach the error is only logged. This does not impact the error handling. Signed-off-by: Goffredo Baroncelli Reviewed-by: Daniel Kiper --- grub-core/fs/btrfs.c | 24 +++-

[PATCH 6/9] btrfs: Refactor the code that read from disk

2018-09-27 Thread Goffredo Baroncelli
From: Goffredo Baroncelli Move the code in charge to read the data from disk into a separate function. This helps to separate the error handling logic (which depends on the different raid profiles) from the read from disk logic. Refactoring this code increases the general readability too. This i

[PATCH 3/9] btrfs: Move the error logging from find_device() to its caller.

2018-09-27 Thread Goffredo Baroncelli
From: Goffredo Baroncelli The caller knows better if this error is fatal or not, i.e. another disk is available or not. This is a preparatory patch. Signed-off-by: Goffredo Baroncelli Reviewed-by: Daniel Kiper --- grub-core/fs/btrfs.c | 10 -- 1 file changed, 4 insertions(+), 6 delet

[PATCH 5/9] btrfs: Move logging code in grub_btrfs_read_logical()

2018-09-27 Thread Goffredo Baroncelli
From: Goffredo Baroncelli A portion of the logging code is moved outside of internal for(;;). The part that is left inside is the one which depends on the internal for(;;) index. This is a preparatory patch. The next one will refactor the code inside the for(;;) into an another function. Signed

[PATCH 4/9] btrfs: Avoid a rescan for a device which was already not found.

2018-09-27 Thread Goffredo Baroncelli
From: Goffredo Baroncelli Change the behavior of find_device(): before the patch, a read of a missed device may trigger a rescan. However, it is never recorded that a device is missed, so each single read of a missed device may triggers a rescan. It is the caller who decides if a rescan is perfor

[PATCH 7/9] btrfs: Add support for recovery for a RAID 5 btrfs profiles.

2018-09-27 Thread Goffredo Baroncelli
From: Goffredo Baroncelli Add support for recovery for a RAID 5 btrfs profile. In addition it is added some code as preparatory work for RAID 6 recovery code. Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 160 +-- 1 file changed, 155 inse

[PATCH 8/9] btrfs: Make more generic the code for RAID 6 rebuilding

2018-09-27 Thread Goffredo Baroncelli
From: Goffredo Baroncelli The original code which handles the recovery of a RAID 6 disks array assumes that all reads are multiple of 1 << GRUB_DISK_SECTOR_BITS and it assumes that all the I/O is done via the struct grub_diskfilter_segment. This is not true for the btrfs code. In order to reuse t

[PATCH 9/9] btrfs: Add RAID 6 recovery for a btrfs filesystem.

2018-09-27 Thread Goffredo Baroncelli
From: Goffredo Baroncelli Add the RAID 6 recovery, in order to use a RAID 6 filesystem even if some disks (up to two) are missing. This code use the md RAID 6 code already present in grub. Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 63 +++-

Re: [PATCH] btrfs: list usage cleanup

2018-09-27 Thread Omar Sandoval
On Wed, Sep 26, 2018 at 04:35:45PM +0800, zhong jiang wrote: > Trival cleanup, list_move_tail will implement the same function that > list_del() + list_add_tail() will do. hence just replace them. > > Signed-off-by: zhong jiang > --- > fs/btrfs/send.c | 3 +-- > 1 file changed, 1 insertion(+), 2

Re: [PATCH v2 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option

2018-09-27 Thread Omar Sandoval
On Wed, Sep 26, 2018 at 09:34:27AM +0300, Nikolay Borisov wrote: > > > On 26.09.2018 07:07, Anand Jain wrote: > > > > > > On 09/25/2018 06:51 PM, Nikolay Borisov wrote: > >> > >> > >> On 25.09.2018 07:24, Anand Jain wrote: > >>> As of now _scratch_mkfs_sized() checks if the requested size is be

[PATCH] btrfs: tree-checker: Check level for leaves and nodes

2018-09-27 Thread Qu Wenruo
Although we have tree level check at tree read runtime, it's completely based on its parent level. We still need to do accurate level check to avoid invalid tree blocks sneak into kernel space. The check itself is simple, for leaf its level should always be 0. For nodes its level should be in rang

Re: [PATCH] btrfs: tree-checker: Check level for leaves and nodes

2018-09-27 Thread Su Yue
> Sent: Friday, September 28, 2018 at 7:59 AM > From: "Qu Wenruo" > To: linux-btrfs@vger.kernel.org > Subject: [PATCH] btrfs: tree-checker: Check level for leaves and nodes > > Although we have tree level check at tree read runtime, it's completely > based on its parent level. > We still need t

Re: [PATCH] btrfs: tree-checker: Check level for leaves and nodes

2018-09-27 Thread Su Yue
On 9/28/18 7:59 AM, Qu Wenruo wrote: Although we have tree level check at tree read runtime, it's completely based on its parent level. We still need to do accurate level check to avoid invalid tree blocks sneak into kernel space. The check itself is simple, for leaf its level should always b

Re: [PATCH] btrfs: tree-checker: Check level for leaves and nodes

2018-09-27 Thread Qu Wenruo
On 2018/9/28 上午9:08, Su Yue wrote: > > > On 9/28/18 7:59 AM, Qu Wenruo wrote: >> Although we have tree level check at tree read runtime, it's completely >> based on its parent level. >> We still need to do accurate level check to avoid invalid tree blocks >> sneak into kernel space. >> >> The

[PATCH v2 0/6] btrfs-progs: print-tree: Minor enhancement along with --bfs/--dfs options

2018-09-27 Thread Qu Wenruo
This patchset can be fetched from github: https://github.com/adam900710/btrfs-progs/tree/dump_tree_enhance The main point of this patchset is to allow "btrfs ins dump-tree" to print tree blocks in breadth-first order when level is higher than 2. The 1st patch is just a minor cleanup, to remove so

[PATCH v2 1/6] btrfs-progs: print-tree: Skip deprecated blockptr / nodesize output

2018-09-27 Thread Qu Wenruo
When printing tree nodes, we output slots like: key (EXTENT_TREE ROOT_ITEM 0) block 73625600 (17975) gen 16 The number in the parentheses is blockptr / nodesize. However this number doesn't really do any thing useful. And in fact for unaligned metadata block group (block group start bytenr is not

[PATCH v2 6/6] btrfs-progs: print-tree: Use bool for @follow

2018-09-27 Thread Qu Wenruo
Just a minor cleanup to make the parameter easier to read. Signed-off-by: Qu Wenruo --- cmds-inspect-dump-tree.c | 16 print-tree.c | 2 +- print-tree.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmds-inspect-dump-tree.c

[PATCH v2 2/6] btrfs-progs: Replace root parameter using fs_info for reada_for_search()

2018-09-27 Thread Qu Wenruo
As the @root parameter is only used to get @fs_info, use fs_info directly instead. Signed-off-by: Qu Wenruo --- cmds-restore.c | 4 ++-- ctree.c| 11 +-- ctree.h| 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cmds-restore.c b/cmds-restore.c ind

[PATCH v2 5/6] btrfs-progs: print-tree: Introduce --bfs and --dfs options

2018-09-27 Thread Qu Wenruo
Originally print-tree uses depth first search to print trees. This works fine until we reach 3 level trees (root node level is 2). For tall trees whose root level is 2 or higher, DFS will mix nodes and leaves like the following example: Level 2 A

[PATCH v2 3/6] btrfs-progs: Introduce function to find next sibling tree block

2018-09-27 Thread Qu Wenruo
Introduce a new function, btrfs_next_sibling_tree_block(), which could find any sibling tree blocks at path->lowest_level, unlike level 0 limited btrfs_next_leaf(). Since this function is more generic than btrfs_next_leaf(), also make btrfs_next_leaf() a wrapper of btrfs_next_sibling_tree_block(),

[PATCH v2 4/6] btrfs-progs: print-tree: Introduce breadth-first search

2018-09-27 Thread Qu Wenruo
Introduce a new function, bfs_print_children(), to do breadth-first search to print a node. Signed-off-by: Qu Wenruo --- print-tree.c | 72 1 file changed, 72 insertions(+) diff --git a/print-tree.c b/print-tree.c index 31f6fa12522f..685d2be8