diff options
author | Arne Jansen <sensille@gmx.net> | 2011-09-13 06:56:09 -0400 |
---|---|---|
committer | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-07-10 09:14:44 -0400 |
commit | 416ac51da90e98daaac17e1f359a6c5591f7f5bd (patch) | |
tree | 44dd89f08ef1fe9a0f90917beb3df1f066bc1901 /fs | |
parent | 20897f5c86b9d2b77baea1d48eda7fa4ac217279 (diff) |
Btrfs: qgroup state and initialization
Add state to fs_info.
Signed-off-by: Arne Jansen <sensille@gmx.net>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ctree.h | 24 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 7 |
2 files changed, 31 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 27cf995564ed..a5269d4a164f 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1120,6 +1120,7 @@ struct btrfs_fs_info { | |||
1120 | struct btrfs_root *dev_root; | 1120 | struct btrfs_root *dev_root; |
1121 | struct btrfs_root *fs_root; | 1121 | struct btrfs_root *fs_root; |
1122 | struct btrfs_root *csum_root; | 1122 | struct btrfs_root *csum_root; |
1123 | struct btrfs_root *quota_root; | ||
1123 | 1124 | ||
1124 | /* the log root tree is a directory of all the other log roots */ | 1125 | /* the log root tree is a directory of all the other log roots */ |
1125 | struct btrfs_root *log_root_tree; | 1126 | struct btrfs_root *log_root_tree; |
@@ -1374,6 +1375,29 @@ struct btrfs_fs_info { | |||
1374 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 1375 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
1375 | u32 check_integrity_print_mask; | 1376 | u32 check_integrity_print_mask; |
1376 | #endif | 1377 | #endif |
1378 | /* | ||
1379 | * quota information | ||
1380 | */ | ||
1381 | unsigned int quota_enabled:1; | ||
1382 | |||
1383 | /* | ||
1384 | * quota_enabled only changes state after a commit. This holds the | ||
1385 | * next state. | ||
1386 | */ | ||
1387 | unsigned int pending_quota_state:1; | ||
1388 | |||
1389 | /* is qgroup tracking in a consistent state? */ | ||
1390 | u64 qgroup_flags; | ||
1391 | |||
1392 | /* holds configuration and tracking. Protected by qgroup_lock */ | ||
1393 | struct rb_root qgroup_tree; | ||
1394 | spinlock_t qgroup_lock; | ||
1395 | |||
1396 | /* list of dirty qgroups to be written at next commit */ | ||
1397 | struct list_head dirty_qgroups; | ||
1398 | |||
1399 | /* used by btrfs_qgroup_record_ref for an efficient tree traversal */ | ||
1400 | u64 qgroup_seq; | ||
1377 | 1401 | ||
1378 | /* filesystem state */ | 1402 | /* filesystem state */ |
1379 | u64 fs_state; | 1403 | u64 fs_state; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 6fc243eccffa..eca054974425 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2110,6 +2110,13 @@ int open_ctree(struct super_block *sb, | |||
2110 | init_rwsem(&fs_info->cleanup_work_sem); | 2110 | init_rwsem(&fs_info->cleanup_work_sem); |
2111 | init_rwsem(&fs_info->subvol_sem); | 2111 | init_rwsem(&fs_info->subvol_sem); |
2112 | 2112 | ||
2113 | spin_lock_init(&fs_info->qgroup_lock); | ||
2114 | fs_info->qgroup_tree = RB_ROOT; | ||
2115 | INIT_LIST_HEAD(&fs_info->dirty_qgroups); | ||
2116 | fs_info->qgroup_seq = 1; | ||
2117 | fs_info->quota_enabled = 0; | ||
2118 | fs_info->pending_quota_state = 0; | ||
2119 | |||
2113 | btrfs_init_free_cluster(&fs_info->meta_alloc_cluster); | 2120 | btrfs_init_free_cluster(&fs_info->meta_alloc_cluster); |
2114 | btrfs_init_free_cluster(&fs_info->data_alloc_cluster); | 2121 | btrfs_init_free_cluster(&fs_info->data_alloc_cluster); |
2115 | 2122 | ||