Re: Oops on btrfs filesystem balance

2010-03-25 Thread Wu Fengguang
On Fri, Mar 26, 2010 at 11:40:51AM +0800, Yan, Zheng wrote: > On Thu, Mar 25, 2010 at 9:06 PM, Kirill A. Shutemov > wrote: > > On lastest Linus' git. > > > > [ 4005.426805] BUG: unable to handle kernel NULL pointer dereference at > > 0021 > > [ 4005.426818] IP: [] page_cache_sync_readahead+0

Re: Oops on btrfs filesystem balance

2010-03-25 Thread Yan, Zheng
On Thu, Mar 25, 2010 at 9:06 PM, Kirill A. Shutemov wrote: > On lastest Linus' git. > > [ 4005.426805] BUG: unable to handle kernel NULL pointer dereference at > 0021 > [ 4005.426818] IP: [] page_cache_sync_readahead+0x18/0x3e > [ 4005.426837] *pde = > [ 4005.426844] Oops: [#1]

Re: [PATCH V3 17/18] Btrfs: Full direct I/O and AIO read implementation.

2010-03-25 Thread jim owens
Andi Kleen wrote: > On Wed, Mar 24, 2010 at 11:08:07PM -0400, jim owens wrote: >> Agree, so the write design needs to prevent bad checksums. > > How? Do you have a plan for that? Yes... have Josef do it. ;) The options I considered are: 1 - buffer always for uncompressed, the same as compressed.

[PATCH 15/16] BTRFS ioctl.c: duplicated include

2010-03-25 Thread Andrea Gelmini
fs/btrfs/ioctl.c: ctree.h is included more than once. Signed-off-by: Andrea Gelmini --- fs/btrfs/ioctl.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 2845c6c..5c9f8b3 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -48

Oops on btrfs filesystem balance

2010-03-25 Thread Kirill A. Shutemov
On lastest Linus' git. [ 4005.426805] BUG: unable to handle kernel NULL pointer dereference at 0021 [ 4005.426818] IP: [] page_cache_sync_readahead+0x18/0x3e [ 4005.426837] *pde = [ 4005.426844] Oops: [#1] PREEMPT SMP [ 4005.426854] last sysfs file: /sys/devices/LNXSYSTM:00/LNXSY

Re: [PATCH 01/18] btrfs: Remove u64 conversion for PAGE_CACHE_SIZE

2010-03-25 Thread Chris Mason
On Thu, Mar 25, 2010 at 08:27:26PM +0800, Miao Xie wrote: > From: Zhao Lei > > We don't need to convert PAGE_CACHE_SIZE to u64 in bit operation. For code like this: u64 size = (some number that doesn't fit in 32 bits) if (size & (PAGE_CACHE_SIZE - 1)) { } The answer should be the same either

[PATCH 3/3] btrfs-progs: fix wrong return value

2010-03-25 Thread Miao Xie
From: Miao Xie btrfsctl returns 1 if it does something successfully. this patch fixes this problem. Signed-off-by: Miao Xie --- btrfsctl.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/btrfsctl.c b/btrfsctl.c index be6bf25..e2aae17 100644 --- a/btrfsctl.c +++ b/bt

[PATCH 2/3] btrfs-progs: Avoid uninitialized variant compile warning

2010-03-25 Thread Miao Xie
From: Zhao Lei When we compile btrfs-progs in RHEL5(with default gcc version 4.1.2 20070626), we can get following error: cc1: warnings being treated as errors btrfs-list.c: In function 'find_updated_files': btrfs-list.c:668: warning: 'disk_offset' may be used uninitialized in this function btr

[PATCH 1/3] btrfs-progs: Fix a compile fail by strndup in RHEL5 env

2010-03-25 Thread Miao Xie
From: Zhao Lei When we compile btrfs-progs in RHEL5(with default gcc 4.1.2 and glibc-2.5-18), we can get following error: cc1: warnings being treated as errors btrfs-list.c: In function 'ino_resolve': btrfs-list.c:511: warning: implicit declaration of function 'strndup' btrfs-list.c:511: warning

[PATCH 18/18] btrfs: fix extent buffer pages release

2010-03-25 Thread Miao Xie
From: Miao Xie try_release_extent_buffer() releases the first page of extent buffer early, and it may cause oops, because extent_buffer_page() gets the other pages by the first page's ->mapping. So we must release the first page at the end. This patch fixes this problem. And In order to avoid ma

[PATCH 17/18] btrfs: add NULL check for build_backref_tree()

2010-03-25 Thread Miao Xie
From: Miao Xie if passing NULL to btrfs_free_path(),oops will happen. so we must check the pointer passed to it. Signed-off-by: Miao Xie --- fs/btrfs/relocation.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 0

[PATCH 16/18] btrfs: add NULL check for do_walk_down()

2010-03-25 Thread Miao Xie
From: Miao Xie btrfs_find_create_tree_block() may return NULL, so we must check the returned value, or we will access a NULL pointer. Signed-off-by: Miao Xie --- fs/btrfs/extent-tree.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrf

[PATCH 15/18] btrfs: cleanup redundant code in btrfs_search_forward()

2010-03-25 Thread Miao Xie
From: Miao Xie ret in btrfs_search_forward() has been set to 1, so it is unnecessary to set it to 1 again when some error happens. Cleanup these redundant code. Signed-off-by: Miao Xie --- fs/btrfs/ctree.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/

[PATCH 14/18] btrfs: Simplify write_ctree_super()

2010-03-25 Thread Miao Xie
From: Zhao Lei Remove a useless local variant and return it directly. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/disk-io.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 79d9196..731270f 100644 --- a

[PATCH 13/18] btrfs: Remove unnecessary finish_wait() in wait_current_trans()

2010-03-25 Thread Miao Xie
From: Zhao Lei We only need to call finish_wait() after wait loop. By the way, this patch makes code of waiting loop similar to example in wait.h(no functional change) Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/transaction.c | 15 +-- 1 files changed, 5 insert

[PATCH 12/18] btrfs: Add error handle for btrfs_search_slot() in btrfs_read_chunk_tree()

2010-03-25 Thread Miao Xie
From: Zhao Lei We need to check return value of btrfs_search_slot() in btrfs_read_chunk_tree() and do corresponding error handing. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/volumes.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/volumes.

[PATCH 11/18] btrfs: Simplify btrfs_search_slot() for performance

2010-03-25 Thread Miao Xie
From: Zhao Lei This patch include following modify: 1: It isn't necessary to use following type of goto statement: if (cow) { if (!should_cow_block(trans, root, b)) goto cow_done; ... } cow_done: ... 2: Updating of p->nodes[level] is only necessa

[PATCH 10/18] btrfs: Remove unnecessary variant processing in submit_one_bio()

2010-03-25 Thread Miao Xie
From: Zhao Lei start and end are never used in this function, we don't need to declare them and calculate these value. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/extent_io.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/extent_io.c b/f

[PATCH 09/18] btrfs: Fix return value of read_extent_buffer_pages() when lock page failed

2010-03-25 Thread Miao Xie
From: Zhao Lei read_extent_buffer_pages() should return error value instead of 0 when lock page failed, we fix this problem. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/extent_io.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/extent_io.

[PATCH 08/18] btrfs: Simplify num_stripes's calculation logical for __btrfs_alloc_chunk()

2010-03-25 Thread Miao Xie
From: Zhao Lei We can use this simple method to make source more readable. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/volumes.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 844c393..3ae1f42 100644 -

[PATCH 07/18] btrfs: Fix a BUG_ON boundary typo

2010-03-25 Thread Miao Xie
From: Zhao Lei logical's value should be [em->start, em->start + em->len), so we need to use BUG_ON(em->start > logical || em->start + em->len <= logical); instead of BUG_ON(em->start > logical || em->start + em->len < logical); Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs

[PATCH 06/18] Btrfs: Remove unnecessary variant in __tree_search

2010-03-25 Thread Miao Xie
From: Zhao Lei "prev_entry"'s value is same as "entry" in reference. We can use "entry" only in these function without readability impact. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/extent_map.c | 14 ++ fs/btrfs/ordered-data.c | 16 +++- 2 file

[PATCH 05/18] btrfs: Take num_copies out of loop for btree_read_extent_buffer_pages()

2010-03-25 Thread Miao Xie
From: Zhao Lei num_copies's value is not changed in this function, and it is not necessary to calculate its value multi-times. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/disk-io.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/disk-io.c

[PATCH 04/18] btrfs: Simplify btrfs_item_ptr macro

2010-03-25 Thread Miao Xie
From: Zhao Lei btrfs_item_ptr is just a type_cast wrapper of btrfs_item_ptr_offset(). We can use btrfs_item_ptr_offset() in btrfs_item_ptr() to avoid code duplication. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/ctree.h |6 ++ 1 files changed, 2 insertions(+), 4 dele

[PATCH 03/18] btrfs: Calculate member variant's address directly for btrfs_set_##name

2010-03-25 Thread Miao Xie
From: Zhao Lei It can decrease a additional address calculation and increase little speed. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/struct-funcs.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/struct-funcs.c b/fs/btrfs/struct-fu

[PATCH 02/18] btrfs: Calculate member variant's address directly for btrfs_##name

2010-03-25 Thread Miao Xie
From: Zhao Lei It can decrease a additional address calculation and increase little speed. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/struct-funcs.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/struct-funcs.c b/fs/btrfs/struct-fu

[PATCH 01/18] btrfs: Remove u64 conversion for PAGE_CACHE_SIZE

2010-03-25 Thread Miao Xie
From: Zhao Lei We don't need to convert PAGE_CACHE_SIZE to u64 in bit operation. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- fs/btrfs/compression.c |2 +- fs/btrfs/extent_io.c | 16 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/compre

Re: [PATCH V3 17/18] Btrfs: Full direct I/O and AIO read implementation.

2010-03-25 Thread Andi Kleen
On Wed, Mar 24, 2010 at 11:08:07PM -0400, jim owens wrote: > Andi Kleen wrote: > > > On Tue, Mar 23, 2010 at 05:40:00PM -0400, jim owens wrote: > >> >> Andi Kleen wrote: > >> >> > >> >> With checksums enabled, uncompressed reads aligned on the 4k block > >> >> are classic direct IO to user memory e