diff options
author | Arne Jansen <sensille@gmx.net> | 2012-06-28 12:03:02 -0400 |
---|---|---|
committer | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-07-12 04:54:21 -0400 |
commit | bed92eae26ccf280d1a2168b7509447b56675a27 (patch) | |
tree | 4a852b27746dca2ab0b3646b7d7e050b93502bc5 /fs/btrfs/extent-tree.c | |
parent | 709c0486b9fe9586736b108b7233bbce0300cfa5 (diff) |
Btrfs: qgroup implementation and prototypes
Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index b13f1fbc3733..1a63b830846d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2409,6 +2409,40 @@ static u64 find_middle(struct rb_root *root) | |||
2409 | } | 2409 | } |
2410 | #endif | 2410 | #endif |
2411 | 2411 | ||
2412 | int btrfs_delayed_refs_qgroup_accounting(struct btrfs_trans_handle *trans, | ||
2413 | struct btrfs_fs_info *fs_info) | ||
2414 | { | ||
2415 | struct qgroup_update *qgroup_update; | ||
2416 | int ret = 0; | ||
2417 | |||
2418 | if (list_empty(&trans->qgroup_ref_list) != | ||
2419 | !trans->delayed_ref_elem.seq) { | ||
2420 | /* list without seq or seq without list */ | ||
2421 | printk(KERN_ERR "btrfs: qgroup accounting update error, list is%s empty, seq is %llu\n", | ||
2422 | list_empty(&trans->qgroup_ref_list) ? "" : " not", | ||
2423 | trans->delayed_ref_elem.seq); | ||
2424 | BUG(); | ||
2425 | } | ||
2426 | |||
2427 | if (!trans->delayed_ref_elem.seq) | ||
2428 | return 0; | ||
2429 | |||
2430 | while (!list_empty(&trans->qgroup_ref_list)) { | ||
2431 | qgroup_update = list_first_entry(&trans->qgroup_ref_list, | ||
2432 | struct qgroup_update, list); | ||
2433 | list_del(&qgroup_update->list); | ||
2434 | if (!ret) | ||
2435 | ret = btrfs_qgroup_account_ref( | ||
2436 | trans, fs_info, qgroup_update->node, | ||
2437 | qgroup_update->extent_op); | ||
2438 | kfree(qgroup_update); | ||
2439 | } | ||
2440 | |||
2441 | btrfs_put_tree_mod_seq(fs_info, &trans->delayed_ref_elem); | ||
2442 | |||
2443 | return ret; | ||
2444 | } | ||
2445 | |||
2412 | /* | 2446 | /* |
2413 | * this starts processing the delayed reference count updates and | 2447 | * this starts processing the delayed reference count updates and |
2414 | * extent insertions we have queued up so far. count can be | 2448 | * extent insertions we have queued up so far. count can be |