Re: [RFC PATCH 2/2] Btrfs: introduce free space cluster for each node

2011-11-01 Thread Miao Xie
Any Comment? On Thu, 08 Sep 2011 16:18:09 +0800, Miao Xie wrote: > This patch introduce free space cluster for each node in the b+tree. And > we also simplify the fill method and the space allocation of the cluster: > - Allocate free space cluster for each node > - Allocate the free

Re: [RFC PATCH 2/2] Btrfs: introduce free space cluster for each node

2011-11-01 Thread Miao Xie
On tue, 1 Nov 2011 12:04:40 -0400, Chris Mason wrote: > On Tue, Nov 01, 2011 at 03:39:11PM +0800, Miao Xie wrote: >> Any Comment? > > This is definitely interesting, in terms of trying to avoid btree > fragmentation and improve the performance of the allocator. > > Bu

[PATCH 3/6] Btrfs: fix unreleased path in btrfs_orphan_cleanup()

2011-11-09 Thread Miao Xie
task, which called btrfs_orphan_cleanup(), to unlock the extent buffer, but that task waited the commit task to end the transaction commit, and the deadlock happened. Fix it. Signed-ff-by: Miao Xie --- fs/btrfs/inode.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/fs

[PATCH 1/6] Btrfs: Abstract similar code for btrfs_block_rsv_add{, _noflush}()

2011-11-09 Thread Miao Xie
btrfs_block_rsv_add{, _noflush}() have similar code, so abstract that code. Signed-off-by: Miao Xie --- fs/btrfs/extent-tree.c | 28 1 files changed, 12 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 1311beb

[PATCH 2/6] Btrfs: fix no reserved space for writing out inode cache

2011-11-09 Thread Miao Xie
space for inode cache. Note: If we can not reserve the enough space for inode cache, we will give up writing out it. Signed-off-by: Miao Xie --- fs/btrfs/inode-map.c | 28 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/inode-map.c b/fs/btrfs

[PATCH 5/6] Btrfs: fix deadlock caused by the race between relocation and snapshot creation

2011-11-09 Thread Miao Xie
We can not do flushable reservation for the relocation when we create snapshot, because it may make the transaction commit task and the flush task wait for each other and the deadlock happens. Signed-off-by: Miao Xie --- fs/btrfs/transaction.c |4 ++-- 1 files changed, 2 insertions(+), 2

[PATCH 6/6] Btrfs: fix orphan backref nodes

2011-11-09 Thread Miao Xie
ed-off-by: Miao Xie --- fs/btrfs/relocation.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 162af18..1db3771 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1174,6 +1174,8 @@ static int clone_bac

[PATCH 4/6] Btrfs: fix nocow when deleting the item

2011-11-09 Thread Miao Xie
btrfs_previous_item() just search the b+ tree, do not COW the nodes or leaves, if we modify the result of it, the meta-data will be broken. fix it. Signed-off-by: Miao Xie --- fs/btrfs/volumes.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs

Re: [PATCH 1/6] Btrfs: Abstract similar code for btrfs_block_rsv_add{, _noflush}()

2011-11-09 Thread Miao Xie
orphan back-ref nodes. NOTE: This patchset is based on the danger branch. Miao Xie (6): Btrfs: Abstract similar code for btrfs_block_rsv_add{, _noflush}() Btrfs: fix no reserved space for writing out inode cache Btrfs: fix unreleased path in btrfs_orphan_cleanup() Btrfs: fix nocow when

[PATCH] Btrfs: fix deadlock on metadata reservation when evicting a inode

2011-11-18 Thread Miao Xie
pping the flush step when evicting inode. Signed-off-by: Miao Xie --- fs/btrfs/ctree.h |3 +++ fs/btrfs/extent-tree.c | 22 ++ fs/btrfs/inode.c |2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h inde

Re: wrong / too less space on raid

2011-11-27 Thread Miao Xie
On sun, 27 Nov 2011 13:45:22 +0100, source wrote: > before sending this mail, i tried to track down previous messages from > the archive and found no similar entry. so either something went wrong > on my machine only or maybe there are too less testers around. > > about the real problem/bug : > >

Re: wrong / too less space on raid

2011-11-28 Thread Miao Xie
fix wrong inaccurate available space on raid0 profile When we use raid0 as the data profile, df command may show us a very inaccurate value of the available space, which may be much less than the real one. It may make the users puzzled. Fix it by changing the calculation of the available space, and m

Re: [PATCH 1/1] btrfs: btrfs_calc_avail_data_space cope with no read/write devices V2

2011-11-28 Thread Miao Xie
On mon, 28 Nov 2011 06:11:06 -0600, Jonathan Nieder wrote: > Hi, > > Andy Whitcroft wrote: > >> When we mount a btrfs filesystem from read-only media there will be no >> read/write devices; for example mounting an SD card with its lock enabled. >> This triggers an immediate BUG during mount: >> >

Re: [GIT PULL] Btrfs updates

2011-12-05 Thread Miao Xie
7): > Btrfs: fix meta data raid-repair merge problem > > Dan Carpenter (1) commits (+5/-0): > btrfs scrub: handle -ENOMEM from init_ipath() > > Mike Fleetwood (1) commits (+1/-1): > Btrfs: Don't error on resizing FS to same size > > Miao Xie (1) comm

Re: BUG at fs/btrfs/inode.c:841!

2011-12-05 Thread Miao Xie
On mon, 05 Dec 2011 14:49:16 +0100, Jan Schmidt wrote: > While running xfstest 013 with Chris' for-linus on an ssd I hit this the > following bug. Before, the system was freshly bootet and all I did was > insmod and starting "./check" in the xfstests directory. I cannot > reproduce it so far: > >

Re: [GIT PULL] Btrfs updates

2011-12-05 Thread Miao Xie
On Mon, 5 Dec 2011 08:14:13 -0500, Chris Mason wrote: > On Mon, Dec 05, 2011 at 04:10:49PM +0800, Miao Xie wrote: >> Hi, Chris and Oliva >> >> On thu, 1 Dec 2011 10:39:55 -0500, Chris Mason wrote: >>> git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.

[PATCH 1/2] vfs: make writeback_in_progress() inline

2011-12-05 Thread Miao Xie
writeback_in_progress() is very simple, and we will use writeback_in_progress() in the module, so make it inline. Signed-off-by: Miao Xie --- fs/fs-writeback.c | 12 include/linux/backing-dev.h | 12 +++- 2 files changed, 11 insertions(+), 13 deletions

[PATCH 2/2] Btrfs: fix deadlock on sb->s_umount when doing umount

2011-12-05 Thread Miao Xie
>s_umount, if _trylock_ fails, it means the fs is on remounting or umounting. At this time, we will use the sync function of btrfs to sync all the delalloc file. It may waste lots of time, but as a corner case, we needn't care. Reported-by: Tsutomu Itoh Signed-off-by: Miao Xie --- fs/btrf

Re: [PATCH 1/2] vfs: make writeback_in_progress() inline

2011-12-05 Thread Miao Xie
cc Fengguang cc Linux-kernel On tue, 06 Dec 2011 13:35:45 +0800, Miao Xie wrote: > writeback_in_progress() is very simple, and we will use > writeback_in_progress() > in the module, so make it inline. > > Signed-off-by: Miao Xie > --- > fs/fs-writeba

Re: [PATCH 2/2] Btrfs: fix deadlock on sb->s_umount when doing umount

2011-12-05 Thread Miao Xie
On tue, 6 Dec 2011 05:49:06 +, Al Viro wrote: > >> +void btrfs_writeback_inodes_sb_nr(struct btrfs_root *root, >> + unsigned long nr_pages) >> +{ >> +struct super_block *sb = root->fs_info->sb; >> + >> +if (writeback_in_progress(sb->s_bdi)) >> +

Re: [PATCH 2/2] Btrfs: fix deadlock on sb->s_umount when doing umount

2011-12-06 Thread Miao Xie
On tue, 6 Dec 2011 04:59:23 -0500, Christoph Hellwig wrote: > On Tue, Dec 06, 2011 at 01:35:47PM +0800, Miao Xie wrote: >> The reason the deadlock is that: >> Task Btrfs-cleaner >> umount() >> down_write(&s->s_umount)

Re: [PATCH 2/2] Btrfs: fix deadlock on sb->s_umount when doing umount

2011-12-06 Thread Miao Xie
On tue, 6 Dec 2011 16:36:11 -0500, Chris Mason wrote: > On Tue, Dec 06, 2011 at 06:23:23AM -0500, Christoph Hellwig wrote: >> On Tue, Dec 06, 2011 at 07:06:40PM +0800, Miao Xie wrote: >>>> I can't see why you need the writeout when the trylocks fails. Umount >>>

Re: [PATCH 2/2] Btrfs: fix deadlock on sb->s_umount when doing umount

2011-12-07 Thread Miao Xie
On Wed, 7 Dec 2011 13:11:58 +0200, Ilya Dryomov wrote: > On Wed, Dec 07, 2011 at 10:31:35AM +0800, Miao Xie wrote: >> On tue, 6 Dec 2011 16:36:11 -0500, Chris Mason wrote: >>> On Tue, Dec 06, 2011 at 06:23:23AM -0500, Christoph Hellwig wrote: >>>> On Tue, Dec 06, 2011

[PATCH 1/2] Btrfs: fix wrong disk space information of the files

2011-12-13 Thread Miao Xie
beyond the end of the files. When we want to expand those files, we will drop those file extents, and put in dummy file extents, and then we should update the i-node. But btrfs forgets to do it. This patch adds the forgotten i-node update. Signed-off-by: Miao Xie --- fs/btrfs/inode.c |5

[PATCH 2/2] Btrfs: fix wrong i_size when truncating a file to a larger size

2011-12-13 Thread Miao Xie
enough space in the file system, so we found a wrong i_size. This patch fixes this bug by updating the i_size just when we pass the file expanding and get enough space to update i-node. Signed-off-by: Miao Xie --- fs/btrfs/inode.c | 18 -- 1 files changed, 12 insertions(+), 6

[PATCH] xfstests: open btrfsck to check the btrfs filesystem

2011-12-13 Thread Miao Xie
. Signed-off-by: Miao Xie --- common.rc | 54 ++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/common.rc b/common.rc index cab0b64..b42e46d 100644 --- a/common.rc +++ b/common.rc @@ -1299,6 +1299,54 @@ _check_xfs_test_fs

[PATCH RESEND] Btrfs: fix inaccurate available space on raid0 profile

2011-12-13 Thread Miao Xie
. Signed-off-by: Miao Xie --- fs/btrfs/super.c | 19 +-- 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 8bd9d6d..01de53a 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1079,7 +1079,7 @@ static int

Re: [PATCH] Btrfs: don't panic if orphan item already exists

2011-12-14 Thread Miao Xie
On wed, 14 Dec 2011 10:07:39 +0800, WuBo wrote: > On 12/14/2011 03:09 AM, Josef Bacik wrote: >> On Tue, Dec 13, 2011 at 02:03:14PM -0500, Phillip Susi wrote: >>> On 12/13/2011 12:55 PM, Josef Bacik wrote: I've been hitting this BUG_ON() in btrfs_orphan_add when running xfstest 269 i

Re: [PATCH] Btrfs: don't panic if orphan item already exists

2011-12-14 Thread Miao Xie
On wed, 14 Dec 2011 10:34:45 -0500, Josef Bacik wrote: > On Wed, Dec 14, 2011 at 10:14:13AM -0500, Phillip Susi wrote: >> On 12/14/2011 9:58 AM, Josef Bacik wrote: >>> There is no "underlying bug", there is a shitty situation, the shitty >>> situation >> >> Maybe my assumptions are wrong some

Re: [PATCH 2/2] Btrfs: fix wrong i_size when truncating a file to a larger size

2011-12-14 Thread Miao Xie
On Wed, 14 Dec 2011 11:51:47 -0500, Chris Mason wrote: > On Wed, Dec 14, 2011 at 03:15:53PM +0800, Miao Xie wrote: >> Btrfsck report error 100 after the 83th case of xfstests was run, it means >> the i_size of the file is wrong. >> >> The reason of this bug is that: &

[PATCH V2 2/2] Btrfs: fix wrong i_size when truncating a file to a larger size

2011-12-15 Thread Miao Xie
enough space in the file system, so we found a wrong i_size. This patch fixes this bug by updating the i_size just when we pass the file expanding. Signed-off-by: Miao Xie --- Changes v1 -> v2: - make i_size be accurate before truncate_pagecache() is called (use truncate_setsize()) --- fs/bt

[PATCH 1/3] Btrfs: fix btrfsck error 400 when truncating a compressed file extent

2012-01-05 Thread Miao Xie
bytes of the dropped range from i_blocks/i_bytes of i-node or not. When we truncate a compressed extent, btrfs substracts the bytes of the whole extent, it's wrong. We should substract the real size that we truncate, no matter it is a compressed extent or not. Fix it. Signed-off-by: Miao Xie --

[PATCH 2/3] Btrfs: make btrfs_truncate_inode_items() more readable

2012-01-05 Thread Miao Xie
As the title said, this patch just make the functions of the truncation more readable. Signed-off-by: Miao Xie --- fs/btrfs/inode.c | 289 ++ 1 files changed, 159 insertions(+), 130 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs

[RFC][PATCH 3/3] Btrfs: improve truncation of btrfs

2012-01-05 Thread Miao Xie
disadvantage of this patch. (Maybe I'm overcautious, we needn't hold that data.) Signed-off-by: Miao Xie --- fs/btrfs/inode.c | 159 +- 1 files changed, 49 insertions(+), 110 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/b

Re: [PATCH 2/3] Btrfs: make btrfs_truncate_inode_items() more readable

2012-01-05 Thread Miao Xie
On thu, 5 Jan 2012 10:11:43 -0500, Josef Bacik wrote: >> +extent_start = btrfs_file_extent_disk_bytenr(leaf, fi); >> +if (offset < new_size) { >> +/* >> + * If the new size is in the extent: >> + * +--+ >> + * |

Re: [RFC][PATCH 3/3] Btrfs: improve truncation of btrfs

2012-01-05 Thread Miao Xie
On thu, 5 Jan 2012 10:15:50 -0500, Josef Bacik wrote: >> +trans = btrfs_start_transaction(root, 2); >> +if (IS_ERR(trans)) >> +return PTR_ERR(trans); >> >> /* >> * setattr is responsible for setting the ordered_data_close flag, >> @@ -6621,26 +6585,12 @@ static int

Re: [RFC][PATCH 3/3] Btrfs: improve truncation of btrfs

2012-01-08 Thread Miao Xie
On Fri, 6 Jan 2012 09:50:31 -0500, Josef Bacik wrote: > On Fri, Jan 06, 2012 at 11:51:16AM +0800, Miao Xie wrote: >> On thu, 5 Jan 2012 10:15:50 -0500, Josef Bacik wrote: >>>> + trans = btrfs_start_transaction(root, 2); >>>> + if (IS_ERR(trans)) >

Re: [PATCH 1/3] Btrfs: fix btrfsck error 400 when truncating a compressed file extent

2012-01-08 Thread Miao Xie
On Sun, 8 Jan 2012 22:45:14 -0600, Mitch Harder wrote: > 2012/1/5 Miao Xie : >> Reproduce steps: >> # mkfs.btrfs /dev/sdb5 >> # mount /dev/sdb5 -o compress=lzo /mnt >> # dd if=/dev/zero of=/mnt/tmpfile bs=128K count=1 >> # sync >> # truncate -s 64K /mnt/

[PATCH V2 1/3] Btrfs: fix btrfsck error 400 when truncating a compressed file extent

2012-01-09 Thread Miao Xie
ff-by: Miao Xie --- Changes v1 -> v2: - None. --- fs/btrfs/inode.c |8 +--- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 13b0542..85e2312 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3009,7 +3009,

[PATCH V2 2/3] Btrfs: make btrfs_truncate_inode_items() more readable

2012-01-09 Thread Miao Xie
As the title said, this patch just make the functions of the truncation more readable. Signed-off-by: Miao Xie --- Changes v1 -> v2: - move return sentence out of if...else..., make the logic of the code more clear. --- fs/btrfs/inode.c |

[PATCH V2 3/3] Btrfs: improve truncation of btrfs

2012-01-09 Thread Miao Xie
within the range , because the user may take it for granted that the data in that extent is not lost. In order to implement it, we just write out all the dirty pages which are beyond the expected size of the file. Signed-off-by: Miao Xie --- Changes v1 -> v2: - None. --- fs/b

[PATCH] Btrfs: fix enospc error caused by wrong checks of the chunk allocation

2012-01-17 Thread Miao Xie
fix it by changing the value of CHUNK_ALLOC_LIMITED and CHUNK_ALLOC_FORCE, and make CHUNK_ALLOC_FORCE greater than CHUNK_ALLOC_LIMITED since CHUNK_ALLOC_FORCE has higher priority. And if the value which is passed in by the caller is greater than ->force_alloc, use the passed value. Signed-off-by

[RFC][PATCH 1/2] Btrfs: try to allocate new chunks with degenerated profile

2012-01-17 Thread Miao Xie
rule: RAID10 -> RAID1 -> DUP RAID0 -> SINGLE Signed-off-by: Miao Xie --- fs/btrfs/extent-tree.c | 43 +-- 1 files changed, 41 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3e68e2b..87cd611 100644

[RFC][PATCH 2/2] Btrfs: change the calculation of available space since the data profile can be degenerated

2012-01-17 Thread Miao Xie
t be used to allocate a DUP chunk, the other space will be considered as the available space, and be count. Signed-off-by: Miao Xie --- fs/btrfs/super.c | 105 +++-- 1 files changed, 22 insertions(+), 83 deletions(-) diff --git a/fs/btrfs/super.c b

Re: [RFC][PATCH 1/2] Btrfs: try to allocate new chunks with degenerated profile

2012-01-18 Thread Miao Xie
On wed, 18 Jan 2012 11:12:20 +0100, Jan Schmidt wrote: > On 17.01.2012 21:58, Chris Mason wrote: >> These two didn't make my first pull request just because I wanted to get >> something out the door. I'll definitely have them in the next pull. > > Please, don't do that! You can't just degene

[PATCH] Btrfs: fix deadlock on page lock when doing auto-defragment

2012-02-15 Thread Miao Xie
1 so deadlock happens. Fix this bug by unlocking the page which is in writeback, and re-locking it after the writeback end. Signed-off-by: Miao Xie --- fs/btrfs/ioctl.c | 53 + 1 files changed, 29 insertions(+), 24 deletions(-) diff --git a/f

[RFC][PATCH] Btrfs: introduce extent buffer cache for each i-node

2012-02-16 Thread Miao Xie
ch. I will cleanup it in the next version. Signed-off-by: Miao Xie --- fs/btrfs/btrfs_inode.h |3 + fs/btrfs/ctree.c | 358 ++-- fs/btrfs/ctree.h | 41 +- fs/btrfs/dir-item.c| 28 +++-- fs/btrfs/extent_io.c |2 +- fs/btrfs/f

Re: Deadlock while mounting with current for-linus

2012-02-21 Thread Miao Xie
Hi, Jan Schmidt On tue, 21 Feb 2012 08:56:29 +0100, Jan Schmidt wrote: > the current for-linus head as of today (d98456fc) gets stuck > in a deadlock when executing xfstest 083. This is the > corresponding output, preceeded by a related lockdep warning: > > Feb 21 08:30:52 oglaroon kernel: [56906

[PATCH] btrfs: fix wrong information of the directory in the snapshot

2012-02-22 Thread Miao Xie
an unexisted directory, it is very strange. So I think we should insert directory item and directory name index and update the parent inode as the last step of snapshot creation. Signed-off-by: Miao Xie --- fs/btrfs/inode.c |8 +++- fs/btrfs/transaction.c | 30

[PATCH 1/3] Btrfs-progs, btrfs-map-logical: Fix typo in usage

2012-02-22 Thread Miao Xie
The right option is 'o' not 'c'. And this tool is used for the block devices on which there is a btrfs file system, so change "mount_point" to "device". Signed-off-by: Miao Xie --- btrfs-map-logical.c |4 ++-- 1 files changed, 2 insertions(+)

[PATCH 2/3] Btrfs-progs, btrfs-corrupt-block: fix the wrong usage

2012-02-22 Thread Miao Xie
The old usage is a copy of btrfs-map-logical, it's wrong, fix it. Signed-off-by: Miao Xie --- This patch is against dangerdonteveruse branch. --- btrfs-corrupt-block.c | 14 -- 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/btrfs-corrupt-block.c b/btrfs-co

[PATCH 3/3] Btrfs-progs: fix btrfsck's snapshot wrong "unresolved refs"

2012-02-22 Thread Miao Xie
If the fs/file tree is not the parent of the snapshot, it is reasonable that we can not find the relative reference and back reference. But btrfsck doesn't consider this case, and reports "unresolved refs" message, it's wrong, fix it. Signed-off-by: Miao Xie -

[RFC PATCH 1/2] vfs: add an interface to do some preparation for umount

2012-03-21 Thread Miao Xie
Some file systems can do some works in the background by kthreads, we'd better stop those works before we umount the file system, or it is easy to introduce some problems. So we add an interface that is used to do some preparation for umount. Signed-off-by: Miao Xie --- fs/namesp

[RFC PATCH 2/2] Btrfs: fix deadlock on umount by umount_prepare interface

2012-03-21 Thread Miao Xie
em is to close the btrfs-cleaner before the umount is ready to continue. Since we have introduced umount_prepare interface into vfs before, we can fix this problem by it. Reported-by: Tsutomu Itoh Signed-off-by: Miao Xie --- fs/btrfs/disk-io.c | 15 --- fs/btrfs/su

Re: [RFC PATCH 2/2] Btrfs: fix deadlock on umount by umount_prepare interface

2012-03-21 Thread Miao Xie
On Thu, 22 Mar 2012 15:39:36 +1100, Dave Chinner wrote: > On Thu, Mar 22, 2012 at 11:13:17AM +0800, Miao Xie wrote: >> The reason the deadlock is that: >> Task Btrfs-cleaner >> umount() >> down_write(&s->s_umount) >

Re: [RFC PATCH 1/2] vfs: add an interface to do some preparation for umount

2012-03-21 Thread Miao Xie
On Thu, 22 Mar 2012 03:41:09 +, Al Viro wrote: > On Thu, Mar 22, 2012 at 11:13:15AM +0800, Miao Xie wrote: >> Some file systems can do some works in the background by kthreads, we'd >> better stop those works before we umount the file system, or it is easy to >> intr

[PATCH 1/4] vfs: introduce try_to_writeback_inodes_sb(_nr)

2012-04-25 Thread Miao Xie
from Christoph Hellwig. Some code is from the patch of Kamal Mostafa. Signed-off-by: Miao Xie --- fs/fs-writeback.c | 39 +++ include/linux/writeback.h |3 +++ 2 files changed, 42 insertions(+), 0 deletions(-) diff --git a/fs/fs-writeback.c b/fs

[PATCH 2/4] Btrfs: fix deadlock on sb->s_umount when doing umount

2012-04-25 Thread Miao Xie
it becomes readonly, so the sync operation will do nothing if the filesystem is already readonly. Though it may waste lots of time, as a corner case, we needn't care. Reported-by: Tsutomu Itoh Signed-off-by: Miao Xie --- fs/btrfs/disk-io.c |3 +++ fs/btrfs/extent-tree.c | 25 ++

Re: [PATCH 1/4] vfs: introduce try_to_writeback_inodes_sb(_nr)

2012-04-27 Thread Miao Xie
于 2012年04月26日 23:12, Josef Bacik 写道: > On Thu, Apr 26, 2012 at 03:55:52PM +0800, Xie Miao wrote: >> On Thu, Apr 26, 2012 at 11:11 AM, Dave Chinner wrote: writeback_inodes_sb(_nr) grabs s_umount lock when it want to start writeback, it may bring us deadlock problem when doing umount

Re: [PATCH 2/4] Btrfs: fix deadlock on sb->s_umount when doing umount

2012-04-27 Thread Miao Xie
>> The reason the deadlock is that: >> Task Btrfs-cleaner >> umount() >> down_write(&s->s_umount) >> sync_filesystem() >> do auto-defragment and produce >> lots of dirty page

[PATCH 2/2] Btrfs: flush all the dirty pages if try_to_writeback_inodes_sb_nr() fails

2012-04-29 Thread Miao Xie
goes from r/w to r/o. because the filesystem should guarantee all the dirty pages have been written into the disk after it becomes readonly, so the sync operation will do nothing if the filesystem is already readonly. Though it may waste lots of time, as a corner case, we needn't care. Signed-of

[PATCH 1/2] vfs: re-implement writeback_inodes_sb(_nr)_if_idle() and rename them

2012-04-29 Thread Miao Xie
ck_inodes_sb(_nr). This idea came from Christoph Hellwig. Some code is from the patch of Kamal Mostafa. Signed-off-by: Miao Xie --- fs/btrfs/extent-tree.c|4 ++-- fs/ext4/inode.c |2 +- fs/fs-writeback.c | 45

Re: [PATCH 2/4] Btrfs: fix deadlock on sb->s_umount when doing umount

2012-05-08 Thread Miao Xie
On Mon, 30 Apr 2012 18:41:39 +0200, David Sterba wrote: > On Fri, Apr 27, 2012 at 06:55:13PM +0800, Miao Xie wrote: >> But I found you add a trylock for ->s_umount in cleaner_kthread(), this >> method >> can fix the deadlock problem, I think. It may be introduced by the o

Re: [PATCH 2/4] Btrfs: fix deadlock on sb->s_umount when doing umount

2012-05-08 Thread Miao Xie
On Tue, 8 May 2012 17:33:26 +0200, David Sterba wrote: > On Tue, May 08, 2012 at 06:38:01PM +0800, Miao Xie wrote: >> I think this method can not fix the problem safely because if the other >> background threads(not the cleaner) call shrink_delalloc(), the problem >> can sti

Re: 3.4-rc6: delayed alloc deadlock...

2012-05-08 Thread Miao Xie
when they are reacquired. Fix this problem by unlocking those mutexes at the suitable place. Reported-by: Daniel J Blueman Signed-off-by: Miao Xie --- fs/btrfs/delayed-ref.c |8 fs/btrfs/delayed-ref.h |7 +++ fs/btrfs/extent-tree.c | 24 ++-- 3 file

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

2013-03-24 Thread Miao Xie
riters) == 1); And if we block the TRANS_JOIN at the place you point out, the deadlock will happen because we need deal with the ordered operations which will use TRANS_JOIN here. (I am dealing with the problem you said above by adding a new type of TRANS_* now) Thanks Miao > Thanks, > Ale

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

2013-03-28 Thread Miao Xie
e function - btrfs_csum_file_blocks() didn't differentiate between these two types of the cases, fix it. Signed-off-by: Miao Xie --- 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/fi

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

2013-03-28 Thread Miao Xie
-> 217us). # dd if=/file of=/dev/null bs=1M count=1024 Signed-off-by: Miao Xie --- 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
ile loop to get 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 --- 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 --

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

2013-03-28 Thread Miao Xie
ile loop to get 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 ---

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

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

2013-04-03 Thread Miao Xie
-> 217us). # dd if=/file of=/dev/null bs=1M count=1024 Signed-off-by: Miao Xie --- 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

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

2013-04-03 Thread Miao Xie
it improved 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 Reviewed-by: Liu Bo --- Changelog v1 -> v2: - modify the changelog and the title which can not explain this patch cl

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

2013-04-05 Thread Miao Xie
-> 217us). # dd if=/file of=/dev/null bs=1M count=1024 Signed-off-by: Miao Xie --- 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/extent_io.

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

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

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

2013-04-10 Thread Miao Xie
state, we block TRANS_JOIN, but don't block TRANS_JOIN_ENDIO. Thanks Miao > > Thanks, > Alex. > > > > On Mon, Mar 25, 2013 at 11:11 AM, Alex Lyakas > wrote: >> Hi Miao, >> >> On Mon, Mar 25, 2013 at 3:51 AM, Miao Xie wrote: >>

[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 --- fs/btrfs/super.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/btrfs

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

2013-04-11 Thread Miao Xie
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 --- fs/btrfs/ctree.h | 22 -- fs/btrfs/disk-io.c | 5 + fs/btrfs/volumes.c | 10 +- 3 files changed, 26 insertions(+), 11 deletions(-) diff

[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

[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 Cc: Mark F

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

2013-04-11 Thread Miao Xie
this function. Signed-off-by: Miao Xie Cc: Mark Fasheh --- 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 deletions(-) diff --git a/fs/

[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 Cc: Mark Fasheh --- m

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 INCOMP

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

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_ext

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

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

2013-04-25 Thread Miao Xie
unk() just requires that the free space is 1 time the size of the global reservation, that is we would not try to allocate a new chunk if the free space size is in the middle of these two requires, and just return the enospc error. Fix it. Cc: Jim Schutt Cc: Josef Bacik Signed-off-by: Miao Xi

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

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

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

[PATCH V3] Btrfs: remove btrfs_sector_sum structure

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

[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
problem. So we need not abort the current transaction. Reported-by: Tsutomu Itoh Signed-off-by: Miao Xie --- 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..9818d4a 100644 --- a/fs/btrfs/inode

[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 Signed-off-by: Miao Xie --- fs/btrfs/extent-tree.c | 6

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

2013-05-13 Thread Miao Xie
ourselves. Cc: Tsutomu Itoh Signed-off-by: Miao Xie --- 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/relocation.c | 5 + 5 files

[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 Signed-off-by: Miao Xie --- 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 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs

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

2013-05-13 Thread Miao Xie
cc: Tsutomu Itoh Signed-off-by: Miao Xie --- 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..e34e268 100644 --- a/fs/btrfs/extent-tree.c

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

2013-05-13 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 @@

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

2013-05-14 Thread Miao Xie
to remove ->s_umount in cleaner_kthread(). Cc: David Sterba Signed-off-by: Miao Xie --- 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..cb2bfd1 100644 --- a/fs

  1   2   3   4   5   6   7   8   9   10   >