[PATCH] Btrfs-progs: introduce '-p' option and fullpath into subvolume set-default command

2012-09-24 Thread Chen Yang
In command btrfs subvolume set-default, we used subvolume id and path to set the default subvolume of a filesystem. It's not easy for a common user, so I improved it and the fullpath of a subvolume can be used to set the default subvolume of a filesystem. Signed-off-by: Cheng Yang

Re: btrfs send/receive review by vfs folks

2012-09-24 Thread Alex Lyakas
Hi, write_buf: Used to write the stream to a user space supplied pipe. Please note the ERESTARTSYS comment there, I need some help here as I don't know how to handle that correctly. If I ignore the return value, it loops forever. If I bail out to user space, it reenters the ioctl and starts

Re: btrfs send/receive review by vfs folks

2012-09-24 Thread Jan Schmidt
Hi Alex, On Mon, September 24, 2012 at 11:13 (+0200), Alex Lyakas wrote: Hi, write_buf: Used to write the stream to a user space supplied pipe. Please note the ERESTARTSYS comment there, I need some help here as I don't know how to handle that correctly. If I ignore the return value, it

Re: Userland commands repository in wiki

2012-09-24 Thread David Sterba
On Fri, Sep 21, 2012 at 06:23:36PM +0200, Alfredo Esteban wrote: Yesterday, I modified the URL of the userland commands repository in this wiki page: https://btrfs.wiki.kernel.org/index.php/Debugging_Btrfs_with_GDB Former URL doesn't work:

Re: [PATCH] Btrfs-progs: btrfs subvolume delete could delete subvolumes

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 10:59:34AM +0800, Anand Jain wrote: Yes, this is useful, thanks. I'm thinking if it's ok to stop on first error, ie. when the subvolume does not exist or is a directory. I am fine with either ways. I shall just keep it as it is as of now. Yes, I'm ok with that. The

Re: [PATCH] Btrfs: fix return value check in btrfs_ioctl_send()

2012-09-24 Thread David Sterba
On Fri, Sep 21, 2012 at 12:42:02PM +0800, Wei Yongjun wrote: From: Wei Yongjun yongjun_...@trendmicro.com.cn In case of error, the function btrfs_read_fs_root_no_name() returns ERR_PTR() and never returns NULL pointer. The NULL test in the return value check should be replaced with IS_ERR(),

Re: crash in read_extent_buffer+0xb7/0xfb

2012-09-24 Thread David Sterba
On Sun, Sep 23, 2012 at 09:16:34AM -0700, Marc MERLIN wrote: Oh my, now I'm trying again with a new drive, and a big cp from an existing array to a new one dies with: [32042.079411] [ cut here ] [32042.085799] kernel BUG at

Re: [PATCH 4/4] Btrfs: tivial cleanup: add space between = and the rest code

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 08:47:33AM +0800, Wang Sheng-Hui wrote: trivial code cleanup. - ret =btrfs_drop_snapshot(root, NULL, 1, 0); + ret = btrfs_drop_snapshot(root, NULL, 1, 0); Sorry but this is too trivial. Unless it really bugs you when you're

Re: [PATCH] Btrfs: fix return value check in btrfs_ioctl_send()

2012-09-24 Thread Wei Yongjun
On 09/24/2012 08:42 PM, David Sterba wrote: On Fri, Sep 21, 2012 at 12:42:02PM +0800, Wei Yongjun wrote: From: Wei Yongjun yongjun_...@trendmicro.com.cn In case of error, the function btrfs_read_fs_root_no_name() returns ERR_PTR() and never returns NULL pointer. The NULL test in the return

[PATCH v2] Btrfs: fix return value check

2012-09-24 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn In case of error, the function btrfs_read_fs_root_no_name() returns ERR_PTR() and never returns NULL pointer. The NULL test in the return value check should be replaced with IS_ERR(), and remove useless NULL test. dpatch engine is used to auto

Re: Identifying reflink / CoW files

2012-09-24 Thread David Sterba
On Sun, Sep 23, 2012 at 09:56:34AM +1200, Jp Wise wrote: Afaik without playing with it myself fiemap can give you information about the mappings of each file. If the mappings of 2 files match, the data is shared. OK, have just done some searching on fiemap and located a code example using it

Re: Rebuilding chunk root?

2012-09-24 Thread Hugo Mills
On Mon, Sep 24, 2012 at 04:28:08PM +0300, Sami Haahtinen wrote: Due to certain unfortunate chain of events, I managed to overwrite a small portion of my btrfs array which had only single redundancy for metadata. The data itself is present and only a small portion (2.5%) of the array was

Re: [PATCH] Btrfs: fix return value check in btrfs_ioctl_send()

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 09:40:00PM +0800, Wei Yongjun wrote: dpatch engine is used to auto generated this patch. (https://github.com/weiyj/dpatch) I've played with it, looks nice, although it's full of hardcoded paths. Yes, it is current hardcoded path, because I used the linux.git and

Re: [PATCH v2] Btrfs: fix return value check

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 09:42:26PM +0800, Wei Yongjun wrote: From: Wei Yongjun yongjun_...@trendmicro.com.cn In case of error, the function btrfs_read_fs_root_no_name() returns ERR_PTR() and never returns NULL pointer. The NULL test in the return value check should be replaced with IS_ERR(),

Re: [PATCH] Btrfs-progs: btrfs subvolume delete could delete subvolumes

2012-09-24 Thread cwillu
On Mon, Sep 24, 2012 at 6:02 AM, David Sterba d...@jikos.cz wrote: On Mon, Sep 24, 2012 at 10:59:34AM +0800, Anand Jain wrote: Yes, this is useful, thanks. I'm thinking if it's ok to stop on first error, ie. when the subvolume does not exist or is a directory. I am fine with either ways. I

Re: crash in read_extent_buffer+0xb7/0xfb

2012-09-24 Thread Marc MERLIN
On Mon, Sep 24, 2012 at 03:08:47PM +0200, David Sterba wrote: I had a different crash while copying to a btrfs 5 disk array. Not sure if this is also fixed too, but pasting just in case. [207025.055956] btrfs: bdev /dev/mapper/crypt_sdo1 errs: wr 46779, rd 0, flush 7 6, corrupt 0,

Re: Rebuilding chunk root?

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 03:02:39PM +0100, Hugo Mills wrote: root@sysresccd /root/btrfs-progs % ./btrfsck --super 2 /dev/patience/home using SB copy 2, bytenr 274877906944 Check tree block failed, want=139264, have=0 Check tree block failed, want=139264, have=0 Check tree block failed,

Re: crash in read_extent_buffer+0xb7/0xfb

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 07:41:03AM -0700, Marc MERLIN wrote: It's possible, I have crappy drives that were cheap that I'm using for tests and copies. Yeah, that makes a good use of crappy disks :) Considering that I was doing a huge copy to a brtfs filesystem (source was ext4) and that I was

Re: enquiry about autodefrag option

2012-09-24 Thread David Sterba
On Fri, Sep 21, 2012 at 05:03:41AM +0800, ching wrote: AFAIK, the autodefrag will read related extents and mark them dirty, io niceness should be applicable to the read operation I was hesitant to believe that, but tried it and it's right: $ dd if=/dev/zero bs=4k count=1 seek=15 of=file $ dd

Re: Btrfs: check range early in map_private_extent_buffer

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 12:38:07PM +0800, Wang Sheng-Hui wrote: Check range early to avoid further check/compute in case of range error. Signed-off-by: Wang Sheng-Hui shh...@gmail.com --- fs/btrfs/extent_io.c | 16 1 files changed, 8 insertions(+), 8 deletions(-)

Re: [PATCH V3 1/2] Btrfs: cleanup duplicated division functions

2012-09-24 Thread David Sterba
On Sun, Sep 23, 2012 at 05:54:18PM +0800, Miao Xie wrote: @@ -2347,7 +2335,8 @@ static int chunk_usage_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset, cache = btrfs_lookup_block_group(fs_info, chunk_offset); chunk_used = btrfs_block_group_used(cache-item); -

Re: Rebuilding chunk root?

2012-09-24 Thread Sami Haahtinen
On Mon, Sep 24, 2012 at 6:12 PM, David Sterba d...@jikos.cz wrote: On Mon, Sep 24, 2012 at 03:02:39PM +0100, Hugo Mills wrote: Out of interest, does mounting with -o recovery help at all? (I'm not expecting it to do much if your chunk tree's gone, but it might do something). The -o

Re: [PATCH V3 1/2] Btrfs: cleanup duplicated division functions

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 10:05:02AM +0800, Miao Xie wrote: Generally, we should check the value when it is input. If not, we might run our program with the wrong value, and it is possible to cause unknown problems. So I think the above chunk is necessary. The difference is that giving an

Re: ENOSPC design issues

2012-09-24 Thread Mitch Harder
On Thu, Sep 20, 2012 at 2:03 PM, Josef Bacik jba...@fusionio.com wrote: Hello, I'm going to look at fixing some of the performance issues that crop up because of our reservation system. Before I go and do a whole lot of work I want some feedback. When I was trying to figure out the

[PATCH] Btrfs: run delayed refs first when out of space

2012-09-24 Thread Josef Bacik
Running delayed refs is faster than running delalloc, so lets do that first to try and reclaim space. This makes my fs_mark test about 20% faster. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- fs/btrfs/extent-tree.c | 20 ++-- 1 files changed, 10 insertions(+), 10

[PATCH] Btrfs: do not async metadata csums if we have hardware crc32c

2012-09-24 Thread Josef Bacik
The reason we offload csumming is because it is CPU intensive, except it is not on modern intel CPUs. So check to see if we support hardware crc32c, and if we do just do the csumming in our current threads context. Otherwise we can farm it off. Thanks, Signed-off-by: Josef Bacik

Re: [PATCH] Btrfs: do not async metadata csums if we have hardware crc32c

2012-09-24 Thread Arne Jansen
On 09/24/12 20:11, Josef Bacik wrote: The reason we offload csumming is because it is CPU intensive, except it is not on modern intel CPUs. So check to see if we support hardware crc32c, and if we do just do the csumming in our current threads context. Otherwise we can farm it off. Thanks,

Re: [PATCH] Btrfs: do not async metadata csums if we have hardware crc32c

2012-09-24 Thread Josef Bacik
On Mon, Sep 24, 2012 at 12:19:20PM -0600, Arne Jansen wrote: On 09/24/12 20:11, Josef Bacik wrote: The reason we offload csumming is because it is CPU intensive, except it is not on modern intel CPUs. So check to see if we support hardware crc32c, and if we do just do the csumming in our

Re: [PATCH V3 1/2] Btrfs: cleanup duplicated division functions

2012-09-24 Thread Ilya Dryomov
On Mon, Sep 24, 2012 at 06:47:42PM +0200, David Sterba wrote: On Mon, Sep 24, 2012 at 10:05:02AM +0800, Miao Xie wrote: Generally, we should check the value when it is input. If not, we might run our program with the wrong value, and it is possible to cause unknown problems. So I think the

Re: [PATCH] Btrfs: do not async metadata csums if we have hardware crc32c

2012-09-24 Thread Chris Mason
On Mon, Sep 24, 2012 at 12:19:20PM -0600, Arne Jansen wrote: On 09/24/12 20:11, Josef Bacik wrote: The reason we offload csumming is because it is CPU intensive, except it is not on modern intel CPUs. So check to see if we support hardware crc32c, and if we do just do the csumming in our

Resize, off by 1024 bytes

2012-09-24 Thread Lluís Batlle i Rossell
Hello, I wanted to resize my filesystem to 512MiB less. I had created the btrfs after I had set the partitions some days ago, and it was like this: # cat /sys/class/block/sda1/size 234436482 Getting in bytes: 234436482*512 = 120031478784 I run: # btrfs fi resize -512m / And I see in dmesg:

[PATCH] Btrfs: try to avoid doing a search in btrfs_next_leaf

2012-09-24 Thread Josef Bacik
Things like btrfs_drop_extents call btrfs_next_leaf to see if there is anything else they need on the next leaf. This will result in a re-search, but if we are already at the last leaf in the tree or if the first item in the next leaf doesn't match the objectid of the one we want we can just

Re: [PATCH] Btrfs: do not async metadata csums if we have hardware crc32c

2012-09-24 Thread David Sterba
On Mon, Sep 24, 2012 at 02:11:04PM -0400, Josef Bacik wrote: +#ifdef CONFIG_X86 + if (cpu_has_xmm4_2) { + printk(KERN_ERR doing it the fast way\n); + ret = btree_csum_one_bio(bio); + if (ret) + return ret; + return

Re: [PATCH 4/4] Btrfs: tivial cleanup: add space between = and the rest code

2012-09-24 Thread Wang Sheng-Hui
On 2012年09月24日 21:15, David Sterba wrote: On Mon, Sep 24, 2012 at 08:47:33AM +0800, Wang Sheng-Hui wrote: trivial code cleanup. -ret =btrfs_drop_snapshot(root, NULL, 1, 0); +ret = btrfs_drop_snapshot(root, NULL, 1, 0); Sorry but this is too trivial.

Re: Btrfs: check range early in map_private_extent_buffer

2012-09-24 Thread Wang Sheng-Hui
On 2012年09月25日 00:17, David Sterba wrote: On Mon, Sep 24, 2012 at 12:38:07PM +0800, Wang Sheng-Hui wrote: Check range early to avoid further check/compute in case of range error. Signed-off-by: Wang Sheng-Hui shh...@gmail.com --- fs/btrfs/extent_io.c | 16 1 files

fs/btrfs/disk-io.c:34:28: fatal error: asm/cpufeature.h: No such file or directory

2012-09-24 Thread Fengguang Wu
Hi Josef, FYI, kernel build failed on Commit: d5b04fb3bbb6fce0a834e43f51b6a5251867fcb7 Btrfs: do not async metadata csums if we have hardware crc32c Date: Mon Sep 24 14:40:24 2012 -0400 config: m68k-allmodconfig All related error/warning messages: fs/btrfs/disk-io.c:34:28: fatal error:

[PATCH v2 2/2] btrfs-progs: Fix up memory leakage

2012-09-24 Thread zwu . kernel
From: Zhi Yong Wu wu...@linux.vnet.ibm.com Some code pathes forget to free memory on exit. Changelog from v1: Fix the variable is used uncorrectly. [Ram Pai] Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com --- cmds-filesystem.c |6 -- 1 files changed, 4 insertions(+), 2

[resend][PATCH v2 0/2] btrfs-progs: some bugfixes

2012-09-24 Thread zwu . kernel
From: Zhi Yong Wu wu...@linux.vnet.ibm.com Some misc bugs are found when i work on other tasks. Now send out them for interview, thanks. Zhi Yong Wu (2): btrfs-progs: Close file descriptor on exit btrfs-progs: Fix up memory leakage cmds-filesystem.c | 16 1 files

[PATCH v2 1/2] btrfs-progs: Close file descriptor on exit

2012-09-24 Thread zwu . kernel
From: Zhi Yong Wu wu...@linux.vnet.ibm.com Need to close fd on exit. Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com --- cmds-filesystem.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index b1457de..e62c4fd 100644

Re: [PATCH] Btrfs: fix return value check in btrfs_ioctl_send()

2012-09-24 Thread Wei Yongjun
On 09/24/2012 10:03 PM, David Sterba wrote: On Mon, Sep 24, 2012 at 09:40:00PM +0800, Wei Yongjun wrote: dpatch engine is used to auto generated this patch. (https://github.com/weiyj/dpatch) I've played with it, looks nice, although it's full of hardcoded paths. Yes, it is current hardcoded