[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 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 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

[PATCH V3] Btrfs: remove btrfs_sector_sum structure

2013-05-06 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 v2 - v3: - address the problem that the csums was inserted into the wrong range, this bug was reported

Re: [PATCH V2 2/2] Btrfs: remove btrfs_sector_sum structure

2013-04-26 Thread Miao Xie
On tue, 23 Apr 2013 16:54:35 -0400, Josef Bacik wrote: On Wed, Apr 03, 2013 at 03:14:56AM -0600, Miao Xie wrote: Using the structure btrfs_sector_sum to keep the checksum value is unnecessary, because the extents that btrfs_sector_sum points to are continuous, we can find out the expected

Re: [PATCH V2 2/2] Btrfs: remove btrfs_sector_sum structure

2013-04-26 Thread Miao Xie
On Fri, 26 Apr 2013 16:58:18 +0800, Miao Xie wrote: On tue, 23 Apr 2013 16:54:35 -0400, Josef Bacik wrote: On Wed, Apr 03, 2013 at 03:14:56AM -0600, Miao Xie wrote: Using the structure btrfs_sector_sum to keep the checksum value is unnecessary, because the extents that btrfs_sector_sum points

[PATCH] Btrfs: allocate new chunks if the space is not enough for global rsv

2013-04-25 Thread Miao Xie
Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent-tree.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 0d84787..4976f93 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c

Re: [PATCH 2/2] Btrfs: introduce noextiref mount option

2013-04-25 Thread Miao Xie
On Mon, 15 Apr 2013 19:20:51 +0200, David Sterba wrote: On Fri, Apr 12, 2013 at 12:01:19PM -0500, Eric Sandeen wrote: On 4/11/13 5:35 AM, Miao Xie wrote: Now, we set incompat flag EXTEND_IREF when we actually need insert a extend inode reference, not when making a fs. But some users may hope

Re: [PATCH 2/2] Btrfs: use a lock to protect incompat/compat flag of the super block

2013-04-21 Thread Miao Xie
On thu, 18 Apr 2013 00:17:11 +0200, David Sterba wrote: On Thu, Apr 11, 2013 at 06:30:16PM +0800, Miao Xie wrote: In order to avoid this problem, we introduce a lock named super_lock into the btrfs_fs_info structure. If we want to update incompat/compat flags of the super block, we must

Re: [PATCH 2/2] Btrfs: introduce noextiref mount option

2013-04-14 Thread Miao Xie
On Fri, 12 Apr 2013 09:02:34 +0200, Jan Schmidt wrote: +static int btrfs_close_extend_iref(struct btrfs_fs_info *fs_info, + unsigned long old_opts) The name irritated me, it's more like unset instead of close, isn't it? Maybe btrfs_set_no_extend_iref() is better,

[PATCH 1/2] Btrfs: fix unblocked autodefraggers when remount

2013-04-11 Thread Miao Xie
The new mount option is set after parsing the remount arguments, so it is wrong that checking the autodefrag is close or not at btrfs_remount_prepare(). Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/super.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions

[PATCH 2/2] Btrfs: use a lock to protect incompat/compat flag of the super block

2013-04-11 Thread Miao Xie
into the btrfs_fs_info structure. If we want to update incompat/compat flags of the super block, we must hold it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 22 -- fs/btrfs/disk-io.c | 5 + fs/btrfs/volumes.c | 10 +- 3 files changed, 26 insertions(+), 11

[PATCH 0/2] do not open the extend inode reference at the beginning

2013-04-11 Thread Miao Xie
. This patchset is against: [PATCH 1/2] Btrfs: fix unblocked autodefraggers when remount [PATCH 2/2] Btrfs: use a lock to protect incompat/compat flag of the super block Miao Xie (2): Btrfs: set the INCOMPAT_EXTENDED_IREF when the extended iref is inserted Btrfs: introduce noextiref mount option fs

[PATCH 1/2] Btrfs: set the INCOMPAT_EXTENDED_IREF when the extended iref is inserted

2013-04-11 Thread Miao Xie
We needn't set the INCOMAT_EXTENDED_IREF when making a new fs, just do it after we insert a extended iref successfully. Otherwise, we can not mount the fs in which there is no extended iref in fact on the old kernel, it is not so flexible for the users. Signed-off-by: Miao Xie mi

[PATCH 2/2] Btrfs: introduce noextiref mount option

2013-04-11 Thread Miao Xie
this function. Signed-off-by: Miao Xie mi...@cn.fujitsu.com Cc: Mark Fasheh mfas...@suse.de --- fs/btrfs/ctree.h | 1 + fs/btrfs/disk-io.c| 9 + fs/btrfs/inode-item.c | 2 +- fs/btrfs/super.c | 41 - 4 files changed, 51 insertions(+), 2

[PATCH] Btrfs-progs: don't set INCOMPAT_EXTENDED_IREF flag when making a new fs

2013-04-11 Thread Miao Xie
There is no extended irefs in the new fs, and we can mount it on the old kernel without extended iref function safely. So we needn't set INCOMPAT_EXTENDED_IREF flag when making a new fs, and just set it when we actually insert a extended iref. Signed-off-by: Miao Xie mi...@cn.fujitsu.com Cc: Mark

Re: [PATCH] Btrfs-progs: don't set INCOMPAT_EXTENDED_IREF flag when making a new fs

2013-04-11 Thread Miao Xie
On Thu, 11 Apr 2013 16:28:11 +0200, Jan Schmidt wrote: On Thu, April 11, 2013 at 12:28 (+0200), Miao Xie wrote: There is no extended irefs in the new fs, and we can mount it on the old kernel without extended iref function safely. So we needn't set INCOMPAT_EXTENDED_IREF flag when making a new

Re: [PATCH 2/2] Btrfs: introduce noextiref mount option

2013-04-11 Thread Miao Xie
On thu, 11 Apr 2013 16:29:48 +0200, Jan Schmidt wrote: On Thu, April 11, 2013 at 12:35 (+0200), Miao Xie wrote: Now, we set incompat flag EXTEND_IREF when we actually need insert a extend inode reference, not when making a fs. But some users may hope that the fs still can be mounted

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

2013-04-10 Thread Miao Xie
, 2013 at 3:51 AM, Miao Xie mi...@cn.fujitsu.com wrote: On Sun, 24 Mar 2013 13:13:22 +0200, Alex Lyakas wrote: Hi Miao, I am seeing another issue. Your fix prevents from TRANS_START to get in the way of a committing transaction. But it does not prevent from TRANS_JOIN. On the other hand

Re: [PATCH 1/2] Btrfs: online data deduplication

2013-04-08 Thread Miao Xie
On mon, 8 Apr 2013 22:16:26 +0800, Liu Bo wrote: On Mon, Apr 08, 2013 at 08:54:50AM -0400, Josef Bacik wrote: On Sun, Apr 07, 2013 at 07:12:48AM -0600, Liu Bo wrote: (NOTE: This leads to a FORMAT CHANGE, DO NOT use it on real data.) This introduce the online data deduplication feature

Re: [PATCH 1/2] Btrfs: online data deduplication

2013-04-08 Thread Miao Xie
On mon, 8 Apr 2013 15:47:27 +0200, David Sterba wrote: On Sun, Apr 07, 2013 at 09:12:48PM +0800, Liu Bo wrote: (2) WHAT is deduplication? Two key ways for practical deduplication implementations, * When the data is deduplicated (inband vs background) * The

[PATCH V3 1/2] Btrfs: improve the performance of the csums lookup

2013-04-05 Thread Miao Xie
- 217us). # dd if=mnt/file of=/dev/null bs=1M count=1024 Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v2 - v3: - address the problem that the logical offset of the pages in the same bio is not contiguous. Changelog v1 - v2: - fix 64bit division problem on i386 machine --- fs/btrfs

[PATCH V2 1/2] Btrfs: improve the performance of the csums lookup

2013-04-03 Thread Miao Xie
- 217us). # dd if=mnt/file of=/dev/null bs=1M count=1024 Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - fix 64bit division problem on i386 machine --- fs/btrfs/extent_io.c| 31 +++ fs/btrfs/extent_io.h| 2 ++ fs/btrfs/file-item.c| 45

[PATCH V2 2/2] Btrfs: remove btrfs_sector_sum structure

2013-04-03 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 Reviewed-by: Liu Bo bo.li@oracle.com --- Changelog v1 - v2: - modify the changelog and the title which can not explain

[PATCH 1/4] Btrfs: fix wrong reservation of csums

2013-03-28 Thread Miao Xie
- btrfs_csum_file_blocks() didn't differentiate between these two types of the cases, fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/file-item.c | 2 -- fs/btrfs/inode.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/file-item.c b/fs/btrfs

[PATCH 2/4] Btrfs: improve the performance of the csums lookup

2013-03-28 Thread Miao Xie
- 217us). # dd if=mnt/file of=/dev/null bs=1M count=1024 Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent_io.c| 31 +++ fs/btrfs/extent_io.h| 2 ++ fs/btrfs/file-item.c| 45 ++--- fs/btrfs/ordered-data.c

[PATCH 3/4] Btrfs: remove unnecessary variant in btrfs_sector_sum structure

2013-03-28 Thread Miao Xie
the checksums one by one. Now, we can get several checksum value at one time. By this way, the performance of write is improved 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 --- fs

[PATCH 4/4] Btrfs: fix wrong return value of btrfs_lookup_csum()

2013-03-28 Thread Miao Xie
If we don't find the expected csum item, but find a csum item which is adjacent to the specified extent, we should return -EFBIG, or we should return -ENOENT. But btrfs_lookup_csum() return -EFBIG even the csum item is not adjacent to the specified extent. Fix it. Signed-off-by: Miao Xie mi

[PATCH V2 3/4] Btrfs: remove unnecessary variant in btrfs_sector_sum, structure

2013-03-28 Thread Miao Xie
the checksums one by one. Now, we can get several checksum value at one time. By this way, the performance of write is improved 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

Re: [PATCH 3/4] Btrfs: remove unnecessary variant in btrfs_sector_sum structure

2013-03-28 Thread Miao Xie
On Thu, 28 Mar 2013 22:41:50 +0800, Liu Bo wrote: On Thu, Mar 28, 2013 at 10:38:34PM +0800, Liu Bo wrote: On Thu, Mar 28, 2013 at 04:11:38PM +0800, Miao Xie wrote: bytenr in btrfs_sector_sum is unnecessary, because the extents that btrfs_sector_sum points to are continuous,we can find out

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

2013-03-24 Thread Miao Xie
TRANS_JOIN here. (I am dealing with the problem you said above by adding a new type of TRANS_* now) Thanks Miao Thanks, Alex. On Mon, Feb 25, 2013 at 12:20 PM, Miao Xie mi...@cn.fujitsu.com wrote: On sun, 24 Feb 2013 21:49:55 +0200, Alex Lyakas wrote: Hi Miao, can you please explain

Re: [PATCH] Btrfs: improve the delayed inode throttling

2013-03-06 Thread Miao Xie
On wed, 6 Mar 2013 09:53:28 -0500, Chris Mason wrote: On Tue, Mar 05, 2013 at 07:45:34PM -0700, Miao Xie wrote: We re-queue the node just when there are some delayed items in the current node. But if the node still has delayed items after we deal with it, that is to say someone

Re: [PATCH] Btrfs: improve the delayed inode throttling

2013-03-06 Thread Miao Xie
On wed, 6 Mar 2013 09:53:28 -0500, Chris Mason wrote: [SNIP] static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root, - struct btrfs_root *root, int all) + struct btrfs_root *root, int nr) { - struct

Re: [PATCH] Btrfs: improve the delayed inode throttling

2013-03-06 Thread Miao Xie
On wed, 6 Mar 2013 22:06:50 -0500, Chris Mason wrote: On Wed, Mar 06, 2013 at 06:39:30PM -0700, Miao Xie wrote: On wed, 6 Mar 2013 09:53:28 -0500, Chris Mason wrote: [SNIP] + async_work-delayed_root = delayed_root; + async_work-work.func = btrfs_async_run_delayed_root

Re: [PATCH] Btrfs: improve the delayed inode throttling

2013-03-05 Thread Miao Xie
On tue, 5 Mar 2013 10:40:17 -0500, Chris Mason wrote: diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 0b278b1..460d1a8 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -22,8 +22,8 @@ #include disk-io.h #include transaction.h -#define

[PATCH 1/2] Btrfs: fix wrong handle at error path of create_snapshot() when the commit fails

2013-03-04 Thread Miao Xie
- the transaction committer doesn't free the pending snapshots, just assigns the error number and evicts them before we unblock the transaction. Reported-by: Dan Carpenter dan.carpen...@oracle.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/disk-io.c | 16 +--- fs/btrfs

[PATCH 2/2] Btrfs: fix unclosed transaction handler when the async transaction commitment fails

2013-03-04 Thread Miao Xie
-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 94c0e42..3fdfabc 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -527,6 +527,8 @@ fail: if (async_transid

Re: [PATCH 1/2] Btrfs: fix wrong handle at error path of create_snapshot() when the commit fails

2013-03-04 Thread Miao Xie
On Mon, 4 Mar 2013 18:54:02 +0800, Liu Bo wrote: On Mon, Mar 04, 2013 at 05:44:29PM +0800, Miao Xie wrote: There are several bugs at error path of create_snapshot() when the transaction commitment failed. - access the freed transaction handler. At the end of the transaction commitment

[PATCH 1/3] Btrfs: remove unnecessary dget_parent/dput when creating the pending snapshot

2013-02-28 Thread Miao Xie
to fix the parent dentry and get the dir inode. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 10 ++ fs/btrfs/transaction.c |5 + fs/btrfs/transaction.h |1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs

[PATCH 2/3] Btrfs: fix wrong reserved space in qgroup during snap/subv creation

2013-02-28 Thread Miao Xie
, we need reserve space only for 3 items. So we implement new metadata reservation functions for the snapshot/subvolume creation. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h |9 +- fs/btrfs/extent-tree.c | 65

[PATCH 3/3] Btrfs: fix wrong reserved space when deleting a snapshot/subvolume

2013-02-28 Thread Miao Xie
When deleting a snapshot/subvolume, we need remove root ref/backref, dir entries and update the dir inode, so we must reserve free space for those operations. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 21 +++-- 1 files changed, 19 insertions(+), 2

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

2013-02-25 Thread Miao Xie
On sun, 24 Feb 2013 21:49:55 +0200, Alex Lyakas wrote: Hi Miao, can you please explain your solution a bit more. On Wed, Feb 20, 2013 at 11:16 AM, Miao Xie mi...@cn.fujitsu.com wrote: Now btrfs_commit_transaction() does this ret = btrfs_run_ordered_operations(root, 0) which async flushes

Re: [PATCH] Btrfs: update inode flags when renaming

2013-02-24 Thread Miao Xie
On mon, 25 Feb 2013 11:50:01 +0800, Liu Bo wrote: On Fri, Feb 22, 2013 at 11:04:40PM +0100, David Sterba wrote: On Fri, Feb 22, 2013 at 05:34:47PM +0800, Miao Xie wrote: On fri, 22 Feb 2013 16:40:35 +0800, Liu Bo wrote: On Fri, Feb 22, 2013 at 03:32:50AM -0500, Marios Titas wrote: Sorry

Re: [PATCH] Btrfs: use reserved space for creating a snapshot

2013-02-22 Thread Miao Xie
need to set trans handle to indicate that we have space now. Signed-off-by: Liu Bo bo.li@oracle.com Reviewed-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs

[PATCH] Btrfs: fix wrong outstanding_extents when doing DIO write

2013-02-21 Thread Miao Xie
Harder mitch.har...@sabayonlinux.org Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b009fb5..9a1cc04 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs

Re: Kernel WARNINGs on btrfs-next

2013-02-21 Thread Miao Xie
hi, On wed, 20 Feb 2013 23:35:36 -0600, Mitch Harder wrote: I'm getting a series of kernel WARNING messages when testing Josef's btrfs-next and Chris' next branch running xfstests 083 when mounted with compress-force=lzo. I'm not seeing any other indications of problems other than the

[PATCH 1/3] Btrfs: fix the qgroup reserved space is released prematurely

2013-02-20 Thread Miao Xie
In start_transactio(), we will try to join the transaction again after the current transaction is committed, so we should not release the reserved space of the qgroup. Fix it. Cc: Arne Jansen sensi...@gmx.net Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c |3 ++- 1

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

2013-02-20 Thread Miao Xie
. In this way, there is another benefit: there is no new transaction handle to block the transaction which is on the way of commit, once we set -in_commit. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c | 17 - 1 files changed, 16 insertions(+), 1

[PATCH 3/3] Btrfs: fix uncompleted transaction

2013-02-20 Thread Miao Xie
, even they are not running, we can use this function. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c |2 +- fs/btrfs/super.c |4 ++-- fs/btrfs/transaction.c | 32 fs/btrfs/transaction.h |2 ++ 4 files changed, 37

[PATCH V2] Btrfs: fix remount vs autodefrag

2013-02-20 Thread Miao Xie
If we remount the fs to close the auto defragment or make the fs R/O, we should stop the auto defragment. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - don't use -s_umount to avoid R/W-R/O remounting during the defragment. Instead We add a new state that tell

Re: [PATCH] Btrfs: fix the deadlock between the transaction attach and commit

2013-02-18 Thread Miao Xie
(Sorry for the late reply, I was on my vacation of the Spring Festival last week.) On Tue, 12 Feb 2013 13:56:32 +0100, David Sterba wrote: On Mon, Feb 11, 2013 at 03:35:37PM -0500, Josef Bacik wrote: or something like that. Me and kdave reproduced by running 274 in a loop, it happpened

Re: [PATCH] Btrfs: place ordered operations on a per transaction list

2013-02-18 Thread Miao Xie
On wed, 13 Feb 2013 11:13:22 -0500, Josef Bacik wrote: Miao made the ordered operations stuff run async, which introduced a deadlock where we could get somebody (sync) racing in and committing the transaction while a commit was already happening. The new committer would try and flush ordered

Re: [PATCH 2/2] Btrfs: fix memory leak of pending_snapshot-inherit

2013-02-07 Thread Miao Xie
On Thu, 07 Feb 2013 09:43:47 +0100, Arne Jansen wrote: On 02/07/13 07:02, Miao Xie wrote: The argument inherit of btrfs_ioctl_snap_create_transid() was assigned to NULL during we created the snapshots, so we didn't free it though we called kfree() in the caller. But since we are sure

[RFC][PATCH] Btrfs: fix deadlock due to unsubmitted

2013-02-07 Thread Miao Xie
, and it is likely to break contiguous requests, and introduce performance regression for the other filesystems. So we have to choose the 2nd way. Signed-off-by: Miao Xie mi...@cn.fujitsu.com Cc: Josef Bacik jba...@fusionio.com --- fs/btrfs/extent-tree.c |3 +- fs/btrfs/inode.c | 81

[PATCH] Btrfs: fix the deadlock between the transaction attach and commit

2013-02-07 Thread Miao Xie
if someone has committed the transaction, it is unnecessary to join it and commit it, wait is the best choice for it. In this way, we can fix the above problem. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c |8 1 files changed, 8 insertions(+), 0 deletions

[PATCH V2 1/2] Btrfs: serialize unlocked dio reads with truncate

2013-02-07 Thread Miao Xie
the race between write DIO and truncation. By that time, we have to introduce btrfs_inode_{block, resume}_nolock_dio() again. That is we have to implement this patch again, so I choose the 2nd way to fix the problem. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changlog v1 - v2: - Rebase

[PATCH V2 2/2] Btrfs: implement unlocked dio write

2013-02-07 Thread Miao Xie
24726 nolock 24962 30866 32101 == result (iops) == write 1 2 4 lock623461846181 nolock 624077168025 Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - don't do nolocked DIO write if it is beyond the EOF --- fs/btrfs/inode.c | 35

Re: Leaking btrfs_qgroup_inherit on snapshot creation?

2013-02-06 Thread Miao Xie
(6f72c7e20dbaea5) it was still there, in transaction.c. It has been removed in 6fa9700e734: commit 6fa9700e734275de2acbcb0e99414bd7ddfc60f1 Author: Miao Xie mi...@cn.fujitsu.com Date: Thu Sep 6 04:00:32 2012 -0600 Btrfs: fix error path in create_pending_snapshot() This patch fixes

[PATCH 1/2] Btrfs: fix the race between bio and btrfs_stop_workers

2013-02-06 Thread Miao Xie
-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/disk-io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 0c31d07..d8fd711 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2728,13 +2728,13 @@ fail_cleaner

[PATCH 2/2] Btrfs: fix memory leak of pending_snapshot-inherit

2013-02-06 Thread Miao Xie
, it is safe that we don't assign the pointer inherit to NULL, and just free it in the caller of btrfs_ioctl_snap_create_transid(). In this way, the code can become more readable. Reported-by: Alex Lyakas alex.bt...@zadarastorage.com Cc: Arne Jansen sensi...@gmx.net Signed-off-by: Miao Xie mi

Re: [BUG] kernel BUG at fs/btrfs/async-thread.c:605!

2013-02-03 Thread Miao Xie
Hi, Eric I want to send out my fix patch, but Could I add your Signed-off-by? because you found the key to solving the problem. Thanks Miao On Fri, 01 Feb 2013 14:53:09 +0900, Tsutomu Itoh wrote: Can you please explain similar problems, Miao? Before missing device check, there are several

[PATCH 1/2] Btrfs: serialize unlocked dio reads with truncate

2013-01-31 Thread Miao Xie
() #alloc truncated blocks #to other inode -submit_io() #INFORMATION LEAK In order to avoid this problem, we must serialize unlocked dio reads with truncate by inode_dio_wait(). Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs

[RFC][PATCH 2/2] Btrfs: implement unlocked dio write

2013-01-31 Thread Miao Xie
nolock 624077168025 Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d17a04b..091593a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs

Re: [BUG] kernel BUG at fs/btrfs/async-thread.c:605!

2013-01-31 Thread Miao Xie
On Fri, 01 Feb 2013 09:31:33 +0900, Tsutomu Itoh wrote: Hi, On 2013/01/31 16:58, Miao Xie wrote: On wed, 30 Jan 2013 23:55:34 -0600, Eric Sandeen wrote: if you move the fail_block_groups: target above the comment, does that fix it? (although I don't know yet what started IO . . . ) like

Re: [RFC][PATCH 2/2] Btrfs: implement unlocked dio write

2013-01-31 Thread Miao Xie
On fri, 1 Feb 2013 10:53:30 +0800, Liu Bo wrote: On Thu, Jan 31, 2013 at 05:39:03PM +0800, Miao Xie wrote: This idea is from ext4. By this patch, we can make the dio write parallel, and improve the performance. Interesting, AFAIK, ext4 can only do nolock dio write on some conditions

Re: [PATCH 1/2] Btrfs: serialize unlocked dio reads with truncate

2013-01-31 Thread Miao Xie
On Thu, 31 Jan 2013 11:40:41 -0500, Josef Bacik wrote: On Thu, Jan 31, 2013 at 02:23:19AM -0700, Miao Xie wrote: Currently, we can do unlocked dio reads, but the following race is possible: dio_read_tasktruncate_task -btrfs_setattr

Re: [RFC][PATCH 2/2] Btrfs: implement unlocked dio write

2013-01-31 Thread Miao Xie
On fri, 01 Feb 2013 12:08:25 +0800, Miao Xie wrote: Onfri, 1 Feb 2013 10:53:30 +0800, Liu Bo wrote: On Thu, Jan 31, 2013 at 05:39:03PM +0800, Miao Xie wrote: This idea is from ext4. By this patch, we can make the dio write parallel, and improve the performance. Interesting, AFAIK

Re: [PATCH 5/5] Btrfs: fix remount vs autodefrag

2013-01-30 Thread Miao Xie
Any comments about this patch? Thanks Miao On mon, 26 Nov 2012 17:28:13 +0800, Miao Xie wrote: If we remount the fs to close the auto defragment or make the fs R/O, we should stop the auto defragment. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 1 + fs/btrfs

Re: [BUG] kernel BUG at fs/btrfs/async-thread.c:605!

2013-01-30 Thread Miao Xie
On thu, 31 Jan 2013 12:37:49 +0900, Tsutomu Itoh wrote: Hi, In kernel 3.8-rc5, the following panics occurred when the mount was done by the degraded option. # btrfs fi sh /dev/sdc8 Label: none uuid: fc63cd80-5ae2-4fbe-8795-2d526c937a56 Total devices 3 FS bytes used 20.98GB

Re: [BUG] kernel BUG at fs/btrfs/async-thread.c:605!

2013-01-30 Thread Miao Xie
On Thu, 31 Jan 2013 01:19:41 -0500 (est), Eric Sandeen wrote: On Jan 31, 2013, at 12:13 AM, Miao Xie mi...@cn.fujitsu.com wrote: On thu, 31 Jan 2013 12:37:49 +0900, Tsutomu Itoh wrote: Hi, In kernel 3.8-rc5, the following panics occurred when the mount was done by the degraded option

Re: [BUG] kernel BUG at fs/btrfs/async-thread.c:605!

2013-01-30 Thread Miao Xie
On wed, 30 Jan 2013 23:55:34 -0600, Eric Sandeen wrote: === [ 7913.075890] btrfs: allowing degraded mounts [ 7913.075893] btrfs: disk space caching is enabled [ 7913.092031] Btrfs: too many missing devices,

Re: [BUG] kernel BUG at fs/btrfs/async-thread.c:605!

2013-01-30 Thread Miao Xie
On wed, 30 Jan 2013 23:55:34 -0600, Eric Sandeen wrote: if you move the fail_block_groups: target above the comment, does that fix it? (although I don't know yet what started IO . . . ) like this: From: Eric Sandeen sand...@redhat.com Make sure that we are always done with the

[PATCH V2 01/10] Btrfs: use atomic for btrfs_fs_info-generation

2013-01-29 Thread Miao Xie
load high 32 bits set high 32 bits The task will get 0, it is a wrong number. We fix this problem by the atomic operation. Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - modify the changelog and make it more clear

[PATCH V2 02/10] Btrfs: use atomic for fs_info-last_trans_committed

2013-01-29 Thread Miao Xie
set high 32 bits The task will get 0, it is a wrong number. We fix this problem by the atomic operation. Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - modify the changelog and make it more clear and stringency

[PATCH V2 03/10] Btrfs: use atomic for fs_info-last_trans_log_full_commit

2013-01-29 Thread Miao Xie
high 32 bits set high 32 bits The task will get 0, it is a wrong number. We fix this problem by the atomic operation. Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - modify the changelog and make it more clear

[PATCH V2 04/10] Btrfs: add a comment for fs_info-max_inline

2013-01-29 Thread Miao Xie
Though -max_inline is a 64bit variant, and may be accessed by multi-task, but it is just suggestive number, so we needn't add anything to protect fs_info-max_inline, just add a comment to explain wny we don't use a lock to protect it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1

[PATCH V2 05/10] Btrfs: protect fs_info-alloc_start

2013-01-29 Thread Miao Xie
of these two locks, and on the write side, we must lock all of them. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - modify the changelog and make it more clear and stringency. --- fs/btrfs/ctree.h | 10 ++ fs/btrfs/super.c | 4 2 files changed, 14 insertions

[PATCH V2 06/10] Btrfs: use percpu counter for dirty metadata count

2013-01-29 Thread Miao Xie
. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - modify the changelog and make it more clear and stringency. --- fs/btrfs/ctree.h | 9 fs/btrfs/disk-io.c | 64 fs/btrfs/extent_io.c | 9 +++- 3 files

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