Re: [PATCH] btrfs: qgroup: Don't populating excl numbers for snapshot src if it belongs to other qgroups

2018-08-08 Thread Qu Wenruo
On 8/8/18 3:48 PM, Qu Wenruo wrote: > > > On 2018年08月08日 15:41, Misono Tomohiro wrote: >> On 2018/08/08 15:04, Qu Wenruo wrote: >>> When quota is enabled and we do a snapshot, we just update the 'excl' >>> number of both snapshot src and dst to src's 'rfer' - nodesize. >>> >>> It's a quick

Re: [PATCH v4] btrfs: qgroup: Remove qgroup items along with subvolume deletion

2018-08-08 Thread Qu Wenruo
On 8/9/18 12:12 PM, Misono Tomohiro wrote: > When qgroup is on, subvolume deletion does not remove qgroup items > of the subvolume (qgroup info, limit, relation) from quota tree and > they need to get removed manually by "btrfs qgroup destroy". > > Since level 0 qgroup cannot be used/inherited

Re: [PATCH] btrfs: qgroup: Always remove all qgroup relation in btrfs_remove_qgroup()

2018-08-08 Thread Qu Wenruo
On 8/9/18 12:10 PM, Misono Tomohiro wrote: > In btrfs_remove_qgroup(), each qgroup relation is removed by calling > __del_qgroup_relation(). However, __del_qgroup_relation() returns 1 > if deletion of qgroup relation causes inconsistency and current code > exits immediately in that case. > >

[PATCH v4] btrfs: qgroup: Remove qgroup items along with subvolume deletion

2018-08-08 Thread Misono Tomohiro
When qgroup is on, subvolume deletion does not remove qgroup items of the subvolume (qgroup info, limit, relation) from quota tree and they need to get removed manually by "btrfs qgroup destroy". Since level 0 qgroup cannot be used/inherited by any other subvolume, let's remove them automatically

[PATCH] btrfs: qgroup: Always remove all qgroup relation in btrfs_remove_qgroup()

2018-08-08 Thread Misono Tomohiro
In btrfs_remove_qgroup(), each qgroup relation is removed by calling __del_qgroup_relation(). However, __del_qgroup_relation() returns 1 if deletion of qgroup relation causes inconsistency and current code exits immediately in that case. Therefore if there are several qgroup relations and

[PATCH v3] btrfs: fix qgroup_free wrong num_bytes in btrfs_subvolume_reserve_metadata()

2018-08-08 Thread Lu Fengqi
After btrfs_qgroup_reserve_meta_prealloc(), num_bytes will be assigned again by btrfs_calc_trans_metadata_size(). Once block_rsv fails, we can't properly free the num_bytes of the previous qgroup_reserve. Use a separate variable to store the num_bytes of the qgroup_reserve. Delete the comment for

Re: [PATCH 2/5] btrfs: use a separate variable to store the num_bytes of the qgroup_reserve

2018-08-08 Thread Lu Fengqi
David Sterba 于2018年8月8日周三 下午9:57写道: > > On Wed, Aug 08, 2018 at 11:04:37AM +0800, Lu Fengqi wrote: > > On Tue, Aug 07, 2018 at 06:19:12PM +0200, David Sterba wrote: > > >On Sat, Aug 04, 2018 at 09:10:54PM +0800, Lu Fengqi wrote: > > >> After btrfs_qgroup_reserve_meta_prealloc(), num_bytes will be

Re: [PATCH 2/5] btrfs: use a separate variable to store the num_bytes of the qgroup_reserve

2018-08-08 Thread David Sterba
On Wed, Aug 08, 2018 at 11:04:37AM +0800, Lu Fengqi wrote: > On Tue, Aug 07, 2018 at 06:19:12PM +0200, David Sterba wrote: > >On Sat, Aug 04, 2018 at 09:10:54PM +0800, Lu Fengqi wrote: > >> After btrfs_qgroup_reserve_meta_prealloc(), num_bytes will be assigned > >> again by

Re: [PATCH v2 2/4] btrfs: fix race between free_stale_devices and close_fs_devices

2018-08-08 Thread Anand Jain
On 08/07/2018 10:59 PM, David Sterba wrote: On Thu, Aug 02, 2018 at 05:29:12PM +0800, Anand Jain wrote: On 08/01/2018 10:29 PM, David Sterba wrote: On Thu, Jul 26, 2018 at 02:53:32PM +0800, Anand Jain wrote: From: Anand Jain %fs_devices can be free-ed by btrfs_free_stale_devices() when

Re: [PATCH] btrfs: qgroup: Don't populating excl numbers for snapshot src if it belongs to other qgroups

2018-08-08 Thread Qu Wenruo
On 2018年08月08日 15:41, Misono Tomohiro wrote: > On 2018/08/08 15:04, Qu Wenruo wrote: >> When quota is enabled and we do a snapshot, we just update the 'excl' >> number of both snapshot src and dst to src's 'rfer' - nodesize. >> >> It's a quick hack to avoid quota rescan every time we create a

Re: [PATCH] btrfs: qgroup: Don't populating excl numbers for snapshot src if it belongs to other qgroups

2018-08-08 Thread Misono Tomohiro
On 2018/08/08 15:04, Qu Wenruo wrote: > When quota is enabled and we do a snapshot, we just update the 'excl' > number of both snapshot src and dst to src's 'rfer' - nodesize. > > It's a quick hack to avoid quota rescan every time we create a snapshot > and it works if src doesn't belong to other

Re: [RFC PATCH 0/4] undelete subvolume online version

2018-08-08 Thread Qu Wenruo
On 2018年08月08日 14:53, Lu Fengqi wrote: > On Wed, Aug 08, 2018 at 02:11:24PM +0800, Qu Wenruo wrote: >> >> >> On 2018年08月08日 00:39, David Sterba wrote: >>> On Sun, Aug 05, 2018 at 06:39:57PM +0800, Lu Fengqi wrote: This patchset will add the BTRFS_IOC_SUBVOL_UNDELETE ioctl for online

Re: [RFC PATCH 0/4] undelete subvolume online version

2018-08-08 Thread Lu Fengqi
On Wed, Aug 08, 2018 at 02:11:24PM +0800, Qu Wenruo wrote: > > >On 2018年08月08日 00:39, David Sterba wrote: >> On Sun, Aug 05, 2018 at 06:39:57PM +0800, Lu Fengqi wrote: >>> This patchset will add the BTRFS_IOC_SUBVOL_UNDELETE ioctl for online >>> btrfs subvolume undelete. >>> >>> And btrfs

Re: [RFC PATCH 0/4] undelete subvolume online version

2018-08-08 Thread Qu Wenruo
On 2018年08月08日 00:39, David Sterba wrote: > On Sun, Aug 05, 2018 at 06:39:57PM +0800, Lu Fengqi wrote: >> This patchset will add the BTRFS_IOC_SUBVOL_UNDELETE ioctl for online >> btrfs subvolume undelete. >> >> And btrfs subvolume undelete subcommand was added to btrfs-progs. >> >> So user can

[PATCH] btrfs: qgroup: Don't populating excl numbers for snapshot src if it belongs to other qgroups

2018-08-08 Thread Qu Wenruo
When quota is enabled and we do a snapshot, we just update the 'excl' number of both snapshot src and dst to src's 'rfer' - nodesize. It's a quick hack to avoid quota rescan every time we create a snapshot and it works if src doesn't belong to other qgroups. But if we have higher level qgroups,