[PATCH 1/5] Btrfs: don't abort the current transaction if there is no enough space for inode cache

2013-05-13 Thread Miao Xie
this problem. So we need not abort the current transaction. Reported-by: Tsutomu Itoh t-i...@jp.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode-map.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index d26f67a

[PATCH 4/5] Btrfs: don't steal the reserved space from the global reserve if their space type is different

2013-05-13 Thread Miao Xie
If the type of the space we need is different with the global reserve, we can not steal the space from the global reserve, because we can not allocate the space from the free space cache that the global reserve points to. Cc: Tsutomu Itoh t-i...@jp.fujitsu.com Signed-off-by: Miao Xie mi

[PATCH 2/5] Btrfs: don't use global block reservation for inode cache truncation

2013-05-13 Thread Miao Xie
by ourselves. Cc: Tsutomu Itoh t-i...@jp.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent-tree.c | 5 + fs/btrfs/free-space-cache.c | 39 +++ fs/btrfs/free-space-cache.h | 2 ++ fs/btrfs/inode-map.c| 5 +++-- fs/btrfs

[PATCH 5/5] Btrfs: update the global reserve if it is empty

2013-05-13 Thread Miao Xie
the global reserve and fill it. Cc: Tsutomu Itoh t-i...@jp.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent-tree.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index c48e1bd..c75fe11 100644

[PATCH 3/5] Btrfs: optimize the error handle of use_block_rsv()

2013-05-13 Thread Miao Xie
cc: Tsutomu Itoh t-i...@jp.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent-tree.c | 65 ++ 1 file changed, 28 insertions(+), 37 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 43afa77

Re: [PATCH v3] btrfs: clean snapshots one by one

2013-05-14 Thread Miao Xie
On tue, 7 May 2013 13:54:49 +0200, David Sterba wrote: On Mon, May 06, 2013 at 08:41:06PM -0400, Chris Mason wrote: diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 988b860..4de2351 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1690,15 +1690,19 @@ static int

[PATCH 1/4] Btrfs: remove unnecessary -s_umount in cleaner_kthread()

2013-05-14 Thread Miao Xie
-s_umount in cleaner_kthread(). Cc: David Sterba dste...@suse.cz Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/disk-io.c | 40 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index a9df562

[PATCH 3/4] Btrfs: move the R/O check out of btrfs_clean_one_deleted_snapshot()

2013-05-14 Thread Miao Xie
If the fs is remounted to be R/O, it is unnecessary to call btrfs_clean_one_deleted_snapshot(), so move the R/O check out of this function. And besides that, it can make the check logic in the caller more clear. Cc: David Sterba dste...@suse.cz Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs

[PATCH 2/4] Btrfs: make the cleaner complete early when the fs is going to be umounted

2013-05-14 Thread Miao Xie
Cc: David Sterba dste...@suse.cz Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/disk-io.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index cb2bfd1..927da1a 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk

[PATCH 4/4] Btrfs: make the snap/subv deletion end more early when the fs is R/O

2013-05-14 Thread Miao Xie
The snapshot/subvolume deletion might spend lots of time, it would make the remount task wait for a long time. This patch improve this problem, we will break the deletion if the fs is remounted to be R/O. It will make the users happy. Cc: David Sterba dste...@suse.cz Signed-off-by: Miao Xie mi

Re: [PATCH 1/4] Btrfs: remove unnecessary -s_umount in cleaner_kthread()

2013-05-14 Thread Miao Xie
On tue, 14 May 2013 18:20:40 +0800, Miao Xie wrote: In order to avoid the R/O remount, we acquired -s_umount lock during we deleted the dead snapshots and subvolumes. But it is unnecessary, because we have cleaner_mutex. We use cleaner_mutex to protect the process of the dead snapshots

[PATCH 01/17] Btrfs: fix accessing a freed tree root

2013-05-15 Thread Miao Xie
inode_tree_del() will move the tree root into the dead root list, and then the tree will be destroyed by the cleaner. So if we remove the delayed node which is cached in the inode after inode_tree_del(), we may access a freed tree root. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs

[PATCH 02/17] Btrfs: fix unprotected root node of the subvolume's inode rb-tree

2013-05-15 Thread Miao Xie
The root node of the rb-tree may be changed, so we should get it under the lock. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 7f6e78a..bf5c399 100644

[PATCH 07/17] Btrfs: don't invoke btrfs_invalidate_inodes() in the spin lock context

2013-05-15 Thread Miao Xie
btrfs_invalidate_inodes() may sleep, so we should not invoke it in the spin lock context. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/disk-io.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 642c861..724a0da 100644

[PATCH 08/17] Btrfs: introduce per-subvolume delalloc inode list

2013-05-15 Thread Miao Xie
When we create a snapshot, we need flush all delalloc inodes in the fs, just flushing the inodes in the source tree is OK. So we introduce per-subvolume delalloc inode list. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 22 --- fs/btrfs/dev-replace.c | 2 +- fs

[PATCH 05/17] Btrfs: cleanup the similar code of the fs root read

2013-05-15 Thread Miao Xie
it is unnecessary to check the orphan item again. So cleanup it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 6 +- fs/btrfs/disk-io.c | 282 + fs/btrfs/disk-io.h | 11 +- fs/btrfs/extent-tree.c | 6 +- fs

[PATCH 14/17] Btrfs: don't flush the delalloc inodes in the while loop if flushoncommit is set

2013-05-15 Thread Miao Xie
It is unnecessary to flush the delalloc inodes again and again because we don't care the dirty pages which are introduced after the flush, and they will be flush in the transaction commit. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c | 26 ++ 1

[PATCH 16/17] Btrfs: remove the time check in btrfs_commit_transaction()

2013-05-15 Thread Miao Xie
, such as snapshot creation, btrfs doesn't commit the transaction on its own initiative. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c | 29 ++--- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs

[PATCH 13/17] Btrfs: don't wait for all the writers circularly during the transaction commit

2013-05-15 Thread Miao Xie
. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c | 55 ++ fs/btrfs/transaction.h | 31 2 files changed, 65 insertions(+), 21 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c

[PATCH 17/17] Btrfs: make the state of the transaction more readable

2013-05-15 Thread Miao Xie
| __TRANS_JOIN_NOLOCK), } it is very intuitionistic. Besides that, because we remove -in_commit in transaction structure, so the lock -commit_lock which was used to protect it is unnecessary, remove -commit_lock. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 1 - fs/btrfs/disk

[PATCH 12/17] Btrfs: remove the code for the impossible case in cleanup_transaction()

2013-05-15 Thread Miao Xie
If the transaction is removed from the transaction list, it means the transaction has been committed successfully. So it is impossible to call cleanup_transaction(), otherwise there is something wrong with the code logic. Thus, we use BUG_ON() instead of the original handle. Signed-off-by: Miao

[PATCH 03/17] Btrfs: pause the space balance when remounting to R/O

2013-05-15 Thread Miao Xie
Signed-off-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 a4807ce..f0857e0 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1263,6 +1263,7 @@ static int btrfs_remount(struct super_block

[PATCH 10/17] Btrfs: just flush the delalloc inodes in the source tree before snapshot creation

2013-05-15 Thread Miao Xie
just flush the delalloc inodes that in the source trees before snapshot creation, so the transaction commit will complete quickly. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 6 ++ fs/btrfs/transaction.c | 10 +- 2 files changed, 7 insertions(+), 9

[PATCH 09/17] Btrfs: introduce per-subvolume ordered extent list

2013-05-15 Thread Miao Xie
The reason we introduce per-subvolume ordered extent list is the same as the per-subvolume delalloc inode list. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h| 25 --- fs/btrfs/dev-replace.c | 4 +- fs/btrfs/disk-io.c | 45 +++- fs

[PATCH 11/17] Btrfs: cleanup unnecessary assignment when cleaning up all the residual transaction

2013-05-15 Thread Miao Xie
a residual transaction. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/disk-io.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 44d5a86..6bb3f3d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3992,7

[PATCH 04/17] Btrfs: remove BUG_ON() in btrfs_read_fs_tree_no_radix()

2013-05-15 Thread Miao Xie
We have checked if -node is NULL or not, so it is unnecessary to use BUG_ON() to check again. Remove it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/disk-io.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 2a9ae38..8c1e4fb 100644

[PATCH 15/17] Btrfs: remove unnecessary varient -num_joined in btrfs_transaction structure

2013-05-15 Thread Miao Xie
is sleeping. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c | 8 +--- fs/btrfs/transaction.h | 2 -- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 265db57..75e7b15 100644 --- a/fs/btrfs/transaction.c

[PATCH 00/17] improve the block time during the transaction commit

2013-05-15 Thread Miao Xie
extent list, which can reduce the flush time when we create snapshots. - 0013-0016 improve the block time during the transaction commit by removing the while loop at the beginning of the transaction commit. - 0017 improves the readability of the code. Miao Xie (17): Btrfs: fix accessing a freed

[PATCH 06/17] Btrfs: introduce grab/put functions for the root of the fs/file tree

2013-05-15 Thread Miao Xie
The grab/put funtions will be used in the next patch, which need grab the root object and ensure it is not freed. We use reference counter instead of the srcu lock is to aovid blocking the memory reclaim task, which invokes synchronize_srcu(). Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs

Re: [PATCH 10/17] Btrfs: just flush the delalloc inodes in the source tree before snapshot creation

2013-05-15 Thread Miao Xie
On Thu, 16 May 2013 11:20:39 +0800, Liu Bo wrote: On Wed, May 15, 2013 at 03:48:24PM +0800, Miao Xie wrote: Before applying this patch, we need flush all the delalloc inodes in the fs when we want to create a snapshot, it wastes time, and make the transaction commit be blocked for a long time

Re: [PATCH 06/17] Btrfs: introduce grab/put functions for the root of the fs/file tree

2013-05-15 Thread Miao Xie
On thu, 16 May 2013 11:36:46 +0800, Liu Bo wrote: On Wed, May 15, 2013 at 03:48:20PM +0800, Miao Xie wrote: The grab/put funtions will be used in the next patch, which need grab the root object and ensure it is not freed. We use reference counter instead of the srcu lock is to aovid blocking

Re: [PATCH 06/17] Btrfs: introduce grab/put functions for the root of the fs/file tree

2013-05-15 Thread Miao Xie
On Thu, 16 May 2013 13:15:57 +0800, Liu Bo wrote: On Thu, May 16, 2013 at 12:31:11PM +0800, Miao Xie wrote: On thu, 16 May 2013 11:36:46 +0800, Liu Bo wrote: On Wed, May 15, 2013 at 03:48:20PM +0800, Miao Xie wrote: The grab/put funtions will be used in the next patch, which need grab

Re: [PATCH 06/17] Btrfs: introduce grab/put functions for the root of the fs/file tree

2013-05-16 Thread Miao Xie
On thu, 16 May 2013 14:15:52 +0800, Liu Bo wrote: On Thu, May 16, 2013 at 01:34:11PM +0800, Miao Xie wrote: On Thu, 16 May 2013 13:15:57 +0800, Liu Bo wrote: On Thu, May 16, 2013 at 12:31:11PM +0800, Miao Xie wrote: On thu, 16 May 2013 11:36:46 +0800, Liu Bo wrote: On Wed, May 15, 2013 at 03

Re: [PATCH 06/17] Btrfs: introduce grab/put functions for the root of the fs/file tree

2013-05-16 Thread Miao Xie
On thu, 16 May 2013 22:57:07 +0800, Liu Bo wrote: On Thu, May 16, 2013 at 10:34:55AM -0400, Chris Mason wrote: Quoting Liu Bo (2013-05-16 10:31:39) On Thu, May 16, 2013 at 07:54:17AM -0400, Chris Mason wrote: Quoting Miao Xie (2013-05-16 03:22:37) I must say that the patch itself looks

[PATCH V2 17/17] Btrfs: make the state of the transaction more readable

2013-05-16 Thread Miao Xie
| __TRANS_JOIN_NOLOCK), } it is very intuitionistic. Besides that, because we remove -in_commit in transaction structure, so the lock -commit_lock which was used to protect it is unnecessary, remove -commit_lock. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - remove the misuse

Re: [PATCH -next] Btrfs: return error code in btrfs_check_trunc_cache_free_space()

2013-05-21 Thread Miao Xie
block reservation for inode cache truncation) Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn Thanks for your fix. Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/free-space

[PATCH] Btrfs: merge pending IO for tree log write back

2013-05-28 Thread Miao Xie
went up ~60%(2.9MB/s - 4.6MB/s) on my scsi disk whose disk buffer was enabled. Test step: # mkfs.btrfs -f -m single disk # mount disk mnt # dd if=/dev/zero of=mnt/file0 bs=32K count=1024 oflag=sync Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c | 6 +++--- fs/btrfs

Re: [PATCH] Btrfs: set the free space control unit properly

2013-05-28 Thread Miao Xie
On tue, 28 May 2013 14:50:25 -0400, Josef Bacik wrote: Stefan pointed out that xfstests generic/013 was failing because the free space cache checker was complaining with leafsize of 16k. Turns out this is because we were unconditionally using root-sectorsize as the free space ctl unit

Re: nocow 'C' flag ignored after balance

2013-05-29 Thread Miao Xie
On wed, 29 May 2013 10:55:11 +0900, Liu Bo wrote: On Tue, May 28, 2013 at 09:22:11AM -0500, Kyle Gates wrote: From: Liu Bo bo.li@oracle.com Subject: [PATCH] Btrfs: fix broken nocow after a normal balance [...] Sorry for the long wait in replying. This patch was unsuccessful in fixing

Re: [PATCH 1/6] btrfs: set readdir f_pos only after filldir

2013-06-04 Thread Miao Xie
-by: Zach Brown z...@redhat.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/delayed-inode.c | 5 +++-- fs/btrfs/inode.c | 17 +++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index

Re: [PATCH 0/6] fix INT_MAX readdir hang, plus cleanups

2013-06-04 Thread Miao Xie
On tue, 4 Jun 2013 16:26:57 -0700, Zach Brown wrote: On Tue, Jun 04, 2013 at 07:16:53PM -0400, Chris Mason wrote: Quoting Zach Brown (2013-06-04 18:17:54) Hi gang, I finally sat down to fix that readdir hang that has been in the back of my mind for a while. I *hope* that the fix is

Re: [PATCH 0/6] fix INT_MAX readdir hang, plus cleanups

2013-06-05 Thread Miao Xie
On wed, 5 Jun 2013 15:36:36 +0200, David Sterba wrote: On Wed, Jun 05, 2013 at 10:34:08AM +0800, Miao Xie wrote: On tue, 4 Jun 2013 16:26:57 -0700, Zach Brown wrote: On Tue, Jun 04, 2013 at 07:16:53PM -0400, Chris Mason wrote: Quoting Zach Brown (2013-06-04 18:17:54) Hi gang, I

[PATCH] Btrfs: fix broken nocow after balance

2013-06-05 Thread Miao Xie
last_snapshot safely if no one snapshoted the source tree. We fix the above problem by this way. Reported-by: Kyle Gates kylega...@hotmail.com Signed-off-by: Liu Bo bo.li@oracle.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/relocation.c | 44

Re: [PATCH] btrfs: Drop inode if inode root is NULL

2013-06-06 Thread Miao Xie
. Signed-off-by: Naohiro Aota na...@elisp.net Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index af978f7..17f3064 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8012,6

Re: [PATCH 2/3] Btrfs: fix the deadlock between the transaction start/attach and commit

2013-06-12 Thread Miao Xie
On wed, 12 Jun 2013 23:11:02 +0300, Alex Lyakas wrote: I reviewed the code starting from: 69aef69a1bc154 Btrfs: don't wait for all the writers circularly during the transaction commit until 2ce7935bf4cdf3 Btrfs: remove the time check in btrfs_commit_transaction() It looks very good. Let me

Re: [PATCH] Btrfs: cleanup backref search commit root flag stuff

2013-06-12 Thread Miao Xie
Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/backref.c | 41 - fs/btrfs/backref.h |2 -- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 290e347..431ea92 100644 --- a/fs

[RFC PATCH] Btrfs: optimize csums insertion function

2013-06-13 Thread Miao Xie
-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.c | 25 ++ fs/btrfs/ctree.h | 2 + fs/btrfs/file-item.c | 249 ++- 3 files changed, 133 insertions(+), 143 deletions(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 02fae7f

Re: [PATCH] Btrfs: fix the comment typo for btrfs_attach_transaction_barrier

2013-06-14 Thread Miao Xie
On fri, 14 Jun 2013 16:21:24 +0800, Wang Sheng-Hui wrote: The comment is for btrfs_attach_transaction_barrier, not for btrfs_attach_transaction. Fix the typo. Signed-off-by: Wang Sheng-Hui shh...@gmail.com My miss, sorry. Acked-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs

Re: [PATCH 2/3] Btrfs: fix the deadlock between the transaction start/attach and commit

2013-06-16 Thread Miao Xie
On sun, 16 Jun 2013 13:38:42 +0300, Alex Lyakas wrote: Hi Miao, On Thu, Jun 13, 2013 at 6:08 AM, Miao Xie mi...@cn.fujitsu.com wrote: On wed, 12 Jun 2013 23:11:02 +0300, Alex Lyakas wrote: I reviewed the code starting from: 69aef69a1bc154 Btrfs: don't wait for all the writers

Re: [RFC PATCH] Btrfs: optimize csums insertion function

2013-06-17 Thread Miao Xie
Any comments? Thanks Miao On thu, 13 Jun 2013 20:22:17 +0800, Miao Xie wrote: Before applying this patch, we search the csum item at first, and If the new csums is adjoining to the existed csum item, we call btrfs_search_slot() to grow this item. It is unnecessary because we can re-use

[PATCH] Btrfs: fix wrong csum clone when doing relocation

2013-06-17 Thread Miao Xie
the relative checksum value, and -bytenr in each checksum structure should point to the start of its extent, not the start of the ordered extent. Fix it. Signed-off-by: Josef Bacik jba...@fusionio.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/relocation.c | 4 +++- 1 file changed, 3

Re: [PATCH] Btrfs: do not ignore errors when truncating the free space cache inode

2013-06-18 Thread Miao Xie
It was fixed by Wei Yongjun http://marc.info/?l=linux-btrfsm=136910396606489w=2 Thanks Miao On tue, 18 Jun 2013 22:57:41 +0100, Djalal Harouni wrote: btrfs_check_trunc_cache_free_space() tries to check if there is enough space for cache inode truncation but it fails. Currently this

[PATCH V4] Btrfs: remove btrfs_sector_sum structure

2013-06-18 Thread Miao Xie
the performance by ~74% on my SSD (31MB/s - 54MB/s). test command: # dd if=/dev/zero of=/mnt/btrfs/file0 bs=1M count=1024 oflag=sync Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v3 - v4: - fix wrong csum clone when doing relocation. Changelog v2 - v3: - address the problem

[PATCH] Btrfs: cleanup redundant code in btrfs_submit_direct()

2013-06-19 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 590c274..65ae1cb 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7136,7 +7136,6 @@ static void

[PATCH 2/3] Btrfs: cleanup the code of copy_nocow_pages_for_inode()

2013-06-27 Thread Miao Xie
goto in the return value check of the write Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/scrub.c | 48 +++- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index c1647f8..186ea82 100644

[PATCH 3/3] Btrfs: fix several potential problems in copy_nocow_pages_for_inode

2013-06-27 Thread Miao Xie
- It makes no sense that we deal with a inode in the dead tree. - fix the race between dio and page copy by waiting the dio completion - avoid the page copy vs truncate/punch hole - check if the page is in the page cache or not Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/scrub.c

[PATCH 1/3] Btrfs: fix oops when recovering the file data by scrub function

2013-06-27 Thread Miao Xie
...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/scrub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 63144e4..c1647f8 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3258,7 +3258,7 @@ static int

[RFC PATCH 00/12] Btrfs-progs: introduce chunk recover function

2013-07-03 Thread Miao Xie
This patchset introduced chunk recover function, which was implemented by scanning the whoel disks in the filesystem. Now, we can recover Single, Dup, RAID1 chunks, and RAID0, RAID10, RAID5, RAID6 metadata chunks. Miao Xie (11): Btrfs-progs: don't close the file descriptor 0 when closing

[PATCH 10/12] Btrfs-progs: introduce list_{first, next}_entry/list_splice_tail{_init}

2013-07-03 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- list.h | 68 +- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/list.h b/list.h index 50f4619..db7a58c 100644 --- a/list.h +++ b/list.h @@ -223,18 +223,18 @@ static

[PATCH 03/12] Btrfs-progs: Don't free the devices when close the ctree

2013-07-03 Thread Miao Xie
after the taskes die. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- btrfs-find-root.c | 21 + disk-io.c | 30 ++ volumes.c | 3 +++ 3 files changed, 6 insertions(+), 48 deletions(-) diff --git a/btrfs-find-root.c b/btrfs-find

[PATCH 06/12] Btrfs-progs: use rb-tree instead of extent cache tree for fs/file roots

2013-07-03 Thread Miao Xie
Because the fs/file roots are not extents, so it is better to use rb-tree to manage them. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- ctree.h | 4 ++-- disk-io.c | 50 -- 2 files changed, 38 insertions(+), 16 deletions(-) diff

[PATCH 02/12] Btrfs-progs: don't close the file descriptor 0 when closing a device

2013-07-03 Thread Miao Xie
As we know, the file descriptor 0 is a special number, so we shouldn't use it to initialize the file descriptor of the devices, or we might close this special file descriptor by mistake when we close the devices. -1 is a better choice. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- btrfs-find

[PATCH 11/12] Btrfs-progs: Add chunk rebuild function for RAID1/SINGLE/DUP

2013-07-03 Thread Miao Xie
are not available. Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- btrfsck.h| 1 + cmds-check.c | 31 ++- cmds-chunk.c | 175 ++- volumes.c| 11 ++-- volumes.h| 5 +- 5

[PATCH 12/12] Btrfs-progs: recover raid0/raid10/raid5/raid6 metadata chunk

2013-07-03 Thread Miao Xie
recover the raid0/radi10/ raid5/raid6 metadata chunk. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- cmds-chunk.c | 289 --- 1 file changed, 279 insertions(+), 10 deletions(-) diff --git a/cmds-chunk.c b/cmds-chunk.c index 7b740a3

[PATCH 01/12] Btrfs-progs: fix missing recow roots when making btrfs filesystem

2013-07-03 Thread Miao Xie
For the above example, csum root leaf comes into system block group which is wrong,csum root leaf should be in metadata block group. Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- mkfs.c | 56

[PATCH 05/12] Btrfs-progs: introduce common insert/search/delete functions for rb-tree

2013-07-03 Thread Miao Xie
In fact, the code of many rb-tree insert/search/delete functions is similar, so we can abstract them, and implement common functions for rb-tree, and then simplify them. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- btrfs-list.c | 19 +++- cmds-check.c | 111

[PATCH 07/12] Btrfs-progs: extend the extent cache for the device extent

2013-07-03 Thread Miao Xie
named objectid into the extent cache, and introduced some functions to make the extent cache be suitable to manage the device extent. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- cmds-check.c | 96 ++--- extent-cache.c | 134

[PATCH 08/12] Btrfs-progs: Add block group check funtion

2013-07-03 Thread Miao Xie
This patch adds the function to check correspondence between block group, chunk and device extent. Original-signed-off-by: Cheng Yang chenyang.f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Makefile | 2 +- btrfsck.h| 118 + cmds-check.c | 555

[PATCH 04/12] Btrfs-progs: cleanup similar code in open_ctree_* and close_ctree

2013-07-03 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- btrfs-find-root.c | 137 +++- disk-io.c | 473 +++--- disk-io.h | 12 ++ 3 files changed, 307 insertions(+), 315 deletions(-) diff --git a/btrfs-find-root.c b/btrfs-find

Re: [PATCH 02/12] Btrfs-progs: don't close the file descriptor 0 when closing a device

2013-07-03 Thread Miao Xie
On wed, 3 Jul 2013 15:17:02 +0100, Filipe David Manana wrote: On Wed, Jul 3, 2013 at 2:25 PM, Miao Xie mi...@cn.fujitsu.com wrote: +++ b/disk-io.c @@ -1270,12 +1270,13 @@ static int close_all_devices(struct btrfs_fs_info *fs_info) while (!list_empty(list)) { device

Re: [PATCH 2/3] Btrfs: fix the deadlock between the transaction start/attach and commit

2013-07-03 Thread Miao Xie
On Wed, 26 Jun 2013 20:53:00 +0300, Alex Lyakas wrote: Hi Miao, On Mon, Jun 17, 2013 at 4:51 AM, Miao Xie mi...@cn.fujitsu.com wrote: On sun, 16 Jun 2013 13:38:42 +0300, Alex Lyakas wrote: Hi Miao, On Thu, Jun 13, 2013 at 6:08 AM, Miao Xie mi...@cn.fujitsu.com wrote: On wed, 12 Jun

[PATCH] Btrfs: fix wrong write offset when replacing a device

2013-07-04 Thread Miao Xie
not change the write offset because it is corresponding to the source device, not the mirror device, if we change it by the offset of the mirror device, we would get the wrong offset. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/scrub.c | 6 +- 1 file changed, 1 insertion(+), 5

Re: [PATCH RESEND] Btrfs: fix wrong write offset when replacing a device

2013-07-05 Thread Miao Xie
On thu, 4 Jul 2013 16:14:23 +0200, Stefan Behrens wrote: Miao Xie reported the following issue: The filesystem was corrupted after we did a device replace. Steps to reproduce: # mkfs.btrfs -f -m single -d raid10 device0..device3 # mount device0 mnt # btrfs replace start -rfB 1

[PATCH 4/5] Btrfs: batch the extent state operation in the end io handle of the read page

2013-07-10 Thread Miao Xie
It is unnecessary to unlock the extent by the page size, we can do it in batches, it makes the random read be faster by ~6%. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent_io.c | 70 ++-- 1 file changed, 40 insertions(+), 30

[PATCH 2/5] Btrfs: add branch prediction hints in the read page end IO function

2013-07-10 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent_io.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 4bfbcc5..c9b28cf 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2503,7

[PATCH 3/5] Btrfs: don't cache the csum value into the extent state tree

2013-07-10 Thread Miao Xie
contention. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/btrfs_inode.h | 21 + fs/btrfs/ctree.h | 4 +- fs/btrfs/disk-io.c | 5 ++- fs/btrfs/extent_io.c | 113 - fs/btrfs/extent_io.h | 10 ++--- fs/btrfs/file

[PATCH 1/5] Btrfs: remove unnecessary argument of bio_readpage_error()

2013-07-10 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent_io.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index f8586a9..4bfbcc5 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c

Re: [PATCH 1/5] Btrfs: remove unnecessary argument of bio_readpage_error()

2013-07-11 Thread Miao Xie
There are only 4 patches in this patchset, not 5. Sorry for my mistake. Miao On thu, 11 Jul 2013 13:25:36 +0800, Miao Xie wrote: Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent_io.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff

Re: [PATCH] Btrfs-progs: add missing path alloc return value check

2013-07-19 Thread Miao Xie
On thu, 18 Jul 2013 23:46:10 -0700, Filipe David Borba Manana wrote: Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/extent-tree.c b/extent-tree.c index f597e16..8e93bab 100644 --- a/extent-tree.c +++

[PATCH] Btrfs,raid56: fix memory leak when allocating pages for p/q stripes failed

2013-07-22 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/raid56.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 0db856c..d0ecfbd 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1540,8 +1540,10 @@ static int

Re: [patch] btrfs/raid56: fix and cleanup some error paths

2013-07-22 Thread Miao Xie
errors occur though, so I have added some more calls to kfree(). Signed-off-by: Dan Carpenter dan.carpen...@oracle.com From the viewpoint of the readability, it is better to free raid_map and bbio in the caller, I think. But it is up to you. Reviewed-by: Miao Xie mi...@cn.fujitsu.com diff

Re: [PATCH] Btrfs: reset ret in record_one_backref

2013-07-22 Thread Miao Xie
it. So reset it to 0 right after the search so we don't leak this and get uneccessary warnings. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git

Re: [PATCH] Btrfs: release both paths before logging dir/changed extents

2013-07-22 Thread Miao Xie
in two cases anyway so just move the drop up so that we don't have duplicate code. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/tree-log.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs

[PATCH V2 4/6] Btrfs: batch the extent state operation in the end io handle of the read page

2013-07-25 Thread Miao Xie
Before applying this patch, we set the uptodate flag and unlock the extent by the page size, it is unnecessary, we can do it in batches, it can reduce the lock contention of the extent state tree. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - Fix wrong check

[PATCH V2 1/6] Btrfs: remove unnecessary argument of bio_readpage_error()

2013-07-25 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, 11 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index f8586a9..a722235 100644 --- a/fs/btrfs/extent_io.c

[PATCH V2 6/6] Btrfs: cache the extent map struct when reading several pages

2013-07-25 Thread Miao Xie
-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - New patch --- fs/btrfs/extent_io.c | 57 ++-- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 53a1828..2e6dfeb 100644 --- a/fs/btrfs

[PATCH V2 5/6] Btrfs: batch the extent state operation when reading pages

2013-07-25 Thread Miao Xie
into the bio object, so it is unnecessary to do the extent state operations by the block size, we can do it in batches, in this way, we can reduce the lock contention of the extent state tree. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - New patch --- fs/btrfs/extent_io.c

[PATCH V2 3/6] Btrfs: don't cache the csum value into the extent state tree

2013-07-25 Thread Miao Xie
contention. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - Fix uninitialized function pointer in the btrfs_io_bio --- fs/btrfs/btrfs_inode.h | 21 + fs/btrfs/ctree.h | 4 +- fs/btrfs/disk-io.c | 5 +- fs/btrfs/extent_io.c | 125

[PATCH V2 0/6] reduce the lock contention when reading pages

2013-07-25 Thread Miao Xie
map tree. Patch 6 does this work. I tested this patchset by sysbench on my SSD, it makes the performance of the random read be faster by ~7%. The lock contention is reduced by ~97%. Miao Xie (6): Btrfs: remove unnecessary argument of bio_readpage_error() Btrfs: add branch prediction hints

Re: [PATCH v2] Btrfs: optimize function btrfs_read_chunk_tree

2013-07-29 Thread Miao Xie
. */ The other code is OK. Reviewed-by: Miao Xie mi...@cn.fujitsu.com key.objectid = BTRFS_DEV_ITEMS_OBJECTID; key.offset = 0; key.type = 0; -again: ret = btrfs_search_slot(NULL, root, key, path, 0, 0); if (ret 0) goto error; @@ -5699,17 +5698,13 @@ again

Re: [PATCH v3] Btrfs-progs: add missing path alloc return value check

2013-07-29 Thread Miao Xie
On mon, 29 Jul 2013 23:37:19 +0100, Filipe David Borba Manana wrote: Also remove unused path in extent-tree.c:finish_current_insert(). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: added 1 more path alloc check and removed unnecessary path allocation in

Re: [PATCH v2] Btrfs-progs: optimize function btrfs_read_chunk_tree

2013-07-29 Thread Miao Xie
--- V2: Simplified logic inside the loop (suggested by Josef Bacik on irc). The comment is the same to the kernel side(Coding style problem of the comment). Reviewed-by: Miao Xie mi...@cn.fujitsu.com volumes.c | 28 +--- 1 file changed, 9 insertions(+), 19

Re: [PATCH] btrfs: use list_for_each_entry_safe() when delete items

2013-07-29 Thread Miao Xie
; } but from the viewpoint of the readability, this way is not so good. Reviewed-by: Miao Xie mi...@cn.fujitsu.com -- 1.7.10.4 -- 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] Btrfs: cleanup arguments to extent_clear_unlock_delalloc

2013-07-29 Thread Miao Xie
...@fusionio.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent_io.c | 32 --- fs/btrfs/extent_io.h | 21 +++ fs/btrfs/inode.c | 162 -- 3 files changed, 85 insertions(+), 130 deletions(-) diff --git a/fs/btrfs

Re: [PATCH] Btrfs: fix what bits we clear when erroring out from delalloc

2013-07-30 Thread Miao Xie
release function in cow_file_range_inline() as I said above, we should add EXTENT_DO_ACCOUNTING here. I will send a patch to fix the problem I said above soon, please wait a moment The other code is OK. Reviewed-by: Miao Xie mi...@cn.fujitsu.com -- To unsubscribe from this list: send the line

Re: [PATCH v3] Btrfs: optimize function btrfs_read_chunk_tree

2013-07-30 Thread Miao Xie
. Reviewed-by: Miao Xie mi...@cn.fujitsu.com fs/btrfs/volumes.c | 30 +++--- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 090f57c..125a60e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c

Re: [PATCH v3] Btrfs-progs: optimize function btrfs_read_chunk_tree

2013-07-30 Thread Miao Xie
--- V2: Simplified logic inside the loop (suggested by Josef Bacik on irc). V3: Updated comment to comply with kernel coding style. Reviewed-by: Miao Xie mi...@cn.fujitsu.com volumes.c | 28 ++-- 1 file changed, 10 insertions(+), 18 deletions(-) diff

Re: [PATCH v4] Btrfs-progs: add missing path alloc return value check

2013-07-30 Thread Miao Xie
in extent-tree.c:finish_current_insert(). V3: added missing path alloc checks to dir-item.c, file-item.c and btrfs-corrupt-block.c too. V4: added missing patch alloc checks to cmd-checks.c and root-tree.c. Reviewed-by: Miao Xie mi...@cn.fujitsu.com btrfs-corrupt-block.c |2 ++ cmds

Re: [PATCH] Btrfs: allow compressed extents to be merged during defragment

2013-08-02 Thread Miao Xie
to relink_is_mergable() directly? The other code is OK. Reviewed-by: Miao Xie mi...@cn.fujitsu.com btrfs_set_file_extent_num_bytes(leaf, fi, extent_len + len); btrfs_mark_buffer_dirty(leaf

Re: [PATCH] Btrfs: fix what bits we clear when erroring out from delalloc

2013-08-02 Thread Miao Xie
Hi, Josef On Tue, 30 Jul 2013 14:27:40 +0800, Miao Xie wrote: extent_clear_unlock_delalloc(inode, start, end, NULL, - EXTENT_DIRTY | - EXTENT_DELALLOC

  1   2   3   4   5   6   7   8   9   10   >