]> Pileus Git - ~andy/linux/commitdiff
Btrfs: qgroup state and initialization
authorArne Jansen <sensille@gmx.net>
Tue, 13 Sep 2011 10:56:09 +0000 (12:56 +0200)
committerJan Schmidt <list.btrfs@jan-o-sch.net>
Tue, 10 Jul 2012 13:14:44 +0000 (15:14 +0200)
Add state to fs_info.

Signed-off-by: Arne Jansen <sensille@gmx.net>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c

index 27cf995564ed82586cb12c3818d09fe51db3d549..a5269d4a164f2bdface78af68c64e33ccab2221d 100644 (file)
@@ -1120,6 +1120,7 @@ struct btrfs_fs_info {
        struct btrfs_root *dev_root;
        struct btrfs_root *fs_root;
        struct btrfs_root *csum_root;
+       struct btrfs_root *quota_root;
 
        /* the log root tree is a directory of all the other log roots */
        struct btrfs_root *log_root_tree;
@@ -1374,6 +1375,29 @@ struct btrfs_fs_info {
 #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
        u32 check_integrity_print_mask;
 #endif
+       /*
+        * quota information
+        */
+       unsigned int quota_enabled:1;
+
+       /*
+        * quota_enabled only changes state after a commit. This holds the
+        * next state.
+        */
+       unsigned int pending_quota_state:1;
+
+       /* is qgroup tracking in a consistent state? */
+       u64 qgroup_flags;
+
+       /* holds configuration and tracking. Protected by qgroup_lock */
+       struct rb_root qgroup_tree;
+       spinlock_t qgroup_lock;
+
+       /* list of dirty qgroups to be written at next commit */
+       struct list_head dirty_qgroups;
+
+       /* used by btrfs_qgroup_record_ref for an efficient tree traversal */
+       u64 qgroup_seq;
 
        /* filesystem state */
        u64 fs_state;
index 6fc243eccffae2302860db47ed451b7a290cf921..eca05497442586a0a4058cbf10809a63bfd12768 100644 (file)
@@ -2110,6 +2110,13 @@ int open_ctree(struct super_block *sb,
        init_rwsem(&fs_info->cleanup_work_sem);
        init_rwsem(&fs_info->subvol_sem);
 
+       spin_lock_init(&fs_info->qgroup_lock);
+       fs_info->qgroup_tree = RB_ROOT;
+       INIT_LIST_HEAD(&fs_info->dirty_qgroups);
+       fs_info->qgroup_seq = 1;
+       fs_info->quota_enabled = 0;
+       fs_info->pending_quota_state = 0;
+
        btrfs_init_free_cluster(&fs_info->meta_alloc_cluster);
        btrfs_init_free_cluster(&fs_info->data_alloc_cluster);