Re: btrfs hang in flush-btrfs-5

2011-07-13 Thread Josef Bacik
On 07/11/2011 05:21 PM, Jeremy Sanders wrote: Josef Bacik wrote: On 07/11/2011 07:40 AM, Jeremy Sanders wrote: Jeremy Sanders wrote: Hi - I'm trying btrfs with kernel 2.6.38.8-32.fc15.x86_64 (a Fedora kernel). I'm just doing a tar-to-tar copy onto the file system with compress-

Re: Delayed inode operations not doing the right thing with enospc

2011-07-13 Thread Josef Bacik
On 07/12/2011 11:20 AM, Christian Brunner wrote: 2011/6/7 Josef Bacik jo...@redhat.com: On 06/06/2011 09:39 PM, Miao Xie wrote: On fri, 03 Jun 2011 14:46:10 -0400, Josef Bacik wrote: I got a lot of these when running stress.sh on my test box This is because use_block_rsv() is having to do

[PATCH] Btrfs: don't print the leaf if we had an error

2011-07-13 Thread Josef Bacik
In __btrfs_free_extent we will print the leaf if we fail to find the extent we wanted, but the problem is if we get an error we won't have a leaf so often this leads to a NULL pointer dereference and we lose the error that actually occurred. So only print the leaf if ret 0, which means we didn't

[PATCH 00/16] Btrfs: fixes and cleanups for 3.1

2011-07-13 Thread Li Zefan
The first 4 patches are bug-fixes, and the remaining are small cleanups that have sit in my git tree for some time. The first 3 patches have been sent to the list before. We save some bytes after this patchset: textdata bss dec hex filename 42638738541024 431265

[PATCH 01/16] Btrfs: copy string correctly in INO_LOOKUP ioctl

2011-07-13 Thread Li Zefan
Memory areas [ptr, ptr+total_len] and [name, name+total_len] may overlap, so it's wrong to use memcpy(). Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index

[PATCH 02/16] Btrfs: fix space leak when skipping small extents during trimming

2011-07-13 Thread Li Zefan
We're taking a free space extent out of the free space cache, trimming it and then putting it back into the cache. However for an extent that is smaller than the specified minimum length, it's taken out but won't be put back, which causes space leak. Signed-off-by: Li Zefan l...@cn.fujitsu.com

[PATCH 03/16] Btrfs: fix space leak when trimming free extents

2011-07-13 Thread Li Zefan
When the end of an extent exceeds the end of the specified range, the extent will be accidentally truncated. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/free-space-cache.c

[PATCH 05/16] Btrfs: use wait_event()

2011-07-13 Thread Li Zefan
Use wait_event() when possible to avoid code duplication. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/transaction.c | 59 +-- 1 files changed, 7 insertions(+), 52 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c

[PATCH 06/16] Btrfs: remove a BUG_ON() in btrfs_commit_transaction()

2011-07-13 Thread Li Zefan
wait_for_commit() always returns 0. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/transaction.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 34a30ea..40726ac 100644 --- a/fs/btrfs/transaction.c +++

[PATCH 07/16] Btrfs: remove remaining ref-cache code

2011-07-13 Thread Li Zefan
Since commit f2a97a9dbd86eb1ef956bdf20e05c507b32beb96 (btrfs: remove all unused functions), there's no extern functions at all in ref-cache.c, so just remove the remaining dead code. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ref-cache.c | 68

[PATCH 08/16] Btrfs: make acl functions really no-op if acl is not enabled

2011-07-13 Thread Li Zefan
So there's no overhead for something we don't use. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/Makefile |4 +++- fs/btrfs/acl.c| 17 - fs/btrfs/ctree.h | 15 --- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git

[PATCH 09/16] Btrfs: remove redundant code for dir item lookup

2011-07-13 Thread Li Zefan
When we search a dir item with a specific hash code, we can just return NULL without further checking if btrfs_search_slot() returns 1. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/dir-item.c | 30 ++ 1 files changed, 2 insertions(+), 28 deletions(-)

[PATCH 10/16] Btrfs: clean up search_extent_mapping()

2011-07-13 Thread Li Zefan
rb_node returned by __tree_search() can be a valid pointer or NULL, but won't be some errno. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/extent_map.c | 17 +++-- 1 files changed, 3 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/extent_map.c

[PATCH 11/16] Btrfs: clean up code for extent_map lookup

2011-07-13 Thread Li Zefan
lookup_extent_map() and search_extent_map() can share most of code. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/extent_map.c | 85 + 1 files changed, 29 insertions(+), 56 deletions(-) diff --git a/fs/btrfs/extent_map.c

[PATCH 12/16] Btrfs: clean up code for merging extent maps

2011-07-13 Thread Li Zefan
unpin_extent_cache() and add_extent_mapping() shares the same code that merges extent maps. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/extent_map.c | 59 +--- 1 files changed, 21 insertions(+), 38 deletions(-) diff --git

[PATCH 13/16] Btrfs: remove unused members from struct extent_state

2011-07-13 Thread Li Zefan
From: Xiao Guangrong xiaoguangr...@cn.fujitsu.com These members are not used at all. Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/extent_io.h |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git

[PATCH 14/16] Btrfs: clean up for insert_state()

2011-07-13 Thread Li Zefan
From: Xiao Guangrong xiaoguangr...@cn.fujitsu.com Don't duplicate set_state_bits(). Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/extent_io.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 15/16] Btrfs: clean up for wait_extent_bit()

2011-07-13 Thread Li Zefan
From: Xiao Guangrong xiaoguangr...@cn.fujitsu.com We can just use cond_resched_lock(). Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/extent_io.c |6 +- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git

[PATCH 16/16] Btrfs: clean up for find_first_extent_bit()

2011-07-13 Thread Li Zefan
From: Xiao Guangrong xiaoguangr...@cn.fujitsu.com find_first_extent_bit() and find_first_extent_bit_state() share most of the code, and we can just make the former call the latter. Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com Signed-off-by: Li Zefan l...@cn.fujitsu.com ---

Re: Mis-Design of Btrfs?

2011-07-13 Thread NeilBrown
On Wed, 29 Jun 2011 10:29:53 +0100 Ric Wheeler rwhee...@redhat.com wrote: On 06/27/2011 07:46 AM, NeilBrown wrote: On Thu, 23 Jun 2011 12:53:37 +0200 Nico Schottelius nico-lkml-20110...@schottelius.org wrote: Good morning devs, I'm wondering whether the raid- and