[PATCH v3] Btrfs: fix BUG_ON in btrfs_orphan_add() when delete unused block group

2015-02-10 Thread Forrest Liu
Removing large amount of block group in a transaction may encounters BUG_ON() in btrfs_orphan_add(). That is because btrfs_orphan_reserve_metadata() will grab metadata reservation from transaction handle, and btrfs_delete_unused_bgs() didn't reserve metadata for trnasaction handle when delete unuse

Re: [PATCH 3/3] btrfs: qgroup: fix a wrong parameter of no_quota.

2015-02-10 Thread Dongsheng Yang
On 02/10/2015 07:24 PM, Filipe David Manana wrote: On Tue, Feb 10, 2015 at 10:24 AM, Dongsheng Yang wrote: In function of __btrfs_mod_ref(), we are passing the no_quota=1 to process_func() anyway. It will make the numbers in qgroup be wrong when deleting a subvolume. The data size in a deleted

Re: [PATCH] btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree.

2015-02-10 Thread Qu Wenruo
Original Message Subject: [PATCH] btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree. From: Qu Wenruo To: Date: 2015年02月11日 09:57 There are 2 known extent buffer: Oh, a small typo: "2 known extent buffer leak:", missing the word leak. 1) With -t option. -t option wil

[PATCH] btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree.

2015-02-10 Thread Qu Wenruo
There are 2 known extent buffer: 1) With -t option. -t option will skip other tree roots, but it will read the root node first and then skip it. Where it forgets to free the tree block it read. 2) with -b option. It forgets to free the tree block it read. Signed-off-by: Qu Wenruo --- btrfs-debu

[PATCH] btrfs-progs: Move -rdynamic linker only option to LDFLAGS.

2015-02-10 Thread Qu Wenruo
Same thing as clang cleanup patch: commit 040b3f11ba6bd793a9ef79ed4d9032d22370 Author: Qu Wenruo Date: Fri Dec 19 14:13:08 2014 +0800 btrfs-progs: Makefile: Move linker only option to LDFLAGS But the move to autoconfig seems using old Makefile. So do it again. Signed-off-by: Qu Wenruo

Re: [PATCH v3 00/10] Enhance btrfs-find-root and open_ctree() to provide better chance on damaged btrfs.

2015-02-10 Thread Qu Wenruo
Original Message Subject: Re: [PATCH v3 00/10] Enhance btrfs-find-root and open_ctree() to provide better chance on damaged btrfs. From: David Sterba To: Qu Wenruo Date: 2015年02月10日 22:48 On Thu, Jan 29, 2015 at 05:07:15PM +0800, Qu Wenruo wrote: Also, since only 2 patches

Re: [PATCH] btrfs-progs: fsck-test: Add check_sudo to check valid root/sudo privilege

2015-02-10 Thread Qu Wenruo
Original Message Subject: Re: [PATCH] btrfs-progs: fsck-test: Add check_sudo to check valid root/sudo privilege From: David Sterba To: Qu Wenruo Date: 2015年02月10日 21:30 On Mon, Feb 09, 2015 at 02:11:52PM +0800, Qu Wenruo wrote: Although fsck-test/012 uses sudo, it uses 'su

Re: [PATCH 09/16] Btrfs-progs: Introduce metadump_v2

2015-02-10 Thread Josef Bacik
On 02/10/2015 02:14 PM, David Sterba wrote: On Mon, Feb 09, 2015 at 03:03:12PM -0500, Josef Bacik wrote: The METADUMP super flag makes us skip doing the chunk tree reading which isn't helpful for the new restore since we have a valid chunk tree. But we still want to have a way for the kernel to

Re: [PATCH 09/16] Btrfs-progs: Introduce metadump_v2

2015-02-10 Thread David Sterba
On Mon, Feb 09, 2015 at 03:03:12PM -0500, Josef Bacik wrote: > The METADUMP super flag makes us skip doing the chunk tree reading which isn't > helpful for the new restore since we have a valid chunk tree. But we still > want > to have a way for the kernel to know that this is a metadump restore

Re: [PATCH 09/16] Btrfs-progs: Introduce metadump_v2

2015-02-10 Thread Josef Bacik
On 02/10/2015 01:28 PM, Eric Sandeen wrote: On 2/9/15 2:03 PM, Josef Bacik wrote: The METADUMP super flag makes us skip doing the chunk tree reading which isn't helpful for the new restore since we have a valid chunk tree. But we still want to have a way for the kernel to know that this is a me

Re: [PATCH 09/16] Btrfs-progs: Introduce metadump_v2

2015-02-10 Thread Eric Sandeen
On 2/9/15 2:03 PM, Josef Bacik wrote: > The METADUMP super flag makes us skip doing the chunk tree reading which isn't > helpful for the new restore since we have a valid chunk tree. But we still > want > to have a way for the kernel to know that this is a metadump restore so it > doesn't do thin

Re: Repair broken btrfs raid6?

2015-02-10 Thread Tobias Holst
2015-02-10 8:17 GMT+01:00 Kai Krakow : > Tobias Holst schrieb: > >> and "btrfs scrub status /[device]" gives me the following output: >>> "scrub status for [UUID] >>>scrub started at Mon Feb 9 18:16:38 2015 and was aborted after 2008 >>>seconds total bytes scrubbed: 113.04GiB with 0 errors" > > D

Re: btrfs performance, sudden drop to 0 IOPs

2015-02-10 Thread P. Remek
> What I /suspect/ is happening, is that at the 10 GiB files size, on > original file creation, btrfs is creating a large file of several > comparatively large extents (possibly 1 GiB each, the nominal data chunk > size, tho it can be larger on large enough filesystems). Note that btrfs > will nor

Re: [PATCH v3 00/10] Enhance btrfs-find-root and open_ctree() to provide better chance on damaged btrfs.

2015-02-10 Thread David Sterba
On Thu, Jan 29, 2015 at 05:07:15PM +0800, Qu Wenruo wrote: > Also, since only 2 patches is modified(although other part is slightly > modified to match the change), to avoid mail bombing, I created the pull > request on github and only send the first 2 patches with cover-letter. > https://github.co

Re: [GIT PULL] btrfsck and btrfs-image fixes

2015-02-10 Thread David Sterba
On Mon, Feb 09, 2015 at 03:03:03PM -0500, Josef Bacik wrote: > This series of patches fixes up btrfsck in lots of ways and adds some new > functionality. These patches were required to fix Hugo's broken multi-disk fs > as well as fix fsck so it would actually pass all of the fsck tests. This > a

Re: [PATCH] btrfs-progs: fsck-test: Add check_sudo to check valid root/sudo privilege

2015-02-10 Thread David Sterba
On Mon, Feb 09, 2015 at 02:11:52PM +0800, Qu Wenruo wrote: > Although fsck-test/012 uses sudo, it uses 'sudo -n', which won't prompt > user to input password and will return 1 if no valid credential is > found. > > And this makes test result quite annoying since it fails to mount and > still conti

Re: Repair broken btrfs raid6?

2015-02-10 Thread Ed Tomlinson
On Tuesday, February 10, 2015 2:17:43 AM EST, Kai Krakow wrote: Tobias Holst schrieb: and "btrfs scrub status /[device]" gives me the following output: "scrub status for [UUID] scrub started at Mon Feb 9 18:16:38 2015 and was aborted after 2008 seconds total bytes scrubbed: 113.04GiB with 0

Re: [PATCH 3/3] btrfs: qgroup: fix a wrong parameter of no_quota.

2015-02-10 Thread Filipe David Manana
On Tue, Feb 10, 2015 at 10:24 AM, Dongsheng Yang wrote: > In function of __btrfs_mod_ref(), we are passing the no_quota=1 > to process_func() anyway. It will make the numbers in qgroup be > wrong when deleting a subvolume. The data size in a deleted subvolume > will never be decressed from all rel

[PATCH 2/7] btrfs: qgroup: apply type to the recording and accounting.

2015-02-10 Thread Dongsheng Yang
So far, we have a type in each qgroup and we can create a qgroup in different type. But there is no actual differenc in accounting action in different qgroups. This patch makes the qgroup ignore the qgroup recording for other type. It means qgroup in DATA type only care about the data size in this

[PATCH 7/7] btrfs: qgroup: fix a bug when type of parent is different with child's.

2015-02-10 Thread Dongsheng Yang
When the type of a record is not considered, we currently ignore it at all. But this operation may be considered by his parent. This patch fix this problem, it record the operation and only accounting it when current type cover the operation type in iteration. Signed-off-by: Dongsheng Yang ---

[PATCH 3/4] btrfs-progs:specify qgroup type when creating qgroup

2015-02-10 Thread Dongsheng Yang
From: Fan Chengniang add --qgroup-type option to specify qgroup type. Type can be metadata, data or mixed. Signed-off-by: Fan Chengniang Signed-off-by: Dongsheng Yang --- Documentation/btrfs-qgroup.txt | 5 + cmds-qgroup.c | 37 ++--- 2 fi

[PATCH 3/7] btrfs: qgroup: Apply type to btrfs_qgroup_inherit().

2015-02-10 Thread Dongsheng Yang
Now, we have a type in each qgroup, then when we do a inherit(), we need to consider the type of qgroup to decide account metadata or not. Signed-off-by: Dongsheng Yang --- fs/btrfs/qgroup.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/qgroup.c

[PATCH 4/7] btrfs: qgroup: Apply qgroup type to qgroup creating.

2015-02-10 Thread Dongsheng Yang
This patch provide a method to user to create a qgroup in a specified type. It use a byte of the ->create in btrfs_ioctl_qgroup_create_args to pass the type of qgroup to kernel. Then there is a macro named as BTRFS_QGROUP_TYPE_SHIFT to help kernel get the type of qgroup user want to creat. Signed

[PATCH 5/7] btrfs: qgroup: Apply qgroup type to subvol creating.

2015-02-10 Thread Dongsheng Yang
Although we have a type in each qgroup, the all qgroups are created in a default mode. This patch provide a method to user to specify the type of qgroup for a sub volume. It uses an unused byte in btrfs_ioctl_vol_args_v2 to pass a qgroup type from userspace to kernel. Then kernel can create a qgro

[PATCH 3/4] Btrfs: qgroup, Account data space in more proper timings.

2015-02-10 Thread Dongsheng Yang
Currenly, in data writing, ->reserved is accounted in fill_delalloc(), but ->may_use is released in clear_bit_hook() which is called by btrfs_finish_ordered_io(). That's too late, that said, between fill_delalloc() and btrfs_finish_ordered_io(), the data is doublely accounted by qgroup. It will cau

[PATCH 2/4] Btrfs: qgroup: Introduce a may_use to account space_info->bytes_may_use.

2015-02-10 Thread Dongsheng Yang
Currently, for pre_alloc or delay_alloc, the bytes will be accounted in space_info by the three guys. space_info->bytes_may_use --- space_info->reserved --- space_info->used. But on the other hand, in qgroup, there are only two counters to account the bytes, qgroup->reserved and qgroup->excl. And q

[PATCH 4/4] btrfs-progs:show qgroup type

2015-02-10 Thread Dongsheng Yang
From: Fan Chengniang make 'btrfs qgroup show' command show qgroup type. Signed-off-by: Fan Chengniang --- qgroup.c | 42 +++--- qgroup.h | 1 + 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/qgroup.c b/qgroup.c index a647925..d359659 100644

[RFC PATCH 0/7] Btrfs: qgroup: part-4: Add type to btrfs qgroup.

2015-02-10 Thread Dongsheng Yang
Hi all, This patchset is based on [Btrfs: qgroup: part-3: bug fixes.] I am introducing a type to qgroup, then we can get the numbers what we only care about. Easy way to get the code for testing: btrfs: https://yangdongsh...@github.com/yangdongsheng/linux.git qgroup_type btrfs-

[PATCH 1/4] btrfs-progs: Add type to qgroup.

2015-02-10 Thread Dongsheng Yang
Signed-off-by: Dongsheng Yang --- ctree.h | 12 +++- ioctl.h | 1 + mkfs.c | 2 ++ print-tree.c | 9 + qgroup.c | 25 +++-- qgroup.h | 16 6 files changed, 58 insertions(+), 7 deletions(-) diff --git a/ctree.h b/ctre

[PATCH 6/7] btrfs: qgroup: apply type to quota rescan.

2015-02-10 Thread Dongsheng Yang
Although we have different type for each qgroup now, but the rescan is also working as before which is considering data and metadata both. This patch fix this problem. Signed-off-by: Dongsheng Yang --- fs/btrfs/qgroup.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-)

[PATCH 1/7] Btrfs: qgroup: Add type to btrfs_qgroup.

2015-02-10 Thread Dongsheng Yang
This patch is introducing a *type* to btrfs_qgroup. Type could be data, metadata or both. data means this qgroup only care about the data size, metadata means this qgroup only care about the metadata size and both means this qgroup will care about data and metadata like what it was doing before th

[PATCH 2/4] btrfs-progs: specify qgroup type when creating subvolume

2015-02-10 Thread Dongsheng Yang
From: Fan Chengniang add --qgroup-type option to specify qgroup type. Type can be metadata, data or all. Signed-off-by: Fan Chengniang Signed-off-by: Dongsheng Yang --- Documentation/btrfs-subvolume.txt | 4 cmds-subvolume.c | 50 +--

[PATCH 1/4] Btrfs: qgroup: free reserved in exceeding quota.

2015-02-10 Thread Dongsheng Yang
When we exceed quota limit in writing, we will free some reserved extent when we need to drop but not free account in qgroup. It means, each time we exceed quota in writing, there will be some remain space in qg->reserved we can not use any more. If things go on like this, the all space will be ate

[PATCH 3/3] btrfs: qgroup: fix a wrong parameter of no_quota.

2015-02-10 Thread Dongsheng Yang
In function of __btrfs_mod_ref(), we are passing the no_quota=1 to process_func() anyway. It will make the numbers in qgroup be wrong when deleting a subvolume. The data size in a deleted subvolume will never be decressed from all related qgroups. Signed-off-by: Dongsheng Yang --- fs/btrfs/exten

[PATCH 9/9] btrfs: qgroup: obtain quota status

2015-02-10 Thread Dongsheng Yang
From: Fan Chengniang add a function to obtain quota status. Now it can only get whether quota is enabled. We can extend the function to get more quota status Signed-off-by: Fan Chengniang --- fs/btrfs/ioctl.c | 6 ++ fs/btrfs/qgroup.c | 14 ++ fs/btrfs/qgrou

[PATCH 5/9] btrfs: qgroup: update limit info in function btrfs_run_qgroups().

2015-02-10 Thread Dongsheng Yang
When we commit_transaction(), qgroups in btree should be updated. But, limit info is not considered currently. It will cause a problem when a qgroup of a snapshot inherit the limit info from srcqgroup, then there is an inconsistency. Signed-off-by: Dongsheng Yang --- fs/btrfs/qgroup.c | 4

[PATCH 4/4] btrfs: qgroup: do a reservation in a higher level.

2015-02-10 Thread Dongsheng Yang
There are two problems in qgroup: a). The PAGE_CACHE is 4K, even when we are writing a data of 1K, qgroup will reserve a 4K size. It will cause the last 3K in a qgroup is not available to user. b). When user is writing a inline data, qgroup will not reserve it, it means this is a window we can ex

[PATCH 4/9] btrfs: qgroup: consolidate the parameter of fucntion update_qgroup_limit_item().

2015-02-10 Thread Dongsheng Yang
Cleanup: Change the parameter of update_qgroup_limit_item() to the family of update_qgroup_xxx_item(). Signed-off-by: Dongsheng Yang --- fs/btrfs/qgroup.c | 51 --- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/fs/btrfs/qgroup.c b

[PATCH 1/2] btrfs-progs:correct the return value

2015-02-10 Thread Dongsheng Yang
From: Fan Chengniang the return values 12 and 13 are not used spectially except as return value. No description and definition about them. so I change them to generic errno Signed-off-by: Fan Chengniang --- qgroup.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qgr

[PATCH 1/3] btrfs: qgroup: return EINVAL if level of parent is not higher than child's.

2015-02-10 Thread Dongsheng Yang
When we create a subvol inheriting a qgroup, we need to check the level of them. Otherwise, there is a chance a qgroup can inherit another qgroup at the same level. Signed-off-by: Dongsheng Yang --- fs/btrfs/qgroup.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs/btrfs/qgroup.c b/fs

[PATCH 2/3] btrfs: qgroup: allow to remove qgroup which has parent but no child.

2015-02-10 Thread Dongsheng Yang
When a qgroup has parents but no child, it should be removable in Theory I think. But currently, we can not remove it when it has either parent or child. Example: # btrfs quota enable /mnt # btrfs qgroup create 1/0 /mnt # btrfs qgroup create 2/0 /mnt # btrfs qgroup

[PATCH 1/9] btrfs: qgroup: move WARN_ON() to the correct location.

2015-02-10 Thread Dongsheng Yang
In function qgroup_excl_accounting(), we need to WARN when qg->excl is less than what we want to free, same to child and parents. But currently, for parent qgroup, the WARN_ON() is located after freeing qg->excl. It will WARN out even we free it normally. This patch move this WARN_ON() before free

[PATCH 7/9] Btrfs: qgroup: make the btree for qgroup increase from left to right.

2015-02-10 Thread Dongsheng Yang
It's not a big deal, but I would rather make the btree follow the convention to increase from left to right. Signed-off-by: Dongsheng Yang --- fs/btrfs/qgroup.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 34717ed..d3c261

[PATCH 6/9] btrfs: qgroup: fix limit args override whole limit struct

2015-02-10 Thread Dongsheng Yang
btrfs_limit_group use arg limit to override the old qgroup_limit of corresponding qgroup. However, we should override part of old qgroup_limit according to the bit which has been set in arg limit. Signed-off-by: Fan Chengniang Signed-off-by: Dongsheng Yang --- fs/btrfs/qgroup.c | 15 ++-

[PATCH 2/2] btrfs-progs:set max_rfer and max_excl on creating new subvolume

2015-02-10 Thread Dongsheng Yang
From: Fan Chengniang add -r and -e options to enable setting max reference size and max exclusive on creating new subvolumes. Signed-off-by: Fan Chengniang --- Documentation/btrfs-subvolume.txt | 8 +++- cmds-qgroup.c | 42 -- cmds-subvolume.c

[PATCH 0/4] Btrfs: qgroup: part-2: bug fixes for qgroup reservation.

2015-02-10 Thread Dongsheng Yang
Hi all, This is part2 for qgroup. It is based on [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes. [1/4] is reviewed-by Josef. [2/4] - [4/4] are trying to solve a problem in qgroup reservation. It would be weired I introduce a may_use in 2/4 and delete it in 4/4. Yes, I am glad to r

[PATCH 3/9] btrfs: qgroup: update qgroup in memory at the same time when we update it in btree.

2015-02-10 Thread Dongsheng Yang
When we call btrfs_qgroup_inherit() with BTRFS_QGROUP_INHERIT_SET_LIMITS, btrfs will update the limit info of qgroup in btree but forget to update the qgroup in rbtree at the same time. It obviousely will cause an inconsistency. This patch fix it by updating the rbtree at the same time. Signed-o

[PATCH 0/3] Btrfs: qgroup: part-3: bug fixes for deleting subvolume.

2015-02-10 Thread Dongsheng Yang
Hi all, This is a part3 for qgroup, it is based on Btrfs: qgroup: part-2: bug fixes. Dongsheng Yang (3): btrfs: qgroup: return EINVAL if level of parent is not higher than child's. btrfs: qgroup: allow to remove qgroup which has parent but no child. btrfs: qgroup: fix a w

[PATCH 2/9] btrfs: qgroup: inherit limit info from srcgroup in creating snapshot.

2015-02-10 Thread Dongsheng Yang
Currently, when we snapshot a subvol, snapshot will not copy the limits from srcqgroup. This patch make the qgroup in snapshot inherit the limit info when create a snapshot. Signed-off-by: Dongsheng Yang --- fs/btrfs/qgroup.c | 8 1 file changed, 8 insertions(+) diff --git a/fs/btrfs/

[PATCH 8/9] Btrfs: qgroup: cleanup, remove an unsued parameter in btrfs_create_qgroup().

2015-02-10 Thread Dongsheng Yang
Signed-off-by: Dongsheng Yang --- fs/btrfs/ioctl.c | 3 +-- fs/btrfs/qgroup.c | 2 +- fs/btrfs/qgroup.h | 3 +-- fs/btrfs/tests/qgroup-tests.c | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index d4

[PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit.

2015-02-10 Thread Dongsheng Yang
Hi all, [1/9] is a RESEND with a reviewed-by. [2/9]-[6/9] are bug fixes about qgroup_inherit(), these patch make user can set the limits when creating a subvolume with the related patch in userspace applied. [7/9]-[8/9] are a cleanup for qgroup. [9/9] provides a way for btrfs-progs to get the q

undeletable, lost and empty files

2015-02-10 Thread Leufke, Philipp M. (INT)
Good morning, these days I am encountering severe problems with at least two btrfs subvolumes of a raid1 volume. The problems started after a regular dist-upgrade on a machine running Ubuntu 14.04 with kernel 3.16.7-031607-generic. As maybe the following issue with Virtualbox (VB) is related,

RE: [PATCH v2] Btrfs: fix BUG_ON in btrfs_orphan_add() when delete unused block group

2015-02-10 Thread Zhao Lei
Hi, Liu > Removing large amount of block group in a transaction may encounters > BUG_ON() in btrfs_orphan_add(). That is becuase > btrfs_orphan_reserve_metadata() Not big matter, s/becuase/because Thanks Zhaolei > will grab metadata reservation from transaction handle, and > btrfs_delete_unused