[PATCH] Btrfs-progs: fix typo in btrfs_err_str()

2013-09-09 Thread Wang Shilong
Raid5 and raid6 at least need three and foure devices respectively, fix it. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com --- based on david's integration 20130903 --- ioctl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ioctl.h b/ioctl.h index

Re: [RFC PATCH v6 5/5] Btrfs: online data deduplication

2013-09-09 Thread Liu Bo
Hi Dave, On Mon, Sep 02, 2013 at 06:19:42PM +0200, David Sterba wrote: I wanted to only comment on the ioctl and interface to userspace bits, but found more things to comment in the kernel code. Sorry for the late reply(I'm out for vacation these days). On Thu, Aug 08, 2013 at 04:35:45PM

Re: [PATCH] Btrfs: allocate the free space by the existed max extent size when ENOSPC

2013-09-09 Thread Miao Xie
On fri, 06 Sep 2013 15:47:08 +0200, Stefan Behrens wrote: On Fri, 30 Aug 2013 18:35:34 +0800, Miao Xie wrote: By the current code, if the requested size is very large, and all the extents in the free space cache are small, we will waste lots of the cpu time to cut the requested size in half

Re: Btrfsck Assertion btrfs_find_last_root !(path-slots[0] == 0) - any hope left?

2013-09-09 Thread Clemens Eisserer
Hi again, After I found out about btrfs restore and btrfs-find-root, I gave it a try - unfortunately without success (full log at: http://pastebin.com/B2QUxhaj ): parent transid verify failed on 27785830400 wanted 168295 found 168298 parent transid verify failed on 27785830400 wanted 168295

Re: [PATCH] Btrfs: allocate the free space by the existed max extent size when ENOSPC

2013-09-09 Thread Stefan Behrens
On 09/09/2013 08:21, Miao Xie wrote: On fri, 06 Sep 2013 15:47:08 +0200, Stefan Behrens wrote: On Fri, 30 Aug 2013 18:35:34 +0800, Miao Xie wrote: By the current code, if the requested size is very large, and all the extents in the free space cache are small, we will waste lots of the cpu time

Re: btrfs defrag kernel 3.11

2013-09-09 Thread Ahmet Inan
ive had the same problem and this commit helped, which i had to cherry-pick: commit c83b3452db6e1b048312c50b23f06c9634535f80 Author: Josef Bacik jba...@fusionio.com Date: Mon Jul 22 12:50:37 2013 -0400 Btrfs: reset ret in record_one_backref I was getting warnings when running find ./

Re: [PATCH] Btrfs: eliminate the exceptional root_tree refs=0

2013-09-09 Thread Miao Xie
On Fri, 06 Sep 2013 10:36:48 +0200, Stefan Behrens wrote: On Fri, 06 Sep 2013 11:08:16 +0800, Miao Xie wrote: On thu, 5 Sep 2013 16:58:43 +0200, Stefan Behrens wrote: The fact that btrfs_root_refs() returned 0 for the tree_root caused bugs in the past, therefore it is set to 1 with this

Re: [PATCH 00/20] fix magic return value in btrfs-progs

2013-09-09 Thread David Sterba
Frist, thank you very much for the patches! I'm going to merge all except 18/20, expecting V2. On Thu, Sep 05, 2013 at 10:14:06AM +0800, Anand Jain wrote: On 09/04/2013 11:22 PM, Wang Shilong wrote: This patchset tries to fix all the magic return value in btrfs-progs. Most commands will have

Re: [PATCH 2/5] btrfs-progs:local variable memory freed

2013-09-09 Thread David Sterba
On Thu, Sep 05, 2013 at 10:38:55AM +0800, Gui Hecheng wrote: The local probe variable in is_ssd() freed upon unsuccessful return; FYI, I've applied a patch from Wang Shilong Btrfs-progs: fix compile warning in is_ssd() instead of the hunk below and will remove the respective changelog line. The

Re: [PATCH 2/5] btrfs-progs:local variable memory freed

2013-09-09 Thread David Sterba
On Mon, Sep 09, 2013 at 04:18:55PM +0200, David Sterba wrote: On Thu, Sep 05, 2013 at 10:38:55AM +0800, Gui Hecheng wrote: The local probe variable in is_ssd() freed upon unsuccessful return; FYI, I've applied a patch from Wang Shilong Btrfs-progs: fix compile warning in is_ssd() instead of

Re: [PATCH 5/5] btrfs-progs:free strdup()s that are not freed

2013-09-09 Thread David Sterba
On Thu, Sep 05, 2013 at 09:10:51AM +0200, Stefan Behrens wrote: Just noticed that you had already sent a V2 with the things fixed that I have commented, but you sent the 5/5 as a 1/5 and added the changelog v1-v2 none which made it difficult to recognize :). But maybe David Sterba is smart

Re: [PATCH] Btrfs-progs: setup framework to corrupt specific fields of an inode V2

2013-09-09 Thread David Sterba
On Fri, Sep 06, 2013 at 09:26:19AM -0400, Josef Bacik wrote: @@ -93,6 +95,9 @@ static void print_usage(void) fprintf(stderr, \t-b Number of bytes to be corrupted\n); fprintf(stderr, \t-e Extent to be corrupted\n); fprintf(stderr, \t-E The whole extent free to be corrupted\n);

Re: [PATCH] btrfs: add ability to query/change feature bits online

2013-09-09 Thread David Sterba
On Tue, Aug 27, 2013 at 03:17:54PM -0400, Jeff Mahoney wrote: +static int btrfs_ioctl_add_features(struct file *file, void __user *arg) +{ ... spin_lock(fs_info-super_lock); + flags = btrfs_super_compat_flags(super_block); + flags |=

Re: [PATCH] Btrfs-progs: add make test framework

2013-09-09 Thread David Sterba
On Fri, Sep 06, 2013 at 02:50:56PM -0400, Josef Bacik wrote: We need to start adding some sanity tests to btrfs-progs to make sure we aren't breaking things with our patches. The most important of these tools is btrfsck. This patch gets things started by adding a basic btrfsck test that

Re: [PATCH] Btrfs-progs: add make test framework

2013-09-09 Thread Josef Bacik
On Mon, Sep 09, 2013 at 06:32:04PM +0200, David Sterba wrote: On Fri, Sep 06, 2013 at 02:50:56PM -0400, Josef Bacik wrote: We need to start adding some sanity tests to btrfs-progs to make sure we aren't breaking things with our patches. The most important of these tools is btrfsck.

[PATCH] Btrfs: don't leak block group on error

2013-09-09 Thread Filipe David Borba Manana
In extent-tree.c:btrfs_write_dirty_block_groups(), if the call to write_one_cache_group() failed, we would return without putting the block group first. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/extent-tree.c |3 +-- 1 file changed, 1 insertion(+), 2

Re: [PATCH] Btrfs-progs: add make test framework

2013-09-09 Thread Eric Sandeen
On 9/9/13 12:13 PM, Josef Bacik wrote: On Mon, Sep 09, 2013 at 06:32:04PM +0200, David Sterba wrote: On Fri, Sep 06, 2013 at 02:50:56PM -0400, Josef Bacik wrote: We need to start adding some sanity tests to btrfs-progs to make sure we aren't breaking things with our patches. The most

[PATCH] Btrfs: don't ignore return value from cache_save_setup()

2013-09-09 Thread Filipe David Borba Manana
Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/extent-tree.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 249cdb1..64efa83 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3284,6

Re: [PATCH] Btrfs-progs: add make test framework

2013-09-09 Thread Josef Bacik
On Mon, Sep 09, 2013 at 02:07:43PM -0500, Eric Sandeen wrote: On 9/9/13 12:13 PM, Josef Bacik wrote: On Mon, Sep 09, 2013 at 06:32:04PM +0200, David Sterba wrote: On Fri, Sep 06, 2013 at 02:50:56PM -0400, Josef Bacik wrote: We need to start adding some sanity tests to btrfs-progs to make

[PATCH 3/5] Btrfs-progs: make btrfsck fix backrefs that are broken

2013-09-09 Thread Josef Bacik
If you set an file extent item's disk_bytenr to something completely wrong we won't be able to fix this if it is the only one who has a ref on the original disk bytenr. Our extent records know exactly who is supposed to point at them, so if we have an extent record that has no backrefs we can go

[PATCH 5/5] Btrfs-progs: add make test framework

2013-09-09 Thread Josef Bacik
We need to start adding some sanity tests to btrfs-progs to make sure we aren't breaking things with our patches. The most important of these tools is btrfsck. This patch gets things started by adding a basic btrfsck test that makes sure we can fix a corruption problem we know we can fix.

[PATCH 1/5] Btrfs-progs: setup framework to corrupt specific fields of an inode

2013-09-09 Thread Josef Bacik
A user reported a problem with his fs where he had a bogus isize on his directory. In order to make sure my patch for fsck fixes this properly I needed to be able to corrupt an inode like this, which is what this patch is for. Eventually I want to extend this to corrupt everything so we can

[PATCH 4/5] Btrfs-progs: add ability to corrupt file extent disk bytenr

2013-09-09 Thread Josef Bacik
A user had a corrupt fs where one of his file extents pointed to a completely bogus disk bytenr. This patch allows us to corrupt a file system in a similar way in order to test btrfsck. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- btrfs-corrupt-block.c | 117

[PATCH 2/5] Btrfs-progs: allow fsck to fix directory isize errors

2013-09-09 Thread Josef Bacik
A user reported a problem where he was unable to rmdir an empty directory. This is because his isize was wrong. This patch will fix this sort of corruption and allow him to rmdir his directory. Thanks Signed-off-by: Josef Bacik jba...@fusionio.com --- cmds-check.c | 86

btrfs.h and btrfs-progs licensing

2013-09-09 Thread Andy Grover
Hi everybody, I'd like it to be possible to have a library that configures btrfs directly instead of using the cmdline tools. (I think Mark Fasheh and David Sterba have already done some work here.) However, as it stands, the kernel's include/uapi/linux/btrfs.h and btrfs-progs are GPLv2,

[PATCH 3/3] btrfs-progs: ctree: widen int-long due to PTR_ERR()

2013-09-09 Thread Chris West (Faux)
--- ctree.c | 74 ++-- ctree.h | 24 ++-- print-tree.c | 4 ++-- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/ctree.c b/ctree.c index 8b1fc07..bfcf3d1 100644 --- a/ctree.c +++ b/ctree.c @@ -21,9

[PATCH 2/3] btrfs-progs: fix -Wmissing-noreturn

2013-09-09 Thread Chris West (Faux)
--- btrfs-image.c | 1 + btrfs-map-logical.c | 1 + btrfs-zero-log.c| 1 + commands.h | 6 +++--- mkfs.c | 3 +++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/btrfs-image.c b/btrfs-image.c index 3ea3730..b76f467 100644 --- a/btrfs-image.c +++

[PATCH 1/3] btrfs-progs: 'optarg' shadows getopt

2013-09-09 Thread Chris West (Faux)
--- btrfs-list.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/btrfs-list.c b/btrfs-list.c index 55508d2..9cadbf5 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -1786,7 +1786,7 @@ char *btrfs_list_path_for_root(int fd, u64 root) return

Re: btrfs.h and btrfs-progs licensing

2013-09-09 Thread David Sterba
On Mon, Sep 09, 2013 at 02:13:50PM -0700, Andy Grover wrote: However, as it stands, the kernel's include/uapi/linux/btrfs.h and btrfs-progs are GPLv2, which means that a libbtrfs that is based on either of these might also be construed to need to be GPLv2, and any program *using* libbtrfs

Re: [PATCH] Btrfs-progs: add make test framework

2013-09-09 Thread David Sterba
On Mon, Sep 09, 2013 at 03:57:17PM -0400, Josef Bacik wrote: On Mon, Sep 09, 2013 at 02:07:43PM -0500, Eric Sandeen wrote: On 9/9/13 12:13 PM, Josef Bacik wrote: David might have meant 001-bad-file-extent-bytenr.img though. Oh yeah that may be good then. Yes that's what I meant. I thought

Re: [PATCH 3/3] btrfs-progs: ctree: widen int-long due to PTR_ERR()

2013-09-09 Thread David Sterba
I'm not sure this change is necessary. The code is inherited from kernel, I doubt that this would be wrong unnoticed. PTR_ERR should be always used after IS_ERR, this does all the typecasts and checks, the final value is in the range of -MAX_ERRNO..0. MAX_ERRNO is 4095, even if long is wider than

[PATCH v2 18/20] Btrfs-progs: fix magic return value in cmds-balance.c

2013-09-09 Thread Wang Shilong
If there is no balance in progress, resume/pause/cancel will return 2. Usage or syntax errors will return 1. And 0 means operations return successfully. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com --- v1-v2: Address comments from Ilya Dryomov. --- cmds-balance.c | 27

[patch 0/7] btrfs: Add ability to query/modify feature bits while mounted

2013-09-09 Thread Jeff Mahoney
The first patch of this series is the ioctl patch I posted before, with the review comments handled. The rest of the series is enabling sysfs access to feature bits, similar to how ext4 publishes that information. Since we already have the online changing ability via the ioctl patch, we can also

[patch 5/7] btrfs: Add publishing of unknown features in sysfs

2013-09-09 Thread Jeff Mahoney
With the compat and compat-ro bits, it's possible for file systems to exist that have features that aren't supported by the kernel's file system implementation yet still be mountable. This patch publishes read-only info on those features using a prefix:number format, where the number is the bit

[patch 4/7] btrfs: publish per-super features to sysfs

2013-09-09 Thread Jeff Mahoney
This patch publishes information on which features are enabled in the file system on a per-super basis. At this point, it only publishes information on features supported by the file system implementation. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/ctree.h |6 +++

[patch 1/7] [PATCH] btrfs: add ability to query/change feature bits online

2013-09-09 Thread Jeff Mahoney
There are some feature bits that require no offline setup and can be enabled online. I've only reviewed extended irefs, but there will probably be more. We introduce three new ioctls: - BTRFS_IOC_GET_SUPPORTED_FEATURES: query the kernel for supported features. - BTRFS_IOC_GET_FEATURES: query the

[patch 2/7] btrfs: export supported featured to sysfs

2013-09-09 Thread Jeff Mahoney
This patch adds the ability to publish supported features to sysfs under /sys/fs/btrfs/features. The files are module-wide and export which features the kernel supports. The content, for now, is just 0\n. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/sysfs.c | 94

[patch 6/7] btrfs: Add ability to change features via sysfs

2013-09-09 Thread Jeff Mahoney
This patch adds the ability to change (set/clear) features while the file system is mounted. A bitmask is added for each feature set for the support to set and clear the bits. A message indicating which bit has been set or cleared is issued when it's been changed and also when permission or

[patch 3/7] btrfs: Add per-super attributes to sysfs

2013-09-09 Thread Jeff Mahoney
This patch adds per-super attributes to sysfs. It doesn't publish any attributes yet, but does the proper lifetime handling as well as the basic infrastructure to add new attributes. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/ctree.h |2 + fs/btrfs/super.c | 13 +++-

[patch 7/7] btrfs: use feature attribute names to print better error messages

2013-09-09 Thread Jeff Mahoney
Now that we have the feature name strings available in the kernel via the sysfs attributes, we can use them for printing better failure messages from the ioctl path. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/ioctl.c | 35 ++- fs/btrfs/sysfs.c |

[PATCH 1/2] ctree: fix broken macros for compat_ro

2013-09-09 Thread Jeff Mahoney
The macro for compat_ro had the right name but was modifying compat instead. Signed-off-by: Jeff Mahoney je...@suse.com --- ctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctree.h b/ctree.h index 0b0d701..8ef45f3 100644 --- a/ctree.h +++ b/ctree.h @@ -1912,7 +1912,7

[PATCH 2/2 v2] utils: add support for getting/changing file system, features

2013-09-09 Thread Jeff Mahoney
This patch adds support for getting and changing file system feature bits. It supports both unmounted and mounted operation via a new set of ioctls. Changing bits not supported by the tools directly can be forced with -f when the file system is unmounted. v2: Implemented new ioctl methods from

[PATCH 1/2] ctree: fix broken macros for compat_ro

2013-09-09 Thread Jeff Mahoney
The macro for compat_ro had the right name but was modifying compat instead. Signed-off-by: Jeff Mahoney je...@suse.com --- ctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctree.h b/ctree.h index 0b0d701..8ef45f3 100644 --- a/ctree.h +++ b/ctree.h @@ -1912,7 +1912,7

[PATCH 2/2 v2] utils: add support for getting/changing file system, features

2013-09-09 Thread Jeff Mahoney
This patch adds support for getting and changing file system feature bits. It supports both unmounted and mounted operation via a new set of ioctls. Changing bits not supported by the tools directly can be forced with -f when the file system is unmounted. v2: Implemented new ioctl methods from