diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2015-04-20 09:53:50 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-06-10 09:26:23 -0700 |
commit | 9086db86e0b09c39abead4d747119695553e3978 (patch) | |
tree | 26cba099d0d7c8209e036024f70b32d3bd2615e0 /fs/btrfs/qgroup.c | |
parent | d4b804045924d7f8d2ea988be22c4b9e6492ec11 (diff) | |
download | linux-9086db86e0b09c39abead4d747119695553e3978.tar.bz2 |
btrfs: qgroup: Add the ability to skip given qgroup for old/new_roots.
This is used by later qgroup fix patches for snapshot.
As current snapshot accounting is done by btrfs_qgroup_inherit(), but
new extent oriented quota mechanism will account extent from
btrfs_copy_root() and other snapshot things, causing wrong result.
So add this ability to handle snapshot accounting.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/qgroup.c')
-rw-r--r-- | fs/btrfs/qgroup.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index c5aa0d34940e..d5f1f033b7a0 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1394,9 +1394,11 @@ int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans, struct btrfs_qgroup_extent_record *record; struct btrfs_delayed_ref_root *delayed_refs; struct rb_node *node; + u64 qgroup_to_skip; int ret = 0; delayed_refs = &trans->transaction->delayed_refs; + qgroup_to_skip = delayed_refs->qgroup_to_skip; /* * No need to do lock, since this function will only be called in @@ -1410,6 +1412,8 @@ int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans, &record->old_roots); if (ret < 0) break; + if (qgroup_to_skip) + ulist_del(record->old_roots, qgroup_to_skip, 0); node = rb_next(node); } return ret; @@ -1702,9 +1706,11 @@ int btrfs_qgroup_account_extents(struct btrfs_trans_handle *trans, struct btrfs_delayed_ref_root *delayed_refs; struct ulist *new_roots = NULL; struct rb_node *node; + u64 qgroup_to_skip; int ret = 0; delayed_refs = &trans->transaction->delayed_refs; + qgroup_to_skip = delayed_refs->qgroup_to_skip; while ((node = rb_first(&delayed_refs->dirty_extent_root))) { record = rb_entry(node, struct btrfs_qgroup_extent_record, node); @@ -1719,6 +1725,8 @@ int btrfs_qgroup_account_extents(struct btrfs_trans_handle *trans, record->bytenr, (u64)-1, &new_roots); if (ret < 0) goto cleanup; + if (qgroup_to_skip) + ulist_del(new_roots, qgroup_to_skip, 0); ret = btrfs_qgroup_account_extent(trans, fs_info, record->bytenr, record->num_bytes, record->old_roots, new_roots); |