[PATCH 09/18] Btrfs: fix unprotected device's variants on 32bits machine

2014-09-03 Thread Miao Xie
-total_bytes,-disk_total_bytes,-bytes_used is protected by chunk lock when we change them, but sometimes we read them without any lock, and we might get unexpected value. We fix this problem like inode's i_size. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/dev-replace.c | 15

[PATCH 12/18] Btrfs: Fix misuse of chunk mutex

2014-09-03 Thread Miao Xie
. But at most place, we acquire chunk_mutex at first and then acquire device list mutex. We need change the lock order. - Some place we needn't acquire chunk_mutex. For example we needn't get chunk_mutex when we free a empty seed fs_devices structure. Signed-off-by: Miao Xie mi...@cn.fujitsu.com

[PATCH 04/18] Btrfs: fix wrong disk size when writing super blocks

2014-09-03 Thread Miao Xie
in the previous transaction to check if the super block is beyond the boundary of the device. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/check-integrity.c | 2 +- fs/btrfs/dev-replace.c | 18 ++ fs/btrfs/disk-io.c | 5 +++-- fs/btrfs/scrub.c

[PATCH 07/18] Btrfs: fix unprotected device-bytes_used update

2014-09-03 Thread Miao Xie
We should update device-bytes_used in the lock context of chunk_mutex, or we would get wrong data. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 1524b3f

[PATCH 05/18] Btrfs: fix wrong device bytes_used in the super block

2014-09-03 Thread Miao Xie
the size in the previous transaction to check if the super block is beyond the boundary of the device. Though it is not big problem because we don't use it now, but anyway it is better that we make it be consistent with the common metadata, maybe we will use it in the future. Signed-off-by: Miao

[PATCH 18/18] Btrfs: modify rw_devices counter under chunk_mutex context

2014-09-03 Thread Miao Xie
rw_devices counter is often used to tune the profile when doing chunk allocation, so we should modify it under the chunk_mutex context to avoid getting wrong chunk profile. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH 13/18] Btrfs: fix unprotected device list access when cloning fs devices

2014-09-03 Thread Miao Xie
which was being changed when we clone the fs devices. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 357f911..f0173b1 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs

[PATCH 5/5] Btrfs: scan all the devices and build the fs device list by btrfs's self

2014-09-03 Thread Miao Xie
register the disk into btrfs in time, the filesystem would report that can not open some device when mounting the filesystem, it was uncomfortable, this patch fixes this problem by scanning all the devices if we find the number of devices is not right when we mount the filesystem. Signed-off-by: Miao

[PATCH 1/5] block: export disk_class and disk_type for btrfs

2014-09-03 Thread Miao Xie
not mount the filesystem. So I want btrfs scan the system and find all the devices by itself in the kernel. In order to implement it, we need disk_class and disk_type, so export them. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- block/genhd.c | 7 +-- include/linux/genhd.h | 1 + 2

[PATCH 17/18] Btrfs: move the missing device to its own fs device list

2014-09-03 Thread Miao Xie
For a missing device, we don't know it belong to which fs before we read its fsid from the chunk tree. So we add them into the current fs device list at first. When we get its fsid, we should move them to their own fs device list. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs

[PATCH 15/18] Btrfs: make the logic of source device removing more clear

2014-09-03 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/dev-replace.c | 3 +-- fs/btrfs/volumes.c | 19 +++ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index e9cbbdb..6f662b3 100644 --- a/fs/btrfs/dev

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

2014-09-01 Thread Miao Xie
On Fri, 29 Aug 2014 14:31:48 -0400, Chris Mason wrote: On 07/29/2014 05:24 AM, Miao Xie wrote: This patch implement data repair function when direct read fails. The detail of the implementation is: - When we find the data is not right, we try to read the data from the other mirror

Re: [btrfs] 8d875f95: xfstests.generic.226.fail

2014-08-20 Thread Miao Xie
On Tue, 19 Aug 2014 10:58:09 -0400, Chris Mason wrote: On 08/19/2014 10:23 AM, David Sterba wrote: On Tue, Aug 19, 2014 at 07:58:20PM +0800, Fengguang Wu wrote: We noticed an xfstests failure on commit 8d875f95da43c6a8f18f77869f2ef26e9594fecc (btrfs: disable strict file flushes for renames

Re: fs_mark test on btrfs on 3.16.0-rc6+ #1 SMP

2014-08-18 Thread Miao Xie
On Mon, 18 Aug 2014 17:38:17 +, Ming Lei wrote: Hi, I ran the fs_mark test on a single empty hard drive. After the test, the df -h results are: /dev/sdk1 917G 39G 832G 5% /ext4 /dev/sdj1 932G 53G 850G 6% /btrfs The test result for btrfs shows it

Re: [PATCH v3] Btrfs: fix task hang under heavy compressed write

2014-08-16 Thread Miao Xie
On Fri, 15 Aug 2014 23:36:53 +0800, Liu Bo wrote: This has been reported and discussed for a long time, and this hang occurs in both 3.15 and 3.16. Btrfs now migrates to use kernel workqueue, but it introduces this hang problem. Btrfs has a kind of work queued as an ordered way, which

Re: [PATCH 4/4] btrfs: update sprout seed pointer when seed fs is relinquished

2014-08-12 Thread Miao Xie
like btrfs_rm_device? The other is OK. Reviewed-by: Miao Xie mi...@cn.fujitsu.com + } call_rcu(srcdev-rcu, free_device); } -- 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

Re: [PATCH 2/4] btrfs: replace seed device followed by unmount causes kernel WARNING

2014-08-12 Thread Miao Xie
it will point to the seed's local fs_devices. In short + * srcdev will have its correct fs_devices in both the cases. + */ + fs_devices = srcdev-fs_devices; Reviewed-by: Miao Xie mi...@cn.fujitsu.com list_del_rcu(srcdev-dev_list); list_del_rcu(srcdev

Re: [PATCH 3/4] btrfs: fix rw_devices miss match after seed replace

2014-08-12 Thread Miao Xie
On Mon, 11 Aug 2014 17:42:55 +0800, Anand Jain wrote: reproducer: reproducer: mount /dev/sdb /btrfs btrfs dev add /dev/sdc /btrfs btrfs rep start -B /dev/sdb /dev/sdd /btrfs umount /btrfs WARNING: CPU: 0 PID: 3882 at fs/btrfs/volumes.c:892

Re: [PATCH 1/4] btrfs: preparatory to make btrfs_rm_dev_replace_srcdev() seed aware

2014-08-12 Thread Miao Xie
Reviewed-by: Miao Xie mi...@cn.fujitsu.com -- 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/majordomo-info.html

Re: [PATCH] Btrfs: fix compressed write corruption on enospc

2014-08-11 Thread Miao Xie
On Sun, 10 Aug 2014 22:55:44 +0800, Liu Bo wrote: This part of the trace is relatively new because Liu Bo's patch made us redirty the pages, making it more likely that we'd try to write them during commit. But, at the end of the day we have a fundamental deadlock with committing a

Re: [PATCH v2 02/12] Btrfs: load checksum data once when submitting a direct read io

2014-08-08 Thread Miao Xie
On Fri, 8 Aug 2014 01:32:00 +0100, Filipe David Manana wrote: On Tue, Jul 29, 2014 at 10:24 AM, Miao Xie mi...@cn.fujitsu.com wrote: The current code would load checksum data for several times when we split a whole direct read io because of the limit of the raid stripe, it would make us search

[PATCH v3 02/12] Btrfs: load checksum data once when submitting a direct read io

2014-08-08 Thread Miao Xie
improves this problem by loading the data at once. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- 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 a WARNing. It is reported

Re: [PATCH] Btrfs: fix compressed write corruption on enospc

2014-08-07 Thread Miao Xie
On Thu, 7 Aug 2014 15:50:30 +0800, Liu Bo wrote: [90496.156016] kworker/u8:14 D 880044e38540 0 21050 2 0x [90496.157683] Workqueue: btrfs-delalloc normal_work_helper [btrfs] [90496.159320] 88022880f990 0002 880407f649b0 88022880ffd8

Re: [PATCH] btrfs: replace seed device followed by unmount causes kernel WARNING

2014-07-30 Thread Miao Xie
On Fri, 25 Jul 2014 20:33:34 +0800, Anand Jain wrote: After the seed device has been replaced the new target device is no more a seed device. So we need to bring that state in the fs_devices. reproducer: mount /dev/sdb /btrfs btrfs dev add /dev/sdc /btrfs btrfs rep start -B /dev/sdb

[PATCH v2 09/12] Btrfs: modify clean_io_failure and make it suit direct io

2014-07-29 Thread Miao Xie
-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1-v2: - None --- fs/btrfs/extent_io.c | 31 +++ fs/btrfs/extent_io.h | 6 +++--- fs/btrfs/scrub.c | 3 +-- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c

[PATCH v2 00/12] Implement the data repair function for direct read

2014-07-29 Thread Miao Xie
https://github.com/miaoxie/linux-btrfs.git for-Chris Thanks Miao --- Miao Xie (12): Btrfs: fix put dio bio twice when we submit dio bio fail 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

[PATCH v2 03/12] Btrfs: cleanup similar code of the buffered data data check and dio read data check

2014-07-29 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1-v2: - 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 fd88126..2e261b1 100644 --- a/fs

[PATCH v2 08/12] Btrfs: modify repair_io_failure and make it suit direct io

2014-07-29 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-v2: - None --- fs/btrfs/extent_io.c | 8 +--- fs/btrfs/extent_io.h | 2 +- fs/btrfs

[PATCH v2 01/12] Btrfs: fix put dio bio twice when we submit dio bio fail

2014-07-29 Thread Miao Xie
The caller of btrfs_submit_direct_hook() will put the original dio bio when btrfs_submit_direct_hook() return a error number, so we needn't put the original bio in btrfs_submit_direct_hook(). Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1-v2: - None --- fs/btrfs/inode.c | 5

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

2014-07-29 Thread Miao Xie
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 v1-v2: - None --- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs

[PATCH v2 02/12] Btrfs: load checksum data once when submitting a direct read io

2014-07-29 Thread Miao Xie
improves this problem by loading the data at once. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - Remove the __GFP_ZERO flag in btrfs_submit_direct because it would trigger a WARNing. It is reported by Filipe David Manana, Thanks. --- fs/btrfs/btrfs_inode.h | 1 - fs

[PATCH v2 05/12] Btrfs: fix missing error handler if submiting re-read bio fails

2014-07-29 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-v2: - 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 v2 12/12] Btrfs: cleanup the read failure record after write or when the inode is freeing

2014-07-29 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-v2: - None --- fs/btrfs/extent_io.c | 34 ++ fs/btrfs/extent_io.h | 1 + fs/btrfs/inode.c

[PATCH v2 06/12] Btrfs: Cleanup unused variant and argument of IO failure handlers

2014-07-29 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1-v2: - 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 fb00736..f71b34f 100644 --- a/fs/btrfs/extent_io.c

[PATCH v2 04/12] Btrfs: do file data check by sub-bio's self

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

[PATCH v2 07/12] Btrfs: split bio_readpage_error into several functions

2014-07-29 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-v2: - None

Re: [PATCH 02/12] Btrfs: load checksum data once when submitting a direct read io

2014-07-28 Thread Miao Xie
On Mon, 28 Jul 2014 18:24:47 +0100, Filipe David Manana wrote: On Sat, Jun 28, 2014 at 12:34 PM, Miao Xie mi...@cn.fujitsu.com wrote: The current code would load checksum data for several times when we split a whole direct read io because of the limit of the raid stripe, it would make us

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

2014-07-23 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 --- fs/btrfs/scrub.c | 18 +- 1 file changed, 13

[PATCH 08/10] Btrfs: Fix wrong device size when we are resizing the device

2014-07-23 Thread Miao Xie
that on-disk metadata of the devices was not consistent. We should use the other variant named disk_total_bytes to update the on-disk metadata of device, because that variant is updated only when the resize operation is successful. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/disk

[PATCH 07/10] Btrfs: update the comment of total_bytes and disk_total_bytes of btrfs_devie

2014-07-23 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 0defd23..90d4fa8 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -64,10 +64,10 @@ struct

[PATCH 02/10] Btrfs: don't write any data into a readonly device when scrub

2014-07-23 Thread Miao Xie
We should not write data into a readonly device especially seed device when doing scrub, skip those devices. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/scrub.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index b6d198f

[PATCH 04/10] Btrfs: fix wrong generation check of super block on a seed device

2014-07-23 Thread Miao Xie
on the seed devices, Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/scrub.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 9a81874e..98b9f8e 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -2835,7

[PATCH 01/10] Btrfs: Fix the problem that the replace destroys the seed filesystem

2014-07-23 Thread Miao Xie
erase the super block on the seed device. It is wrong, we should not change anything on the seed device. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index

[PATCH 09/10] Btrfs: don't consider the missing device when allocating new chunks

2014-07-23 Thread Miao Xie
, and want to allocate new chunks with higher RAID level, we will fail becaue we don't have enough writable device. Fix it by ignoring the number of missing devices when allocating new chunks. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent-tree.c | 16 ++-- 1 file changed

[PATCH 05/10] Btrfs: make the device lock and its protected data in the same cacheline

2014-07-23 Thread Miao Xie
The lock in btrfs_device structure was far away from its protected data, it would make CPU load the cache line twice when we accessed them, move them together. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.h | 25 - 1 file changed, 12 insertions

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

2014-07-23 Thread Miao Xie
it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 7 +-- fs/btrfs/volumes.h | 19 +++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 19188df..0d37746 100644 --- a/fs/btrfs/volumes.c +++ b/fs

[PATCH 10/10] Btrfs: cleanup unused latest_devid and latest_trans in fs_devices

2014-07-23 Thread Miao Xie
The member variants - latest_devid and latest_trans - 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 | 42 +++--- fs/btrfs/volumes.h | 3 --- 2 files

Re: [PATCH v2] Btrfs: fix abnormal long waiting in fsync

2014-07-16 Thread Miao Xie
, + ordered-file_offset, + ordered-file_offset + ordered-len - 1); I can use bytes_left to filter the ordered extents that have been written out. The other is OK. Reviewed-by: Miao Xie mi...@cn.fujitsu.com + wait_event(ordered-wait, test_bit

[PATCH 1/2] Btrfs: fix wrong missing device counter decrease

2014-07-16 Thread Miao Xie
should decrease the counter of its own fs device. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- This patch is against: [PATCH 8/9] Btrfs: fix unzeroed members in fs_devices when creating a fs from seed fs --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 2/2] Btrfs: fix wrong total device counter after removing a seed device

2014-07-16 Thread Miao Xie
The total device counters of all the descendant filesystem account the seed device, so after removing a seed device, we need decrease all those counters. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff

Re: [PATCH 1/2] Btrfs: fix wrong missing device counter decrease

2014-07-16 Thread Miao Xie
On Thu, 17 Jul 2014 10:37:57 +0800, Liu Bo wrote: On Wed, Jul 16, 2014 at 06:38:01PM +0800, Miao Xie wrote: The missing devices are accounted by its own fs device, for example the missing devices in seed filesystem will be accounted by the fs device of the seed filesystem, not by the new

Re: [PATCH 2/2] Btrfs: fix wrong total device counter after removing a seed device

2014-07-16 Thread Miao Xie
Please ignore this patch, the fix is not right. Thanks Miao On Wed, 16 Jul 2014 18:38:37 +0800, Miao Xie wrote: The total device counters of all the descendant filesystem account the seed device, so after removing a seed device, we need decrease all those counters. Signed-off-by: Miao Xie

Re: [PATCH] Btrfs: fix abnormal long waiting in fsync

2014-07-15 Thread Miao Xie
On Tue, 15 Jul 2014 17:31:14 +0800, Liu Bo wrote: xfstests generic/127 detected this problem. With commit 7fc34a62ca4434a79c68e23e70ed26111b7a4cf8, now fsync will only flush data within the passed range. This is the cause of the above problem, -- btrfs's fsync has a stage called 'sync

Re: [PATCH 2/4] btrfs-progs: Integrate error message output into find_mount_root().

2014-07-10 Thread Miao Xie
Takeuchi-san On Thu, 10 Jul 2014 16:33:23 +0900, Satoru Takeuchi wrote: (2014/07/10 12:05), Qu Wenruo wrote: Before this patch, find_mount_root() and the caller both output error message, which sometimes make the output duplicated and hard to judge what the problem is. This pathh will

Re: [PATCH V2 7/9] btrfs: fix null pointer dereference in clone_fs_devices when name is null

2014-07-07 Thread Miao Xie
On Mon, 7 Jul 2014 17:56:13 +0800, Anand Jain wrote: On 07/07/2014 12:22, Miao Xie wrote: On Mon, 7 Jul 2014 12:04:09 +0800, Anand Jain wrote: when one of the device path is missing btrfs_device name is null. So this patch will check for that. stack: BUG: unable to handle kernel NULL

Re: [PATCH RFC] btrfs: code optimize use btrfs_get_bdev_and_sb() at btrfs_scan_one_device

2014-07-07 Thread Miao Xie
On Tue, 8 Jul 2014 02:38:37 +0800, Anand Jain wrote: (for review comments pls). btrfs_scan_one_device() needs SB, instead of doing it from scratch could use btrfs_get_bdev_and_sb() Signed-off-by: Anand Jain anand.j...@oracle.com --- fs/btrfs/volumes.c | 51

Re: [PATCH RFC] btrfs: code optimize use btrfs_get_bdev_and_sb() at btrfs_scan_one_device

2014-07-07 Thread Miao Xie
On Tue, 8 Jul 2014 12:08:19 +0800, Liu Bo wrote: On Tue, Jul 08, 2014 at 02:38:37AM +0800, Anand Jain wrote: (for review comments pls). btrfs_scan_one_device() needs SB, instead of doing it from scratch could use btrfs_get_bdev_and_sb() Signed-off-by: Anand Jain anand.j...@oracle.com ---

Re: [PATCH 1/2] btrfs: fix null pointer dereference in clone_fs_devices when name is null

2014-07-06 Thread Miao Xie
, Miao Xie wrote: On Mon, 30 Jun 2014 23:06:54 +0800, Anand Jain wrote: The primary reason of this problem is that we didn't scan the system and find all the devices in the filesystem, if we scan the system, we can mount the filesystem successfully, needn't mount it with degraded option. so I

Re: [PATCH V2 7/9] btrfs: fix null pointer dereference in clone_fs_devices when name is null

2014-07-06 Thread Miao Xie
Signed-off-by: Anand Jain anand.j...@oracle.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1-v2: - Fix the problem that we forgot to set the missing flag for the cloned device --- fs/btrfs/volumes.c | 25 - 1 file changed, 16 insertions(+), 9

Re: [PATCH v2] Btrfs: fix crash when starting transaction

2014-07-03 Thread Miao Xie
f5 [25405.18] RIP [a03570ca] assfail.constprop.88+0x1e/0x20 [btrfs] Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Removed test for current-journal_info == NULL. At this point it's always expected to be NULL. Reviewed-by: Miao Xie mi

[PATCH V4 1/9] Btrfs: device_list_add() should not update list when mounted

2014-07-03 Thread Miao Xie
] github.com/anajain/devmgt.git Signed-off-by: Anand Jain anand.j...@oracle.com Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v3-v4: - Fix the over-80-charactor problem --- fs/btrfs/volumes.c | 27 +++ 1

[PATCH RESEND 3/9] Btrfs: make defragment work with nodatacow option

2014-07-03 Thread Miao Xie
setting. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/btrfs_inode.h | 6 ++ fs/btrfs/inode.c | 39 --- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/fs/btrfs

[PATCH RESEND 6/9] Btrfs: cleanup the read failure record after write or when the inode is freeing

2014-07-03 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 --- fs/btrfs/extent_io.c | 34 ++ fs/btrfs/extent_io.h | 1 + fs/btrfs/inode.c | 6 ++ 3 files changed

[PATCH RESEND 5/9] Btrfs: fix missing error handler if submiting re-read bio fails

2014-07-03 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 --- 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 23398ad..3a64354 100644 --- a/fs

[PATCH 9/9] Btrfs: fix writing data into the seed filesystem

2014-07-03 Thread Miao Xie
-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 52 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 73a82e5..daecfa5 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs

[PATCH RESEND 4/9] Btrfs: fix put dio bio twice when we submit dio bio fail

2014-07-03 Thread Miao Xie
The caller of btrfs_submit_direct_hook() will put the original dio bio when btrfs_submit_direct_hook() return a error number, so we needn't put the original bio in btrfs_submit_direct_hook(). Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c | 5 ++--- 1 file changed, 2

[PATCH V2 7/9] btrfs: fix null pointer dereference in clone_fs_devices when name is null

2014-07-03 Thread Miao Xie
...@oracle.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1-v2: - Fix the problem that we forgot to set the missing flag for the cloned device --- fs/btrfs/volumes.c | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs

[PATCH 8/9] Btrfs: fix unzeroed members in fs_devices when creating a fs from seed fs

2014-07-03 Thread Miao Xie
We forgot to zero some members in fs_devices when we create new fs_devices from the one of the seed fs. It would cause the problem that we got wrong chunk profile when allocating chunks. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 3 +++ 1 file changed, 3

[PATCH V2 2/9] btrfs: check generation as replace duplicates devid+uuid

2014-07-03 Thread Miao Xie
wangsl.f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1-v2: - Fix the over-80-charactor problem and unreasonable error number --- fs/btrfs/volumes.c | 22 +- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs

Re: [PATCH v2] Btrfs: fix crash when starting transaction

2014-07-03 Thread Miao Xie
On Thu, 3 Jul 2014 19:32:18 +0900, Satoru Takeuchi wrote: (2014/07/03 17:30), Miao Xie wrote: On Tue, 24 Jun 2014 17:46:58 +0100, Filipe David Borba Manana wrote: Often when starting a transaction we commit the currently running transaction, which can end up writing block group caches when

Re: [PATCH] Btrfs: fix wrong uevent target

2014-07-03 Thread Miao Xie
CC Anand Jain Sorry, please ignore this patch. Anand wrote the same patch several days ago, so this bug fix belongs to Anand though he NACKed his patch at that time. Thanks Miao On Wed, 2 Jul 2014 17:03:54 +0800, Miao Xie wrote: block_device's bd_disk points to the disk, not the object which

[PATCH] Btrfs: fix wrong uevent target

2014-07-02 Thread Miao Xie
block_device's bd_disk points to the disk, not the object which block_device is actually corresponding to(the whole disk or a partition), so we would send uevent to the wrong target. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion

Re: [PATCH v4] Btrfs: fix race of using total_bytes_pinned

2014-07-02 Thread Miao Xie
in btrfs_check_data_free_space. v3: Really account the percpu pinned number when unpin, instead of zeroing it out, as we set transaction with UNBLOCKED before 'unpin', zeroing it out may end up with messing percpu pinned number(suggested by Miao). v2: Add missing brakets for if statement Reviewed-by: Miao

Re: build failure with mason/for-linus tree

2014-07-02 Thread Miao Xie
On Wed, 2 Jul 2014 08:41:54 +0900, Satoru Takeuchi wrote: Hi Chris, (2014/07/01 23:30), Chris Mason wrote: On 07/01/2014 01:43 AM, Satoru Takeuchi wrote: Hi Chris, FYI, today I failed to build mason/for-linus tree as follows. You were building for 3.15? I just run the following

Re: [PATCH v3] Btrfs: fix race of using total_bytes_pinned

2014-07-01 Thread Miao Xie
On Tue, 1 Jul 2014 17:28:46 +0800, Liu Bo wrote: This percpu counter @total_bytes_pinned is introduced to skip unnecessary operations of 'commit transaction', it accounts for those space we may free but are stuck in delayed refs. And we zero out @space_info-total_bytes_pinned every

Re: [PATCH 1/2] btrfs: fix null pointer dereference in clone_fs_devices when name is null

2014-07-01 Thread Miao Xie
On Mon, 30 Jun 2014 23:06:54 +0800, Anand Jain wrote: The primary reason of this problem is that we didn't scan the system and find all the devices in the filesystem, if we scan the system, we can mount the filesystem successfully, needn't mount it with degraded option. so I think the right

Re: [PATCH 1/2] btrfs: fix null pointer dereference in clone_fs_devices when name is null

2014-06-30 Thread Miao Xie
On Mon, 30 Jun 2014 17:12:47 +0800, Anand Jain wrote: when one of the device path is missing btrfs_device name is null. So this patch will check for that. stack: BUG: unable to handle kernel NULL pointer dereference at 0010 IP: [812e18c0] strlen+0x0/0x30

Re: [PATCH v2] Btrfs: fix race of using total_bytes_pinned

2014-06-30 Thread Miao Xie
On Mon, 30 Jun 2014 18:46:07 +0800, Liu Bo wrote: This percpu counter @total_bytes_pinned is introduced to skip unnecessary operations of 'commit transaction', it accounts for those space we may free but are stuck in delayed refs. And we zero out @space_info-total_bytes_pinned every

[PATCH 03/12] Btrfs: cleanup similar code of the buffered data data check and dio read data check

2014-06-28 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- 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 969fb22..962defb 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs

[PATCH 06/12] Btrfs: Cleanup unused variant and argument of IO failure handlers

2014-06-28 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- 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 c49c1e1..b6b391e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c

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

2014-06-28 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 --- fs/btrfs/extent_io.c | 34 ++ fs/btrfs/extent_io.h | 1 + fs/btrfs/inode.c | 6 ++ 3 files changed

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

2014-06-28 Thread Miao Xie
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 --- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/disk-io.c | 43

[PATCH 05/12] Btrfs: fix missing error handler if submiting re-read bio fails

2014-06-28 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 --- 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 5ac43b4..c49c1e1 100644 --- a/fs

[PATCH 08/12] Btrfs: modify repair_io_failure and make it suit direct io

2014-06-28 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 --- fs/btrfs/extent_io.c | 8 +--- fs/btrfs/extent_io.h | 2 +- fs/btrfs/scrub.c | 1 + 3 files

[PATCH 02/12] Btrfs: load checksum data once when submitting a direct read io

2014-06-28 Thread Miao Xie
improves this problem by loading the data at once. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/btrfs_inode.h | 1 - fs/btrfs/ctree.h | 3 +-- fs/btrfs/file-item.c | 14 ++ fs/btrfs/inode.c | 40 ++-- 4 files changed, 25

[PATCH 07/12] Btrfs: split bio_readpage_error into several functions

2014-06-28 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 --- fs/btrfs/extent_io.c | 159

Re: [PATCH] Btrfs: Refactor btrfs_lock_cluster() to kill compiler warning

2014-06-23 Thread Miao Xie
block not processed during the first iteration of the loop to the end of the loop, which allows to kill the locked variable, Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org Looks good to me. Reviewed-and-Tested-by: Miao Xie mi...@cn.fujitsu.com --- Please review, compile tested

[PATCH 0/7] random bugfixes

2014-06-18 Thread Miao Xie
Thanks Miao --- Miao Xie (5): Btrfs: make free space cache write out functions more readable Btrfs: fix broken free space cache after the system crashed Btrfs: use bio_endio_nodec instead of open code Btrfs: fix deadlock when mounting a degraded fs Btrfs: fix wrong error handle when

[PATCH 5/7] Btrfs: use bio_endio_nodec instead of open code

2014-06-18 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 19c298a..31f9036 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -5399,12 +5399,6 @@ static

[PATCH 1/7] Btrfs: make free space cache write out functions more readable

2014-06-18 Thread Miao Xie
This patch makes the free space cache write out functions more readable, and beisdes that, it also reduces the stack space that the function -- __btrfs_write_out_cache uses from 194bytes to 144bytes. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c | 159

[PATCH RESEND 3/7] btrfs: Skip scrubbing removed chunks to avoid -ENOENT.

2014-06-18 Thread Miao Xie
, -ENOENT will be returned. However, there is no need to stop scrubbing since other chunks may be scrubbed without problem. So this patch changes the behavior to skip removed chunks and continue to scrub the rest. Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com Signed-off-by: Miao Xie mi

[PATCH 6/7] Btrfs: fix deadlock when mounting a degraded fs

2014-06-18 Thread Miao Xie
will set the flag, and we increase bi_remaining counter, or we don't. Though there is another way to fix it -- decrease bi_remaining counter of the original bio when we make sure the original bio is not submitted, this method need add more check and is easy to make mistake. Signed-off-by: Miao Xie

[PATCH 7/7] Btrfs: fix wrong error handle when the device is missing or is not writeable

2014-06-18 Thread Miao Xie
The original bio might be submitted, so we shoud increase bi_remaining to account for it when we deal with the error that the device is missing or is not writeable, or we would skip the endio handle. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/volumes.c | 22

[PATCH V3 2/7] Btrfs: fix broken free space cache after the system crashed

2014-06-18 Thread Miao Xie
the size of that allocated space. Besides that, we also introduce a per-block-group read-write semaphore to avoid the race between the allocation and the free space cache write out. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v2 - v3: - Fix memory leak of the block group because we grab

[PATCH RESEND 4/7] Btrfs: fix NULL pointer crash when running balance and scrub concurrently

2014-06-18 Thread Miao Xie
count. Reported-by: Qu Wenruo quwen...@cn.fujitsu.com Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent_map.c | 2 ++ fs/btrfs/extent_map.h | 1 + fs/btrfs/volumes.c| 10 +++--- 3 files changed, 6 insertions(+), 7

Re: [PATCH V2 10/10] Btrfs: reclaim the reserved metadata space at background

2014-05-07 Thread Miao Xie
On Mon, 10 Mar 2014 09:35:13 -0400, Josef Bacik wrote: On 03/06/2014 12:55 AM, Miao Xie wrote: Before applying this patch, the task had to reclaim the metadata space by itself if the metadata space was not enough. And When the task started the space reclamation, all the other tasks which

[PATCH V3] Btrfs: reclaim the reserved metadata space at background

2014-05-07 Thread Miao Xie
avg 5.29 seconds (user 0.34s sys 4.34s) Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v2 - v3: - change the condition that the background reclaimation starts. --- fs/btrfs/ctree.h | 6 +++ fs/btrfs/disk-io.c | 3 ++ fs/btrfs/extent-tree.c | 105

[PATCH V2 1/2] Btrfs: output warning instead of error when loading free space cache failed

2014-04-23 Thread Miao Xie
If we fail to load a free space cache, we can rebuild it from the extent tree, so it is not a serious error, we should not output a error message that would make the users uncomfortable. This patch uses warning message instead of it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1

[PATCH V2 2/2] Btrfs: fix broken free space cache after the system crashed

2014-04-23 Thread Miao Xie
the size of that allocated space. Besides that, we also introduce a per-block-group read-write semaphore to avoid the race between the allocation and the free space cache write out. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2 - use the other method to fix the problem. --- fs

Re: [PATCH 4/9] Btrfs: use bitfield instead of integer data type for the some variants in btrfs_root

2014-03-09 Thread Miao Xie
On Fri, 7 Mar 2014 19:00:08 -0500, Josef Bacik wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/20/2014 05:08 AM, Miao Xie wrote: Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.c | 25 ++--- fs/btrfs/ctree.h | 39

<    1   2   3   4   5   6   7   8   9   10   >