Blcoked for more than 120 seconds

2011-11-28 Thread Tobias
Hi! I have two Hardware-Raid Arrays. Each encrypted with dmcrypt and on each one btrfs on it (without snapshots). They are half-filled I do rsyncs on these fs over night and i get these errors: INFO: task flush-btrfs-2:1472 blocked for more than 120 seconds. echo 0

[PATCH] Btrfs: fix oops when calling statfs on readonly device

2011-11-28 Thread Li Zefan
To reproduce this bug: # dd if=/dev/zero of=img bs=1M count=256 # mkfs.btrfs img # losetup -r /dev/loop1 img # mount /dev/loop1 /mnt OOPS!! It triggered BUG_ON(!nr_devices) in btrfs_calc_avail_data_space(). To fix this, instead of checking write-only devices, we check all open

[PATCH] Btrfs: check if the to-be-added device is writable

2011-11-28 Thread Li Zefan
If we call ioctl(BTRFS_IOC_ADD_DEV) directly, we'll succeed in adding a readonly device to a btrfs filesystem, and btrfs will write to that device, emitting kernel errors: [ 3109.833692] lost page write due to I/O error on loop2 [ 3109.833720] lost page write due to I/O error on loop2 ...

Re: Blcoked for more than 120 seconds

2011-11-28 Thread Chris Samuel
Hi Tobias, On Mon, 28 Nov 2011, 19:16:25 EST, Tobias tra...@robotech.de wrote: The problem occurs on the stock ubuntu kernel 2.6.38-8, 3.0.0-12, 3.0.0-13 and on my self-compiled 3.1.2. There's a lot of work gone into btrfs in 3.2, it would be interesting to know (speaking as just another

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

2011-11-28 Thread Jonathan Nieder
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: kernel BUG at .../fs/btrfs/super.c:984! [...] BugLink:

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

2011-11-28 Thread Andy Whitcroft
On Mon, Nov 28, 2011 at 06:11:06AM -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:

[PATCH] Btrfs: initialize new bitmaps' list

2011-11-28 Thread Alexandre Oliva
We're failing to create clusters with bitmaps because setup_cluster_no_bitmap checks that the list is empty before inserting the bitmap entry in the list for setup_cluster_bitmap, but the list field is only initialized when it is restored from the on-disk free space cache, or when it is written

Re: [PATCH 0/5] fix bugs of sub transid

2011-11-28 Thread David Sterba
On Mon, Nov 21, 2011 at 06:10:19PM +0800, Liu Bo wrote: We've been sufferring two big bugs with sub transid: one is a bug related to root's last_snapshot, the other is a bug related to disk extent refs' generation. Do you have a testcase to trigger and check these bugs? 1) The first patch

[PATCH] Btrfs-progs: tool to visualize fragmentation

2011-11-28 Thread Arne Jansen
This tool draws per-chunk pngs representing the allocation map. A black or colored dot means the block is allocated. The output is written to a subdirectory, together with an index.html to be viewed in a browser. There are options to control whether color should be used and which block group types

btrfs/git question.

2011-11-28 Thread Ken D'Ambrosio
Seems I've picked up a wireless regression, and randomly drop my WiFi connection with more recent kernels. While I'd love to try to track down the issue, the sporadic nature makes it difficult. But I don't want to revert to a flat-out old kernel because of all the btrfs modifications. Is it

[PATCH 03/20] Btrfs: fix comment typo

2011-11-28 Thread Alexandre Oliva
--- fs/btrfs/extent-tree.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 5d86877..bc0f13d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5304,7 +5304,7 @@ alloc: /*

[PATCH 00/20] Here's my current btrfs patchset

2011-11-28 Thread Alexandre Oliva
The first 11 patches are relatively simple fixes or improvements that I suppose go could make it even in 3.2 (02 is particularly essential to avoid progressive performance degradation and metadata space waste in the default clustered allocation strategy). Patch 12 and its complement 15, and also

[PATCH 16/20] Btrfs: try cluster but don't advance in search list

2011-11-28 Thread Alexandre Oliva
When we find an existing cluster, we switch to its block group as the current block group, possibly skipping multiple blocks in the process. Furthermore, under heavy contention, multiple threads may fail to allocate from a cluster and then release just-created clusters just to proceed to create

[PATCH 07/20] Btrfs: don't set up allocation result twice

2011-11-28 Thread Alexandre Oliva
We store the allocation start and length twice in ins, once right after the other, but with intervening calls that may prevent the duplicate from being optimized out by the compiler. Remove one of the assignments. Signed-off-by: Alexandre Oliva ol...@lsd.ic.unicamp.br --- fs/btrfs/extent-tree.c

[PATCH 04/20] Btrfs: reset cluster's max_size when creating bitmap cluster

2011-11-28 Thread Alexandre Oliva
The field that indicates the size of the largest contiguous chunk of free space in the cluster is not initialized when setting up bitmaps, it's only increased when we find a larger contiguous chunk. We end up retaining a larger value than appropriate for highly-fragmented clusters, which may

[PATCH 19/20] Btrfs: log when a bitmap is rejected for a cluster

2011-11-28 Thread Alexandre Oliva
--- fs/btrfs/free-space-cache.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 953f7dd..0151274 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -2316,6 +2316,16 @@

[PATCH 18/20] Btrfs: add -o mincluster option

2011-11-28 Thread Alexandre Oliva
With -o mincluster, we save the location of the last successful allocation, so as to emulate some of the cluster allocation logic (though not non-bitmap preference) without actually going through the exercise of allocating clusters. Signed-off-by: Alexandre Oliva ol...@lsd.ic.unicamp.br ---

[PATCH 14/20] Btrfs: introduce option to rebalance only metadata

2011-11-28 Thread Alexandre Oliva
Experimental patch to be able to compact only the metadata after excessive block groups are created. I guess it should be implemented as a balance option rather than a separate ioctl, but this was good enough for me to try it. Signed-off-by: Alexandre Oliva ol...@lsd.ic.unicamp.br ---

[PATCH 05/20] Btrfs: start search for new cluster at the beginning of the block group

2011-11-28 Thread Alexandre Oliva
Instead of starting at zero (offset is always zero), request a cluster starting at search_start, that denotes the beginning of the current block group. Signed-off-by: Alexandre Oliva ol...@lsd.ic.unicamp.br --- fs/btrfs/extent-tree.c |6 ++ 1 files changed, 2 insertions(+), 4

[PATCH 20/20] Btrfs: don't waste metadata block groups for clustered allocation

2011-11-28 Thread Alexandre Oliva
We try to maintain about 1% of the filesystem space in free space in data block groups, but we need not do that for metadata, since we only allocate one block at a time. This patch also moves the adjustment of flags to account for mixed data/metadata block groups into the block protected by spin

[PATCH 09/20] Btrfs: skip allocation attempt from empty cluster

2011-11-28 Thread Alexandre Oliva
If we don't have a cluster, don't bother trying to allocate from it, jumping right away to the attempt to allocate a new cluster. Signed-off-by: Alexandre Oliva ol...@lsd.ic.unicamp.br --- fs/btrfs/extent-tree.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git

[PATCH 12/20] Btrfs: introduce verbose debug mode for patched clustered allocation recovery

2011-11-28 Thread Alexandre Oliva
This patch adds several debug messages that helped me track down problems in the cluster allocation logic. All the messages are disabled by default, so that they're optimized away, but enabling the commented-out settings of debug brings some helpful messages. Signed-off-by: Alexandre Oliva

[PATCH 02/20] Btrfs: initialize new bitmaps' list

2011-11-28 Thread Alexandre Oliva
We're failing to create clusters with bitmaps because setup_cluster_no_bitmap checks that the list is empty before inserting the bitmap entry in the list for setup_cluster_bitmap, but the list field is only initialized when it is restored from the on-disk free space cache, or when it is written

[PATCH 15/20] Btrfs: activate allocation debugging

2011-11-28 Thread Alexandre Oliva
Activate various messages that help track down clustered allocation problems, that are disabled and optimized out by default. Signed-off-by: Alexandre Oliva ol...@lsd.ic.unicamp.br --- fs/btrfs/extent-tree.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git

[PATCH 08/20] Btrfs: try to allocate from cluster even at LOOP_NO_EMPTY_SIZE

2011-11-28 Thread Alexandre Oliva
If we reach LOOP_NO_EMPTY_SIZE, we won't even try to use a cluster that others might have set up. Odds are that there won't be one, but if someone else succeeded in setting it up, we might as well use it, even if we don't try to set up a cluster again. Signed-off-by: Alexandre Oliva

[PATCH 01/20] Btrfs: enable removal of second disk with raid1 metadata

2011-11-28 Thread Alexandre Oliva
Enable removal of a second disk even if that requires conversion of metadata from raid1 to dup, but not when data would lose replication. Signed-off-by: Alexandre Oliva ol...@lsd.ic.unicamp.br --- fs/btrfs/volumes.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git

[PATCH 10/20] Btrfs: report reason for failed relocation

2011-11-28 Thread Alexandre Oliva
btrfs filesystem balance sometimes fails on corrupted filesystems, but without any information that explains what the failure was to help track down the problem. This patch adds logging for nearly all error conditions that may cause relocation to fail. Signed-off-by: Alexandre Oliva

Re: Segmentation Faults

2011-11-28 Thread Timothy Crone
Dear David and Liu, I need to reclaim the drive space being taken up by this perhaps corrupt btrfs file system. Is there any additional information you would like before this problem will no longer be reproducible? Thanks, Tim On Fri, Nov 25, 2011 at 11:25 AM, Timothy Crone tjcr...@gmail.com

[PATCH 06/20] Btrfs: skip block groups without enough space for a cluster

2011-11-28 Thread Alexandre Oliva
We test whether a block group has enough free space to hold the requested block, but when we're doing clustered allocation, we can save some cycles by testing whether it has enough room for the cluster upfront, otherwise we end up attempting to set up a cluster and failing. Only in the

[PATCH 11/20] Btrfs: note when a bitmap is skipped because its list is in use

2011-11-28 Thread Alexandre Oliva
Bitmap lists serve two purposes: recording the order of loading/saving on-disk free space caches, and setting up a list of bitmaps to try to set up a cluster. Complain if a list is unexpectedly busy. Signed-off-by: Alexandre Oliva ol...@lsd.ic.unicamp.br --- fs/btrfs/free-space-cache.c |7

[PATCH 17/20] Btrfs: introduce -o cluster and -o nocluster

2011-11-28 Thread Alexandre Oliva
Introduce -o nocluster to disable the use of clusters for extent allocation, and -o cluster to reverse it. Signed-off-by: Alexandre Oliva ol...@lsd.ic.unicamp.br --- fs/btrfs/ctree.h |3 ++- fs/btrfs/extent-tree.c |2 +- fs/btrfs/super.c | 16 ++-- 3 files

[PATCH 13/20] Btrfs: revamp clustered allocation logic

2011-11-28 Thread Alexandre Oliva
Parameterize clusters on minimum total size, minimum chunk size and minimum contiguous size for at least one chunk, without limits on cluster, window or gap sizes. Don't tolerate any fragmentation for SSD_SPREAD; accept it for metadata, but try to keep data dense. Signed-off-by: Alexandre Oliva

Re: [patch 07/99] btrfs: Use mempools for extent_state structures

2011-11-28 Thread Andi Kleen
Jeff Mahoney je...@suse.com writes: The extent_state structure is used at the core of the extent i/o code for managing flags, locking, etc. It requires allocations deep in the write code and if failures occur they are difficult to recover from. We avoid most of the failures by using a

Re: [patch 07/99] btrfs: Use mempools for extent_state structures

2011-11-28 Thread Jeff Mahoney
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/28/2011 06:53 PM, Andi Kleen wrote: Jeff Mahoney je...@suse.com writes: The extent_state structure is used at the core of the extent i/o code for managing flags, locking, etc. It requires allocations deep in the write code and if failures

Re: [PATCH 2/2] Btrfs: set the i_nlink to 2 for an initial dir inode

2011-11-28 Thread David Sterba
On Mon, Nov 28, 2011 at 03:47:20PM +0800, Jeff Liu wrote: For an initial dir inode, stat(1) show it links as 1, IMHO it should be 2 by default. Yes, this is correct for directories. And newly created subvolumes should have nlink == 2 as well, can you please add it to your patch? (I have tested

Re: [PATCH 0/5] fix bugs of sub transid

2011-11-28 Thread Liu Bo
On 11/28/2011 11:10 PM, David Sterba wrote: On Mon, Nov 21, 2011 at 06:10:19PM +0800, Liu Bo wrote: We've been sufferring two big bugs with sub transid: one is a bug related to root's last_snapshot, the other is a bug related to disk extent refs' generation. Do you have a testcase to

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

2011-11-28 Thread Li Zefan
Andy Whitcroft wrote: On Mon, Nov 28, 2011 at 06:11:06AM -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

kernel BUG at /build/buildd/linux-3.2.0/fs/btrfs/extent-tree.c:4816!

2011-11-28 Thread Karl Mardoff Kittilsen
Hi! Sending a mail on this issue, as advised on IRC. My /home file system fails to mount and the kernel seem to freeze and I need to do the Alt+SysRq RSNEIUB routine to boot it safely. The corruption happened on a 3.2-rcsomething kernel and Ubuntu 11.10, but I am now running on Ubuntu 12.04

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: kernel

Re: btrfs/git question.

2011-11-28 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/28/2011 12:53 PM, Ken D'Ambrosio wrote: Seems I've picked up a wireless regression, and randomly drop my WiFi connection with more recent kernels. While I'd love to try to track down the issue, the sporadic nature makes it difficult. But I

Re: [PATCH 00/20] Here's my current btrfs patchset

2011-11-28 Thread Li Zefan
Alexandre Oliva wrote: The first 11 patches are relatively simple fixes or improvements that I suppose go could make it even in 3.2 (02 is particularly essential to avoid progressive performance degradation and metadata space waste in the default clustered allocation strategy). I think 02

Re: btrfs/git question.

2011-11-28 Thread Fajar A. Nugraha
On Tue, Nov 29, 2011 at 8:58 AM, Phillip Susi ps...@cfl.rr.com wrote: On 11/28/2011 12:53 PM, Ken D'Ambrosio wrote: Seems I've picked up a wireless regression, and randomly drop my WiFi connection with more recent kernels.  While I'd love to try to track down the issue, the sporadic nature

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

2011-11-28 Thread Jonathan Nieder
Li Zefan wrote: This patch has the same problem with your previous one, that it will set f_bavail to 0. I've sent out a new patch yesterday. Thanks for the quick feedback. That makes sense. (The new patch is at [1], for reference.) [1]

Re: [PATCH 2/2] Btrfs: set the i_nlink to 2 for an initial dir inode

2011-11-28 Thread Jeff Liu
Please ignore this patch for now, it can cause the file system corrupted and failed to mount again, sorry for the noise! -Jeff On 11/28/2011 03:47 PM, Jeff Liu wrote: For an initial dir inode, stat(1) show it links as 1, IMHO it should be 2 by default. Signed-off-by: Jie Liu

[PATCH] Btrfs-progs: bugfix for scrubbing single devices

2011-11-28 Thread Arne Jansen
Scrub can be invoked to scrub only a single device of a (mounted) filesystem. The code determines whether the given path is a mountpoint of a filesystem by issueing a btrfs-specific ioctl to it. Only in case of EINVAL it assumed it may be a device, all other errnos just caused it fail, but some