Re: [PATCH] Btrfs: fill -last_trans for delayed inode in btrfs_fill_inode.

2015-04-09 Thread Miao Xie
-by: Dongsheng Yang yangds.f...@cn.fujitsu.com Good catch! Reviewed-by: Miao Xie miao...@huawei.com --- fs/btrfs/delayed-inode.c | 2 ++ fs/btrfs/inode.c | 21 - 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs

Re: [PATCH RFC v6 6/9] vfs: Add sb_want_write() function to get vfsmount from a given sb.

2015-02-04 Thread Miao Xie
there | is sb_want_write() waiting) So Alice can't thaw the fs since there is no mount point for it now. 2) Don't allow any umount of the sb if there is sb_want_write(). More aggressive one, purpose by Miao Xie. Can't resolve problem 1.1) but will solve problem 1.2). This is one of the two methods that I told

Re: [PATCH v5 0/9] btrfs: Fix freeze/sysfs deadlock in better method.

2015-01-30 Thread Miao Xie
On Fri, 30 Jan 2015 20:17:49 +0100, David Sterba wrote: On Fri, Jan 30, 2015 at 05:20:45PM +0800, Qu Wenruo wrote: [Use VFS protect for sysfs change] The 6th patch will introduce a new help function sb_want_write() to claim write permission to a superblock. With this, we are able to do write

Re: [PATCH RESEND v4 2/8] btrfs: Make btrfs_parse_options() parse mount option in a atomic way

2015-01-29 Thread Miao Xie
On Fri, 30 Jan 2015 09:33:17 +0800, Qu Wenruo wrote: Original Message Subject: Re: [PATCH RESEND v4 2/8] btrfs: Make btrfs_parse_options() parse mount option in a atomic way From: Miao Xie miao...@huawei.com To: Qu Wenruo quwen...@cn.fujitsu.com, linux-btrfs

Re: [PATCH RESEND v4 2/8] btrfs: Make btrfs_parse_options() parse mount option in a atomic way

2015-01-29 Thread Miao Xie
On Thu, 29 Jan 2015 10:24:35 +0800, Qu Wenruo wrote: Current btrfs_parse_options() is not atomic, which can set and clear a bit, especially for nospace_cache case. For example, if a fs is mounted with nospace_cache, btrfs_parse_options() will set SPACE_CACHE bit first(since cache_generation

Re: [PATCH RESEND v4 2/8] btrfs: Make btrfs_parse_options() parse mount option in a atomic way

2015-01-29 Thread Miao Xie
On Fri, 30 Jan 2015 10:51:52 +0800, Qu Wenruo wrote: Original Message Subject: Re: [PATCH RESEND v4 2/8] btrfs: Make btrfs_parse_options() parse mount option in a atomic way From: Miao Xie miao...@huawei.com To: Qu Wenruo quwen...@cn.fujitsu.com, linux-btrfs

Re: [PATCH RESEND v4 6/8] vfs: Add get_vfsmount_sb() function to get vfsmount from a given sb.

2015-01-29 Thread Miao Xie
On Fri, 30 Jan 2015 04:37:14 +, Al Viro wrote: On Fri, Jan 30, 2015 at 12:14:24PM +0800, Miao Xie wrote: On Fri, 30 Jan 2015 02:14:45 +, Al Viro wrote: On Fri, Jan 30, 2015 at 09:44:03AM +0800, Qu Wenruo wrote: This shouldn't happen. If someone is ro, the whole fs should be ro, right

Re: [PATCH RESEND v4 6/8] vfs: Add get_vfsmount_sb() function to get vfsmount from a given sb.

2015-01-29 Thread Miao Xie
On Fri, 30 Jan 2015 10:02:26 +0800, Qu Wenruo wrote: Original Message Subject: Re: [PATCH RESEND v4 6/8] vfs: Add get_vfsmount_sb() function to get vfsmount from a given sb. From: Qu Wenruo quwen...@cn.fujitsu.com To: Miao Xie miao...@huawei.com, linux-btrfs

Re: [PATCH RESEND v4 6/8] vfs: Add get_vfsmount_sb() function to get vfsmount from a given sb.

2015-01-29 Thread Miao Xie
On Fri, 30 Jan 2015 02:14:45 +, Al Viro wrote: On Fri, Jan 30, 2015 at 09:44:03AM +0800, Qu Wenruo wrote: This shouldn't happen. If someone is ro, the whole fs should be ro, right? Wrong. Individual vfsmounts over an r/w superblock might very well be r/o. As for that trylock... What

Re: [PATCH RESEND v4 6/8] vfs: Add get_vfsmount_sb() function to get vfsmount from a given sb.

2015-01-29 Thread Miao Xie
On Thu, 29 Jan 2015 10:24:39 +0800, Qu Wenruo wrote: There are sysfs interfaces in some fs, only btrfs yet, which will modify on-disk data. Unlike normal file operation routine we can use mnt_want_write_file() to protect the operation, change through sysfs won't to be binded to any file in

Re: [PATCH] btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock.

2015-01-25 Thread Miao Xie
On Fri, 23 Jan 2015 17:59:49 +0100, David Sterba wrote: On Wed, Jan 21, 2015 at 03:04:02PM +0800, Miao Xie wrote: Pending changes are *not* only mount options. Feature change and label change are also pending changes if using sysfs. My miss, I don't notice feature and label change by sysfs

Re: [PATCH] btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock.

2015-01-21 Thread Miao Xie
On Wed, 21 Jan 2015 15:47:54 +0800, Qu Wenruo wrote: On Wed, 21 Jan 2015 11:53:34 +0800, Qu Wenruo wrote: [snipped] This will cause another problem, nobody can ensure there will be next transaction and the change may never to written into disk. First, the pending changes is mount option,

Re: [PATCH] btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock.

2015-01-20 Thread Miao Xie
On Tue, 20 Jan 2015 20:10:56 -0500, Chris Mason wrote: On Tue, Jan 20, 2015 at 8:09 PM, Qu Wenruo quwen...@cn.fujitsu.com wrote: Original Message Subject: Re: [PATCH] btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock. From: Chris Mason c...@fb.com

Re: [PATCH] btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock.

2015-01-20 Thread Miao Xie
On Wed, 21 Jan 2015 11:53:34 +0800, Qu Wenruo wrote: +/* + * Test if the fs is frozen, or start_trasaction + * will deadlock on itself. + */ +if (__sb_start_write(sb, SB_FREEZE_FS, false)) +__sb_end_write(sb,

Re: [PATCH] btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock.

2015-01-19 Thread Miao Xie
On Mon, 19 Jan 2015 15:42:41 +0800, Qu Wenruo wrote: Commit 6b5fe46dfa52 (btrfs: do commit in sync_fs if there are pending changes) will call btrfs_start_transaction() in sync_fs(), to handle some operations needed to be done in next transaction. However this can cause deadlock if the

Re: [PATCH] Btrfs: fix typo of variable in scrub_stripe

2015-01-09 Thread Miao Xie
); + btrfs_free_path(path); My bad. Thanks to fix it. Reviewed-by: Miao Xie miao...@huawei.com return -ENOMEM; } -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org

Re: [PATCH] btrfs: delete chunk allocation attemp when setting block group ro

2015-01-08 Thread Miao Xie
On Thu, 08 Jan 2015 13:23:13 -0800, Shaohua Li wrote: Below test will fail currently: mkfs.ext4 -F /dev/sda btrfs-convert /dev/sda mount /dev/sda /mnt btrfs device add -f /dev/sdb /mnt btrfs balance start -v -dconvert=raid1 -mconvert=raid1 /mnt The reason is there are some block

Re: [PATCH] btrfs: delete chunk allocation attemp when setting block group ro

2015-01-08 Thread Miao Xie
On Thu, 08 Jan 2015 18:06:50 -0800, Shaohua Li wrote: On Fri, Jan 09, 2015 at 09:01:57AM +0800, Miao Xie wrote: On Thu, 08 Jan 2015 13:23:13 -0800, Shaohua Li wrote: Below test will fail currently: mkfs.ext4 -F /dev/sda btrfs-convert /dev/sda mount /dev/sda /mnt btrfs device add -f

[PATCH v4 03/10] Btrfs, raid56: don't change bbio and raid_map

2014-12-02 Thread Miao Xie
Because we will reuse bbio and raid_map during the scrub later, it is better that we don't change any variant of bbio and don't free it at the end of IO request. So we introduced similar variants into the raid bio, and don't access those bbio's variants any more. Signed-off-by: Miao Xie mi

[PATCH v4 01/10] Btrfs: remove noused bbio_ret in __btrfs_map_block in condition

2014-12-02 Thread Miao Xie
From: Zhao Lei zhao...@cn.fujitsu.com bbio_ret in this condition is always !NULL because previous code already have a check-and-skip: 4908 if (!bbio_ret) 4909 goto out; Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com Reviewed-by: David Sterba dste

[PATCH v4 00/10] Implement device scrub/replace for RAID56

2014-12-02 Thread Miao Xie
the rbio merge. Changelog v1 - v2: - Change some function names in raid56.c to make them fit the code style of the raid56. Thanks Miao Miao Xie (7): Btrfs, raid56: don't change bbio and raid_map Btrfs, scrub: repair the common data on RAID5/6 if it is corrupted Btrfs, raid56: use a variant

[PATCH v4 07/10] Btrfs, replace: write dirty pages into the replace target device

2014-12-02 Thread Miao Xie
, at this time, we will find the relative replace target stripes and wirte the relative data into it. Note: The function that copying old data on the source device to the target device was implemented in the past, it is similar to the other RAID type. Signed-off-by: Miao Xie mi...@cn.fujitsu.com

[PATCH v4 05/10] Btrfs, raid56: use a variant to record the operation type

2014-12-02 Thread Miao Xie
a variant to record the operation type. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v4: - None. --- fs/btrfs/raid56.c | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index c954537..4924388

[PATCH v4 09/10] Btrfs, raid56: fix use-after-free problem in the final device replace procedure on raid56

2014-12-02 Thread Miao Xie
ends. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v3 - v4: - None. Changelog v2 - v3: - New patch to fix undealt use-after-free problem of the source device in the final device replace procedure. Changelog v1 - v2: - None. --- fs/btrfs/ctree.h | 7 ++- fs/btrfs/dev

[PATCH v4 10/10] Btrfs, replace: enable dev-replace for raid56

2014-12-02 Thread Miao Xie
From: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v4: - None. --- fs/btrfs/dev-replace.c | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c

[PATCH v4 04/10] Btrfs, scrub: repair the common data on RAID5/6 if it is corrupted

2014-12-02 Thread Miao Xie
This patch implement the RAID5/6 common data repair function, the implementation is similar to the scrub on the other RAID such as RAID1, the differentia is that we don't read the data from the mirror, we use the data repair function of RAID5/6. Signed-off-by: Miao Xie mi...@cn.fujitsu.com

[PATCH v4 02/10] Btrfs: remove unnecessary code of stripe_index assignment in __btrfs_map_block

2014-12-02 Thread Miao Xie
From: Zhao Lei zhao...@cn.fujitsu.com stripe_index's value was set again in latter line: stripe_index = 0; Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com Reviewed-by: David Sterba dste...@suse.cz --- Changelog v1 - v4: - None. --- fs/btrfs/volumes.c

Re: [PATCH v3 10/11] Btrfs: fix possible deadlock caused by pending I/O in plug list

2014-12-02 Thread Miao Xie
hi, Chris On Fri, 28 Nov 2014 16:32:03 -0500, Chris Mason wrote: On Wed, Nov 26, 2014 at 10:00 PM, Miao Xie mi...@cn.fujitsu.com wrote: On Thu, 27 Nov 2014 09:39:56 +0800, Miao Xie wrote: On Wed, 26 Nov 2014 10:02:23 -0500, Chris Mason wrote: On Wed, Nov 26, 2014 at 8:04 AM, Miao Xie mi

Re: [PATCH v4 00/10] Implement device scrub/replace for RAID56

2014-12-02 Thread Miao Xie
On Tue, 2 Dec 2014 08:28:22 -0500, Chris Mason wrote: On Tue, Dec 2, 2014 at 7:39 AM, Miao Xie mi...@cn.fujitsu.com wrote: This patchset implement the device scrub/replace function for RAID56, the most implementation of the common data is similar to the other RAID type. The differentia

Re: [PATCH v4 00/10] Implement device scrub/replace for RAID56

2014-12-02 Thread Miao Xie
On Tue, 2 Dec 2014 08:28:22 -0500, Chris Mason wrote: On Tue, Dec 2, 2014 at 7:39 AM, Miao Xie mi...@cn.fujitsu.com wrote: This patchset implement the device scrub/replace function for RAID56, the most implementation of the common data is similar to the other RAID type. The differentia

[PATCH] Btrfs: fix wrong list access on the failure of reading out checksum

2014-12-01 Thread Miao Xie
If we failed to reading out the checksum, we would free all the checksums in the list. But the current code accessed the list head, not the entry in the list. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/file-item.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion

Re: [PATCH] Btrfs: fix wrong list access on the failure of reading out checksum

2014-12-01 Thread Miao Xie
Please ignore this patch, Chris has fixed this problem. Thanks Miao On Mon, 1 Dec 2014 18:04:13 +0800, Miao Xie wrote: If we failed to reading out the checksum, we would free all the checksums in the list. But the current code accessed the list head, not the entry in the list. Fix

[PATCH v3 05/11] Btrfs, raid56: use a variant to record the operation type

2014-11-26 Thread Miao Xie
a variant to record the operation type. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v3: - None. --- fs/btrfs/raid56.c | 30 +- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 6013d88..bfc406d

[PATCH v3 00/11] Implement device scrub/replace for RAID56

2014-11-26 Thread Miao Xie
that is used to avoid the rbio merge. Changelog v1 - v2: - Change some function names in raid56.c to make them fit the code style of the raid56. Thanks Miao Miao Xie (8): Btrfs, raid56: don't change bbio and raid_map Btrfs, scrub: repair the common data on RAID5/6 if it is corrupted Btrfs

[PATCH v3 08/11] Btrfs, replace: write raid56 parity into the replace target device

2014-11-26 Thread Miao Xie
This function reused the code of parity scrub, and we just write the right parity or corrected parity into the target device before the parity scrub end. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v3: - None. --- fs/btrfs/raid56.c | 23 +++ fs/btrfs

[PATCH v3 01/11] Btrfs: remove noused bbio_ret in __btrfs_map_block in condition

2014-11-26 Thread Miao Xie
From: Zhao Lei zhao...@cn.fujitsu.com bbio_ret in this condition is always !NULL because previous code already have a check-and-skip: 4908 if (!bbio_ret) 4909 goto out; Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com Reviewed-by: David Sterba dste

[PATCH v3 02/11] Btrfs: remove unnecessary code of stripe_index assignment in __btrfs_map_block

2014-11-26 Thread Miao Xie
From: Zhao Lei zhao...@cn.fujitsu.com stripe_index's value was set again in latter line: stripe_index = 0; Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com Reviewed-by: David Sterba dste...@suse.cz --- Changelog v1 - v3: - None. --- fs/btrfs/volumes.c

[PATCH v3 03/11] Btrfs, raid56: don't change bbio and raid_map

2014-11-26 Thread Miao Xie
Because we will reuse bbio and raid_map during the scrub later, it is better that we don't change any variant of bbio and don't free it at the end of IO request. So we introduced similar variants into the raid bio, and don't access those bbio's variants any more. Signed-off-by: Miao Xie mi

[PATCH v3 06/11] Btrfs, raid56: support parity scrub on raid56

2014-11-26 Thread Miao Xie
introduce a bitmap. If there is some data on the horizontal sub-stripe, we will the relative bit to 1, and when we check and repair the parity, we will skip those horizontal sub-stripes that the relative bits is 0. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v2 - v3: - Fix wrong

[PATCH v3 11/11] Btrfs, replace: enable dev-replace for raid56

2014-11-26 Thread Miao Xie
From: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v3: - None. --- fs/btrfs/dev-replace.c | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c

[PATCH v3 10/11] Btrfs: fix possible deadlock caused by pending I/O in plug list

2014-11-26 Thread Miao Xie
-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v2 - v3: - New patch to fix possible deadlock caused by the pending bios in the plug list when the io submitters were going to sleep. Changelog v1 - v2: - None. --- fs/btrfs/dev-replace.c | 15 +++ 1 file changed, 11 insertions(+), 4

[PATCH v3 07/11] Btrfs, replace: write dirty pages into the replace target device

2014-11-26 Thread Miao Xie
, at this time, we will find the relative replace target stripes and wirte the relative data into it. Note: The function that copying old data on the source device to the target device was implemented in the past, it is similar to the other RAID type. Signed-off-by: Miao Xie mi...@cn.fujitsu.com

[PATCH v3 04/11] Btrfs, scrub: repair the common data on RAID5/6 if it is corrupted

2014-11-26 Thread Miao Xie
This patch implement the RAID5/6 common data repair function, the implementation is similar to the scrub on the other RAID such as RAID1, the differentia is that we don't read the data from the mirror, we use the data repair function of RAID5/6. Signed-off-by: Miao Xie mi...@cn.fujitsu.com

Re: [PATCH v3 10/11] Btrfs: fix possible deadlock caused by pending I/O in plug list

2014-11-26 Thread Miao Xie
On Thu, 27 Nov 2014 09:39:56 +0800, Miao Xie wrote: On Wed, 26 Nov 2014 10:02:23 -0500, Chris Mason wrote: On Wed, Nov 26, 2014 at 8:04 AM, Miao Xie mi...@cn.fujitsu.com wrote: The increase/decrease of bio counter is on the I/O path, so we should use io_schedule() instead of schedule

[PATCH v2 4/9] Btrfs, scrub: repair the common data on RAID5/6 if it is corrupted

2014-11-24 Thread Miao Xie
This patch implement the RAID5/6 common data repair function, the implementation is similar to the scrub on the other RAID such as RAID1, the differentia is that we don't read the data from the mirror, we use the data repair function of RAID5/6. Signed-off-by: Miao Xie mi...@cn.fujitsu.com

Re: [PATCH] Btrfs: make sure we wait on logged extents when fsycning two subvols

2014-11-20 Thread Miao Xie
On Thu, 6 Nov 2014 10:19:54 -0500, Josef Bacik wrote: If we have two fsync()'s race on different subvols one will do all of its work to get into the log_tree, wait on it's outstanding IO, and then allow the log_tree to finish it's commit. The problem is we were just free'ing that subvols

[PATCH 0/9] Implement device scrub/replace for RAID56

2014-11-14 Thread Miao Xie
are interesting to use it or test it, you can pull the patchset from https://github.com/miaoxie/linux-btrfs.git raid56-scrub-replace Thanks Miao Miao Xie (6): Btrfs, raid56: don't change bbio and raid_map Btrfs, scrub: repair the common data on RAID5/6 if it is corrupted Btrfs,raid56: use a variant

[PATCH 6/9] Btrfs,raid56: support parity scrub on raid56

2014-11-14 Thread Miao Xie
introduce a bitmap. If there is some data on the horizontal sub-stripe, we will the relative bit to 1, and when we check and repair the parity, we will skip those horizontal sub-stripes that the relative bits is 0. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/raid56.c | 500

[PATCH 1/9] Btrfs: remove noused bbio_ret in __btrfs_map_block in condition

2014-11-14 Thread Miao Xie
From: Zhao Lei zhao...@cn.fujitsu.com bbio_ret in this condition is always !NULL because previous code already have a check-and-skip: 4908 if (!bbio_ret) 4909 goto out; Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 3

[PATCH 5/9] Btrfs,raid56: use a variant to record the operation type

2014-11-14 Thread Miao Xie
a variant to record the operation type. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/raid56.c | 30 +- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index b3e9c76..d550e9b 100644 --- a/fs/btrfs/raid56.c

[PATCH 4/9] Btrfs, scrub: repair the common data on RAID5/6 if it is corrupted

2014-11-14 Thread Miao Xie
This patch implement the RAID5/6 common data repair function, the implementation is similar to the scrub on the other RAID such as RAID1, the differentia is that we don't read the data from the mirror, we use the data repair function of RAID5/6. Signed-off-by: Miao Xie mi...@cn.fujitsu.com

[PATCH 9/9] Btrfs, replace: enable dev-replace for raid56

2014-11-14 Thread Miao Xie
From: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/dev-replace.c | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 6f662b3..6aa835c 100644

[PATCH 2/9] Btrfs: remove unnecessary code of stripe_index assignment in __btrfs_map_block

2014-11-14 Thread Miao Xie
From: Zhao Lei zhao...@cn.fujitsu.com stripe_index's value was set again in latter line: stripe_index = 0; Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs

[PATCH 8/9] Btrfs, replace: write raid56 parity into the replace target device

2014-11-14 Thread Miao Xie
This function reused the code of parity scrub, and we just write the right parity or corrected parity into the target device before the parity scrub end. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/raid56.c | 23 +++ fs/btrfs/scrub.c | 2 +- 2 files changed

[PATCH 7/9] Btrfs, replace: write dirty pages into the replace target device

2014-11-14 Thread Miao Xie
, at this time, we will find the relative replace target stripes and wirte the relative data into it. Note: The function that copying old data on the source device to the target device was implemented in the past, it is similar to the other RAID type. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs

[PATCH 3/9] Btrfs, raid56: don't change bbio and raid_map

2014-11-14 Thread Miao Xie
Because we will reuse bbio and raid_map during the scrub later, it is better that we don't change any variant of bbio and don't free it at the end of IO request. So we introduced similar variants into the raid bio, and don't access those bbio's variants any more. Signed-off-by: Miao Xie mi

Re: [PATCH] Btrfs: fix incorrect compression ratio detection

2014-11-09 Thread Miao Xie
before compression, if it is a small write(=blocksize), we bail out and fall into nocompression directly. Signed-off-by: Wang Shilong wangshilong1...@gmail.com Looks good. Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c | 16 1 file changed, 8 insertions

Re: [PATCH] Btrfs: don't do async reclaim during log replay V2

2014-11-06 Thread Miao Xie
On Thu, 6 Nov 2014 09:39:19 -0500, Josef Bacik wrote: On 10/23/2014 04:44 AM, Miao Xie wrote: On Thu, 18 Sep 2014 11:27:17 -0400, Josef Bacik wrote: Trying to reproduce a log enospc bug I hit a panic in the async reclaim code during log replay. This is because we use fs_info-fs_root as our

Re: [PATCH] Btrfs: don't take the chunk_mutex/dev_list mutex in statfs V2

2014-11-04 Thread Miao Xie
On Mon, 3 Nov 2014 08:56:50 -0500, Josef Bacik wrote: Our gluster boxes get several thousand statfs() calls per second, which begins to suck hardcore with all of the lock contention on the chunk mutex and dev list mutex. We don't really need to hold these things, if we have transient

Re: [PATCH] Btrfs: don't do async reclaim during log replay V2

2014-10-29 Thread Miao Xie
Ping.. On Thu, 23 Oct 2014 16:44:54 +0800, Miao Xie wrote: On Thu, 18 Sep 2014 11:27:17 -0400, Josef Bacik wrote: Trying to reproduce a log enospc bug I hit a panic in the async reclaim code during log replay. This is because we use fs_info-fs_root as our root for shrinking

Re: [PATCH v3] Btrfs: fix snapshot inconsistency after a file write followed by truncate

2014-10-29 Thread Miao Xie
On Wed, 29 Oct 2014 08:21:12 +, Filipe Manana wrote: If right after starting the snapshot creation ioctl we perform a write against a file followed by a truncate, with both operations increasing the file's size, we can get a snapshot tree that reflects a state of the source subvolume's

Re: [PATCH] Btrfs: fix invalid leaf slot access in btrfs_lookup_extent()

2014-10-27 Thread Miao Xie
On Mon, 27 Oct 2014 09:16:55 +, Filipe Manana wrote: If we couldn't find our extent item, we accessed the current slot (path-slots[0]) to check if it corresponds to an equivalent skinny metadata item. However this slot could be beyond our last item in the leaf (i.e. path-slots[0] =

Re: [PATCH] Btrfs: fix race that makes btrfs_lookup_extent_info miss skinny extent items

2014-10-27 Thread Miao Xie
On Mon, 27 Oct 2014 09:19:52 +, Filipe Manana wrote: We have a race that can lead us to miss skinny extent items in the function btrfs_lookup_extent_info() when the skinny metadata feature is enabled. So basically the sequence of steps is: 1) We search in the extent tree for the skinny

Re: [PATCH] Btrfs: fix race that makes btrfs_lookup_extent_info miss skinny extent items

2014-10-27 Thread Miao Xie
On Mon, 27 Oct 2014 13:44:22 +, Filipe David Manana wrote: On Mon, Oct 27, 2014 at 12:11 PM, Filipe David Manana fdman...@gmail.com wrote: On Mon, Oct 27, 2014 at 11:08 AM, Miao Xie mi...@cn.fujitsu.com wrote: On Mon, 27 Oct 2014 09:19:52 +, Filipe Manana wrote: We have a race

Re: [PATCH] Btrfs: properly clean up btrfs_end_io_wq_cache

2014-10-23 Thread Miao Xie
-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index b83ef15..c1d020f 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2151,6 +2151,7 @@ static void __exit exit_btrfs_fs(void

Re: [PATCH] Btrfs: don't do async reclaim during log replay V2

2014-10-23 Thread Miao Xie
On Thu, 18 Sep 2014 11:27:17 -0400, Josef Bacik wrote: Trying to reproduce a log enospc bug I hit a panic in the async reclaim code during log replay. This is because we use fs_info-fs_root as our root for shrinking and such. Technically we can use whatever root we want, but let's just not

Re: device balance times

2014-10-23 Thread Miao Xie
On Wed, 22 Oct 2014 14:40:47 +0200, Piotr Pawłow wrote: On 22.10.2014 03:43, Chris Murphy wrote: On Oct 21, 2014, at 4:14 PM, Piotr Pawłowp...@siedziba.pl wrote: Looks normal to me. Last time I started a balance after adding 6th device to my FS, it took 4 days to move 25GBs of data. It's

Re: [PATCH 2/2] Btrfs: check-int: don't complain about balanced blocks

2014-10-17 Thread Miao Xie
On Thu, 16 Oct 2014 17:48:49 +0200, Stefan Behrens wrote: The xfstest btrfs/014 which tests the balance operation caused that the check_int module complained that known blocks changed their physical location. Since this is not an error in this case, only print such message if the verbose mode

Re: [PATCH] Btrfs: return failure if btrfs_dev_replace_finishing() failed

2014-10-12 Thread Miao Xie
Guan On Sat, 11 Oct 2014 14:45:29 +0800, Eryu Guan wrote: device replace could fail due to another running scrub process, but this failure doesn't get returned to userspace. The following steps could reproduce this issue mkfs -t btrfs -f /dev/sdb1 /dev/sdb2 mount /dev/sdb1 /mnt/btrfs

Re: [PATCH] Btrfs: return failure if btrfs_dev_replace_finishing() failed

2014-10-10 Thread Miao Xie
On Fri, 10 Oct 2014 15:13:31 +0800, Eryu Guan wrote: On Thu, Sep 25, 2014 at 06:28:14PM +0800, Eryu Guan wrote: device replace could fail due to another running scrub process, but this failure doesn't get returned to userspace. The following steps could reproduce this issue mkfs -t

Re: [PATCH] btrfs: fix ABBA deadlock in btrfs_dev_replace_finishing()

2014-09-21 Thread Miao Xie
It has been fixed by https://patchwork.kernel.org/patch/4747961/ Thanks Miao On Sun, 21 Sep 2014 12:41:49 +0800, Eryu Guan wrote: btrfs_map_bio() first calls btrfs_bio_counter_inc_blocked() which checks fs state and increase bio_counter, then calls __btrfs_map_block() which will take the

Re: [PATCH] btrfs: Fix the wrong condition judgment about subset extent map

2014-09-21 Thread Miao Xie
This patch and the previous one(The following patch) also fixed a oops, which can be reproduced by LTP stress test(ltpstress.sh + fsstress). [PATCH] btrfs: Fix and enhance merge_extent_mapping() to insert best fitted extent map Thanks Miao On Mon, 22 Sep 2014 09:13:03 +0800, Qu Wenruo wrote:

Re: kernel integration branch updated

2014-09-18 Thread Miao Xie
Chris On Fri, 19 Sep 2014 09:45:17 +0800, Qu Wenruo wrote: Hi Chris, I'm sorry that the commit 'btrfs: Fix and enhance merge_extent_mapping() to insert best fitted extent map' has a V2 patch, so the one in tree is not up-to-data. Although the v2 change is quite small and it's

[PATCH v4 00/11] Implement the data repair function for direct read

2014-09-12 Thread Miao Xie
the warning which was triggered by __GFP_ZERO in the 2nd patch Miao Xie (11): Btrfs: load checksum data once when submitting a direct read io Btrfs: cleanup similar code of the buffered data data check and dio read data check Btrfs: do file data check by sub-bio's self Btrfs: fix missing

[PATCH v4 03/11] Btrfs: do file data check by sub-bio's self

2014-09-12 Thread Miao Xie
of the direct io data repair implementation. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v4: - None --- fs/btrfs/btrfs_inode.h | 9 + fs/btrfs/extent_io.c | 2 +- fs/btrfs/inode.c | 100 - fs/btrfs/volumes.h | 5

[PATCH v4 07/11] Btrfs: modify repair_io_failure and make it suit direct io

2014-09-12 Thread Miao Xie
structure. In order to implement direct read data repair, we need modify repair_io_failure and pass all filesystem data it need by function parameters. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v4: - None --- fs/btrfs/extent_io.c | 8 +--- fs/btrfs/extent_io.h | 2 +- fs

[PATCH v4 05/11] Btrfs: Cleanup unused variant and argument of IO failure handlers

2014-09-12 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v4: - None --- fs/btrfs/extent_io.c | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index f8dda46..154cb8e 100644 --- a/fs/btrfs/extent_io.c

[PATCH v4 02/11] Btrfs: cleanup similar code of the buffered data data check and dio read data check

2014-09-12 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v4: - None --- fs/btrfs/inode.c | 102 +-- 1 file changed, 47 insertions(+), 55 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index af304e1..e8139c6 100644 --- a/fs

[PATCH v4 04/11] Btrfs: fix missing error handler if submiting re-read bio fails

2014-09-12 Thread Miao Xie
We forgot to free failure record and bio after submitting re-read bio failed, fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v4: - None --- fs/btrfs/extent_io.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index

[PATCH v4 10/11] Btrfs: implement repair function when direct read fails

2014-09-12 Thread Miao Xie
on the new mirror is still corrupted, we will try next mirror until we read right data or all the mirrors are traversed. - After the above work, we set the uptodate flag according to the result. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v3 - v4: - Use a dedicated btrfs workqueue

[PATCH v4 01/11] Btrfs: load checksum data once when submitting a direct read io

2014-09-12 Thread Miao Xie
improves this problem by loading the data at once. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v3 - v4: - None Changelog v2 - v3: - Fix the wrong return value of btrfs_bio_clone Changelog v1 - v2: - Remove the __GFP_ZERO flag in btrfs_submit_direct because it would trigger

[PATCH v4 11/11] Btrfs: cleanup the read failure record after write or when the inode is freeing

2014-09-12 Thread Miao Xie
the failure records will be left in the tree, we need free them when we free the inode or the memory leak happens. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v4: - None --- fs/btrfs/extent_io.c | 34 ++ fs/btrfs/extent_io.h | 1 + fs/btrfs/inode.c

[PATCH v4 06/11] Btrfs: split bio_readpage_error into several functions

2014-09-12 Thread Miao Xie
The data repair function of direct read will be implemented later, and some code in bio_readpage_error will be reused, so split bio_readpage_error into several functions which will be used in direct read repair later. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v4: - None

[PATCH v4 09/11] Btrfs: Set real mirror number for read operation on RAID0/5/6

2014-09-12 Thread Miao Xie
We need real mirror number for RAID0/5/6 when reading data, or if read error happens, we would pass 0 as the number of the mirror on which the io error happens. It is wrong and would cause the filesystem read the data from the corrupted mirror again. Signed-off-by: Miao Xie mi...@cn.fujitsu.com

[PATCH v2 03/10] Btrfs: fix wrong fsid check of scrub

2014-09-03 Thread Miao Xie
All the metadata in the seed devices has the same fsid as the fsid of the seed filesystem which is on the seed device, so we should check them by the current filesystem. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com Reviewed-by: David Sterba dste...@suse.cz --- Changelog v1 - v2: - Use

[PATCH v2 06/10] Btrfs: Fix the problem that the dirty flag of dev stats is cleared

2014-09-03 Thread Miao Xie
it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - Change the variant name and make some cleanup by David's comment --- fs/btrfs/volumes.c | 8 ++-- fs/btrfs/volumes.h | 16 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/fs/btrfs

Re: [PATCH v2 11/12] Btrfs: implement repair function when direct read fails

2014-09-03 Thread Miao Xie
On Tue, 2 Sep 2014 09:05:15 -0400, Chris Mason wrote: diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 08e65e9..56b1546 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -698,7 +719,12 @@ static void end_workqueue_bio(struct bio *bio, int err) fs_info =

[PATCH 02/18] Btrfs: cleanup double assignment of device-bytes_used when device replace finishes

2014-09-03 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/dev-replace.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index a85b5f5..10dfb41 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -550,7 +550,6 @@ static int

[PATCH 06/18] Btrfs: Fix wrong free_chunk_space assignment during removing a device

2014-09-03 Thread Miao Xie
During removing a device, we have modified free_chunk_space when we shrink the device, so we needn't assign a new value to it after the device shrink. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/btrfs

[PATCH 01/18] Btrfs: cleanup unused num_can_discard in fs_devices

2014-09-03 Thread Miao Xie
The member variants - num_can_discard - of fs_devices structure are set, but no one use them to do anything. so remove them. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 16 ++-- fs/btrfs/volumes.h | 1 - 2 files changed, 2 insertions(+), 15 deletions

[PATCH 4/5] Btrfs: restructure btrfs_get_bdev_and_sb and pick up some code used later

2014-09-03 Thread Miao Xie
Some code in btrfs_get_bdev_and_sb will be re-used by the other function later, so restructure btrfs_get_bdev_and_sb and pick up those code to make a new function. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 66 +- 1

[PATCH 03/18] Btrfs: fix unprotected assignment of the target device

2014-09-03 Thread Miao Xie
. And there is another merit that we can check if the target device is suitable more early. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/dev-replace.c | 32 fs/btrfs/volumes.c | 23 +++ fs/btrfs/volumes.h | 1 + 3 files changed

[PATCH 3/5] Btrfs: restructure btrfs_scan_one_device

2014-09-03 Thread Miao Xie
Some code in btrfs_scan_one_device will be re-used by the other function later, so restructure btrfs_scan_one_device and pick up those code to make a new function. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 57 +++--- 1

[PATCH 16/18] Btrfs: stop mounting the fs if the non-ENOENT errors happen when opening seed fs

2014-09-03 Thread Miao Xie
When we open a seed filesystem, if the degraded mount option is set, we continue to mount the fs if we don't find some devices in the seed filesystem. But we should stop mounting if other errors happen. Fix it Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 2 +- 1 file

[PATCH 14/18] Btrfs: fix use-after-free problem of the device during device replace

2014-09-03 Thread Miao Xie
this problem by locking uuid_mutex during destroying source device or target device, just like the device remove operation. It is a temporary solution, we can fix this problem and make the code more clear by atomic counter in the future. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs

[PATCH 08/18] Btrfs: update free_chunk_space during allocting a new chunk

2014-09-03 Thread Miao Xie
has be allocated as free space, and would use it to do overcommit reservation. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 45e0b5d..d8e4a3d

[PATCH 2/5] Btrfs: don't return btrfs_fs_devices if the caller doesn't want it

2014-09-03 Thread Miao Xie
We will implement the function that the filesystem scan all the devices in the system and build the device set for btrfs. In this case, we needn't get btrfs_fs_devices when adding a device into list. This patch changes device_add_list and implement this feature. Signed-off-by: Miao Xie mi

[PATCH 10/18] Btrfs: fix unprotected system chunk array insertion

2014-09-03 Thread Miao Xie
We didn't protect the system chunk array when we added a new system chunk into it, it would cause the array be corrupted if someone remove/add some system chunk into array at the same time. Fix it by chunk lock. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 7 ++- 1

[PATCH RFC 0/5] Scan all devices to build fs device list

2014-09-03 Thread Miao Xie
device list. --- Miao Xie (5): block: export disk_class and disk_type for btrfs Btrfs: don't return btrfs_fs_devices if the caller doesn't want it Btrfs: restructure btrfs_scan_one_device Btrfs: restructure btrfs_get_bdev_and_sb and pick up some code used later Btrfs: scan all

[PATCH 11/18] Btrfs: fix unprotected device list access when getting the fs information

2014-09-03 Thread Miao Xie
When we get the fs information, we forgot to acquire the mutex of device list, it might cause the problem we might access a device that was removed. Fix it by acquiring the device list mutex. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/super.c | 8 +++- 1 file changed, 7

  1   2   3   4   5   6   7   8   9   10   >