Re: [PATCH 1/2] Btrfs: rescan for qgroups

2013-04-15 Thread Wang Shilong
Hello Jan, On Mon, April 15, 2013 at 07:44 (+0200), Jan Schmidt wrote: Thanks, v2 to come. Uh, but not immediately. I didn't get tracking of exclusive right. That will need some time to fix and test. 'exclusive' adds the complexity of btrfs qgroup. So if you send V2. I'd like you add more

[PATCH 00/11 v2] a bunch of miscellaneous bug fixes

2013-04-15 Thread Anand Jain
v1-v2: Accepts the review comments from David Accepts the review comments from Stefan Rebase changes Adds the 10/11 and 11/11 which was outside this patch-set Anand Jain (11): btrfs-progs: root_item generation_v2 is out of sync after btrfsck btrfs-progs: no

[PATCH 01/11, RESEND] btrfs-progs: root_item generation_v2 is out of sync after btrfsck

2013-04-15 Thread Anand Jain
reproducing steps: mkfs.btrfs /dev/dm-2 -f mount /dev/dm-2 /btrfs umount /btrfs btrfs check /dev/dm-2 --repair mount /dev/dm-2 /btrfs btrfs: mismatching generation and generation_v2 found in root item. This root was probably mounted with an older kernel. Resetting all new fields.

[PATCH 02/11, RESEND] btrfs-progs: no pending balance is not an error

2013-04-15 Thread Anand Jain
Having no balance running/ paused/completed is a normal situation, so the current output message should be positive with return val zero. Signed-off-by: Anand Jain anand.j...@oracle.com --- cmds-balance.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git

[PATCH 03/11 v2] btrfs-progs: mkfs should first check all disks before writing to a disk

2013-04-15 Thread Anand Jain
In the cases where one of the disk is not suitable for btrfs, then we would fail the mkfs, however we determine that after we have written btrfs to the preceding disks. At this time if user changes mind for not to use btrfs will left with no choice. So this patch will check if all the provided

[PATCH 07/11, RESEND] btrfs-progs: delete unused function get_mountpt

2013-04-15 Thread Anand Jain
and get_btrfs_mount has replaced it Signed-off-by: Anand Jain anand.j...@oracle.com --- utils.c | 35 --- 1 file changed, 35 deletions(-) diff --git a/utils.c b/utils.c index 67419da..926421c 100644 --- a/utils.c +++ b/utils.c @@ -977,41 +977,6 @@

[PATCH 09/11, RESEND] btrfs-progs: fix btrfs scrub start help

2013-04-15 Thread Anand Jain
a very trivial fix Signed-off-by: Anand Jain anand.j...@oracle.com --- cmds-scrub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-scrub.c b/cmds-scrub.c index 5922361..c0dc584 100644 --- a/cmds-scrub.c +++ b/cmds-scrub.c @@ -1465,7 +1465,7 @@ out: } static

[PATCH 11/11, RESEND] btrfs-progs: a copy of superblock is zero may not mean btrfs is not there

2013-04-15 Thread Anand Jain
If one of the copy of the superblock is zero it does not confirm to us that btrfs isn't there on that disk. When we are having more than one copy of superblock we should rather let the for loop to continue to check other copies. the following test case and results would justify the fix

[PATCH 10/11, RESEND] btrfs-progs: avoid ioctl for multipath-dev with its non-multipath path

2013-04-15 Thread Anand Jain
We should avoid using non multi-path (mp) path for mp disks As of now there is no good way (like api) to check that. A workaround way is to check if the O_EXCL open is unsuccessful. This is safe since otherwise the BTRFS_IOC_SCAN_DEV ioctl would fail if the disk-path can not be opened with the

[PATCH 06/11, v2] btrfs-progs: check if btrfs kernel module is loaded

2013-04-15 Thread Anand Jain
when we have to report no such file error for /dev/btrfs-control we could confirm if btrfs kernel is present and report it and skip registration where appropriate v1-v2: use /proc/filesystems to check if the btrfs is present Signed-off-by: Anand Jain anand.j...@oracle.com --- cmds-device.c | 60

[PATCH 08/11, RESEND] btrfs-progs: btrfs-select-super output is confusing when it fails

2013-04-15 Thread Anand Jain
Trivial patch: ./btrfs-progs/btrfs-select-super -s 0 /dev/sdc using SB copy 0, bytenr 65536 No valid Btrfs found on /dev/sdc Open ctree failed The line 'using..' is confusing which gives an indication that command is successful This patch will avoid that when command fails Signed-off-by: Anand

[PATCH 04/11 v2] btrfs-progs: cmd replace should check target-dev fully

2013-04-15 Thread Anand Jain
as of now in replace command target dev is being checked for mounted and for existing fs, however there is newly introduced test_dev_for_mkfs in mkfs.c which is suitable for this job, and further it also checks if dev can be opened for with O_EXCL. Its better to use test_dev_for_mkfs

[PATCH 05/11, RESEND] btrfs-progs: mkfs stdout print to match chronology

2013-04-15 Thread Anand Jain
A trivial fix: To match the events inside to what being printed out before: :: adding device /dev/dm-3 id 2 adding device /dev/dm-4 id 3 adding device /dev/dm-5 id 4 fs created label (null) on /dev/dm-2 nodesize 4096 leafsize 4096 sectorsize 4096 size 213.20GB Btrfs v0.20-rc1-235-gdd21bc1

Re: [PATCH 02/11, v2] btrfs-progs: no pending balance is not an error

2013-04-15 Thread Anand Jain
Oh. this title prefix should be v2 not RESEND. v1-v2 Accepts David review comments Thanks, Anand On 04/15/2013 02:38 PM, Anand Jain wrote: Having no balance running/ paused/completed is a normal situation, so the current output message should be positive with return val zero.

Re: [PATCH 3/9] btrfs-progs: mkfs should first check all disks before writing to a disk

2013-04-15 Thread Anand Jain
On 04/13/2013 12:06 AM, David Sterba wrote: On Fri, Apr 05, 2013 at 01:54:57PM +0800, Anand Jain wrote: In the cases where one of the disk is not suitable for btrfs, then we would fail the mkfs, however we determine that after we have written btrfs to the preceding disks. At this time if user

Re: [PATCH 1/2] Btrfs: rescan for qgroups

2013-04-15 Thread Jan Schmidt
On Mon, April 15, 2013 at 08:08 (+0200), Wang Shilong wrote: Hello Jan, On Mon, April 15, 2013 at 07:44 (+0200), Jan Schmidt wrote: Thanks, v2 to come. Uh, but not immediately. I didn't get tracking of exclusive right. That will need some time to fix and test. 'exclusive' adds the

[PATCH 06/11 v3] btrfs-progs: check if btrfs kernel module is loaded

2013-04-15 Thread Anand Jain
when we have to report no such file error for /dev/btrfs-control we could confirm if btrfs kernel is present and report it and skip registration where appropriate v2-v3: accept review comments from David v1-v2: use /proc/filesystems to check if the btrfs is present Signed-off-by: Anand

Re: [PATCH 1/2] Btrfs: rescan for qgroups

2013-04-15 Thread Wang Shilong
Hello Jan, On Mon, April 15, 2013 at 08:08 (+0200), Wang Shilong wrote: Hello Jan, On Mon, April 15, 2013 at 07:44 (+0200), Jan Schmidt wrote: Thanks, v2 to come. Uh, but not immediately. I didn't get tracking of exclusive right. That will need some time to fix and test. 'exclusive'

[PATCH] Btrfs: do not continue if out of memory happens

2013-04-15 Thread Wang Shilong
If out of memory happens, we should return -ENOMEM directly to the caller rather than continue the work. Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com --- fs/btrfs/backref.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/backref.c

Re: [PATCH RFC] Btrfs: fix confusing edquot happening case

2013-04-15 Thread Arne Jansen
On 15.04.2013 12:37, Wang Shilong wrote: Step to reproduce: mkfs.btrfs disk mount disk mnt dd if=/dev/zero of=/mnt/data bs=1M count=10 sync btrfs quota enable mnt btrfs qgroup create 0/5 mnt btrfs qgroup limit 5M 0/5 mnt rm -f /mnt/data

Re: [PATCH RFC] Btrfs: fix confusing edquot happening case

2013-04-15 Thread Wang Shilong
Hello Arne, On 15.04.2013 12:37, Wang Shilong wrote: Step to reproduce: mkfs.btrfs disk mount disk mnt dd if=/dev/zero of=/mnt/data bs=1M count=10 sync btrfs quota enable mnt btrfs qgroup create 0/5 mnt btrfs qgroup limit 5M 0/5 mnt rm -f

Re: [PATCH RFC] Btrfs: fix confusing edquot happening case

2013-04-15 Thread Arne Jansen
On 15.04.2013 13:43, Wang Shilong wrote: Hello Arne, On 15.04.2013 12:37, Wang Shilong wrote: Step to reproduce: mkfs.btrfs disk mount disk mnt dd if=/dev/zero of=/mnt/data bs=1M count=10 sync btrfs quota enable mnt btrfs qgroup create 0/5 mnt btrfs qgroup

Re: [PATCH] Btrfs-progs: add a free space cache checker to fsck V2

2013-04-15 Thread Stefan Behrens
On Thu, 4 Apr 2013 09:57:50 -0400, Josef Bacik wrote: In trying to track down a weird tree log problem I wanted to make sure that the free space cache was actually valid, which we currently have no way of doing. So this patch adds a bunch of support for the free space cache code and then a

[PATCH V2] Btrfs: fix confusing edquot happening case

2013-04-15 Thread Wang Shilong
From: Wang Shilong wangsl-f...@fujitsu.com Step to reproduce: mkfs.btrfs disk mount disk mnt dd if=/dev/zero of=/mnt/data bs=1M count=10 sync btrfs quota enable mnt btrfs qgroup create 0/5 mnt btrfs qgroup limit 5M 0/5 mnt rm -f

Re: [PATCH V2] Btrfs: fix confusing edquot happening case

2013-04-15 Thread Wang Shilong
I am sorry, please ignore this…I will resend it.. From: Wang Shilong wangsl-f...@fujitsu.com Step to reproduce: mkfs.btrfs disk mount disk mnt dd if=/dev/zero of=/mnt/data bs=1M count=10 sync btrfs quota enable mnt btrfs qgroup create 0/5 mnt

[PATCH V2 RESEND] Btrfs: fix confusing edquot happening case

2013-04-15 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com Step to reproduce: mkfs.btrfs disk mount disk mnt dd if=/dev/zero of=/mnt/data bs=1M count=10 sync btrfs quota enable mnt btrfs qgroup create 0/5 mnt btrfs qgroup limit 5M 0/5 mnt rm -f

How to rescue my data from raid1 metadata with raid0 data ?

2013-04-15 Thread Dongsheng Song
Hi all, When I created my btrfs filesystem, I use the command: mkfs.btrfs -m raid1 -d raid0 /dev/sda5 /dev/sdb5 # btrfs fi df /srv/raid0/ Data, RAID0: total=1.92TB, used=1.46TB System, RAID1: total=32.00MB, used=164.00KB System: total=4.00MB, used=0.00 Metadata, RAID1: total=39.26GB,

[PATCH] btrfs-progs: No-op when called as fsck.btrfsck

2013-04-15 Thread Dan McGrath
Hi, I thought that I would attempt a quick little patch that will make btrfsck into a No-op when called as fsck.btrfsck. The reasoning is that the FAQ states that it is recommended and safe to do so, and the current 12.04 version of Ubuntu just symlinks fsck.btrfsck to btrfsck instead of

[PATCH] btrfs-progs: No-op when called as fsck.btrfsck

2013-04-15 Thread Dan McGrath
As per FAQ: It is safe to and recommended to turn fsck.btrfs into a no-op Signed-off-by: Dan McGrath danmcgrath...@gmail.com --- btrfs.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/btrfs.c b/btrfs.c index 691adef..78161a9 100644 --- a/btrfs.c +++ b/btrfs.c @@ -272,6 +272,8 @@ int

Re: [PATCH] btrfs-progs: No-op when called as fsck.btrfsck

2013-04-15 Thread Jan Alexander Steffens
On Mon, Apr 15, 2013 at 3:47 PM, Dan McGrath danmcgrath...@gmail.com wrote: As per FAQ: It is safe to and recommended to turn fsck.btrfs into a no-op Signed-off-by: Dan McGrath danmcgrath...@gmail.com --- btrfs.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/btrfs.c b/btrfs.c

Re: [PATCH] btrfs-progs: No-op when called as fsck.btrfsck

2013-04-15 Thread Dan McGrath
My sincere apologies. It would appear that I was overly careful about checking the binary functioned when called as a symlink, but not the correct filename: # ls -l `which fsck.btrfs` lrwxrwxrwx 1 root root 7 Aug 25 2011 /sbin/fsck.btrfs - btrfsck So yes, the patch incorrectly assumed a

Re: [PATCH v2] Btrfs: allow file data clone within a file

2013-04-15 Thread David Sterba
On Mon, Apr 15, 2013 at 10:55:45AM +0800, Liu Bo wrote: @@ -2563,6 +2568,12 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, !IS_ALIGNED(destoff, bs)) goto out_unlock; + /* verify if ranges are overlapped within the same file */

Re: [PATCH 02/11, RESEND] btrfs-progs: no pending balance is not an error

2013-04-15 Thread David Sterba
On Mon, Apr 15, 2013 at 02:38:08PM +0800, Anand Jain wrote: +/* Checks the status of the balance if any + * return codes: + * -1 : Error failed to know if there is any pending balance + * 1 : Successful to know status of a pending balance + * 0 : When there is no pending balance or

Re: [PATCH] btrfs-progs: No-op when called as fsck.btrfsck

2013-04-15 Thread Eric Sandeen
On 4/15/13 9:03 AM, Jan Alexander Steffens wrote: On Mon, Apr 15, 2013 at 3:47 PM, Dan McGrath danmcgrath...@gmail.com wrote: As per FAQ: It is safe to and recommended to turn fsck.btrfs into a no-op Signed-off-by: Dan McGrath danmcgrath...@gmail.com --- btrfs.c |2 ++ 1 file changed,

Re: [PATCH] btrfs-progs: No-op when called as fsck.btrfsck

2013-04-15 Thread Dan McGrath
Jan, I got a chance to sit down and dig a little bit deeper into `fsck.xfs`. Here is what I discovered. The (a|A|y|p) options in the XFS script appear to be nothing more than the expected `fsck` options that imply automated checks (as is clearly implied by the use of AUTO). While I have yet to

Re: [PATCH 2/2] Btrfs: introduce noextiref mount option

2013-04-15 Thread Mark Fasheh
On Fri, Apr 12, 2013 at 12:01:19PM -0500, Eric Sandeen wrote: On 4/11/13 5:35 AM, Miao Xie wrote: Now, we set incompat flag EXTEND_IREF when we actually need insert a extend inode reference, not when making a fs. But some users may hope that the fs still can be mounted on the old kernel,

Re: [PATCH] btrfs-progs: No-op when called as fsck.btrfsck

2013-04-15 Thread Eric Sandeen
On 4/15/13 11:45 AM, Dan McGrath wrote: Jan, I got a chance to sit down and dig a little bit deeper into `fsck.xfs`. Here is what I discovered. The (a|A|y|p) options in the XFS script appear to be nothing more than the expected `fsck` options that imply automated checks (as is clearly

Re: [PATCH 2/2] Btrfs: introduce noextiref mount option

2013-04-15 Thread David Sterba
On Fri, Apr 12, 2013 at 12:01:19PM -0500, Eric Sandeen wrote: On 4/11/13 5:35 AM, Miao Xie wrote: Now, we set incompat flag EXTEND_IREF when we actually need insert a extend inode reference, not when making a fs. But some users may hope that the fs still can be mounted on the old kernel,

Re: [PATCH] btrfs-progs: No-op when called as fsck.btrfsck

2013-04-15 Thread Dan McGrath
Jan, It would appear that: # fsck -- --repair /dev/storage/lv_btrfs doesn't work, but if I put the fs-specific-options at the end: # fsck /dev/storage/lv_btrfs -- --repair it works fine. As we were/are discussing on irc, I also have no idea where the ext4 lines come from. *scratcheshead*

Re: [PATCH] btrfs-progs: No-op when called as fsck.btrfsck

2013-04-15 Thread Zach Brown
Anyways, thought I would reply back with some insight on the matter and see what others had to say, since I am in no position to dictate the direction that brtfsck/fsck.btrfs should take as far as wrapper script or no is concerned. Look forward to your replies! o/ FWIW: debian has been

Activating space_cache after read-only snapshots without space_cache have been taken

2013-04-15 Thread Ochi
Hello everyone, I've ran into problems with _very_ slow unmounting of my btrfs-formatted backup volume. I have a suspicion what might be the cause but maybe someone with more experience with the btrfs code could enlighten me whether it is actually correct. The situation is the following: I

Re: Activating space_cache after read-only snapshots without space_cache have been taken

2013-04-15 Thread Liu Bo
On Tue, Apr 16, 2013 at 02:28:51AM +0200, Ochi wrote: Hello everyone, I've ran into problems with _very_ slow unmounting of my btrfs-formatted backup volume. I have a suspicion what might be the cause but maybe someone with more experience with the btrfs code could enlighten me whether it

[PATCH 02/11 v3] btrfs-progs: no pending balance is not an error

2013-04-15 Thread Anand Jain
Having no balance running/ paused/completed is a normal situation, so the current output message should be positive with return val zero. Signed-off-by: Anand Jain anand.j...@oracle.com --- cmds-balance.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git

Re: [PATCH 02/11, RESEND] btrfs-progs: no pending balance is not an error

2013-04-15 Thread Anand Jain
On 04/16/2013 12:21 AM, David Sterba wrote: On Mon, Apr 15, 2013 at 02:38:08PM +0800, Anand Jain wrote: +/* Checks the status of the balance if any + * return codes: + * -1 : Error failed to know if there is any pending balance + * 1 : Successful to know status of a pending balance + *

[PATCH 1/4] Btrfs: remove unused argument of fixup_low_keys()

2013-04-15 Thread Tsutomu Itoh
Argument 'trans' is not used in fixup_low_keys(). So, remove it. Signed-off-by: Tsutomu Itoh t-i...@jp.fujitsu.com --- fs/btrfs/ctree.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index ca9d8f1..b5eec7c 100644 ---

[PATCH 2/4] Btrfs: cleanup of function where fixup_low_keys() is called

2013-04-15 Thread Tsutomu Itoh
If argument 'trans' is unnecessary in the function where fixup_low_keys() is called, 'trans' is deleted. Signed-off-by: Tsutomu Itoh t-i...@jp.fujitsu.com --- fs/btrfs/ctree.c | 28 fs/btrfs/ctree.h | 10 +++--- fs/btrfs/delayed-inode.c | 11

[PATCH 3/4] Btrfs: remove unused argument of btrfs_extend_item()

2013-04-15 Thread Tsutomu Itoh
Argument 'trans' is not used in btrfs_extend_item(). Signed-off-by: Tsutomu Itoh t-i...@jp.fujitsu.com --- fs/btrfs/ctree.c | 3 +-- fs/btrfs/ctree.h | 3 +-- fs/btrfs/dir-item.c| 2 +- fs/btrfs/extent-tree.c | 4 ++-- fs/btrfs/file-item.c | 2 +- fs/btrfs/inode-item.c | 4

[PATCH 4/4] Btrfs: cleanup of function where btrfs_extend_item() is called

2013-04-15 Thread Tsutomu Itoh
Argument 'trans' became unnecessary from setup_inline_extent_backref() that called btrfs_extend_item(). Signed-off-by: Tsutomu Itoh t-i...@jp.fujitsu.com --- fs/btrfs/extent-tree.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/extent-tree.c