aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2013-04-25 12:04:51 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-05-06 15:55:19 -0400
commit2f2320360b0c35b86938bfc561124474f0dac6e4 (patch)
treef7b1cbec89d9c6d030f15817e77ee42e5941244a /fs/btrfs/ctree.h
parent46b665ceb1edd2ac149ff701313c115f52dc0348 (diff)
Btrfs: rescan for qgroups
If qgroup tracking is out of sync, a rescan operation can be started. It iterates the complete extent tree and recalculates all qgroup tracking data. This is an expensive operation and should not be used unless required. A filesystem under rescan can still be umounted. The rescan continues on the next mount. Status information is provided with a separate ioctl while a rescan operation is in progress. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 2c48f52aba40..d9bed5fd3347 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1021,9 +1021,9 @@ struct btrfs_block_group_item {
1021 */ 1021 */
1022#define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0) 1022#define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0)
1023/* 1023/*
1024 * SCANNING is set during the initialization phase 1024 * RESCAN is set during the initialization phase
1025 */ 1025 */
1026#define BTRFS_QGROUP_STATUS_FLAG_SCANNING (1ULL << 1) 1026#define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1)
1027/* 1027/*
1028 * Some qgroup entries are known to be out of date, 1028 * Some qgroup entries are known to be out of date,
1029 * either because the configuration has changed in a way that 1029 * either because the configuration has changed in a way that
@@ -1052,7 +1052,7 @@ struct btrfs_qgroup_status_item {
1052 * only used during scanning to record the progress 1052 * only used during scanning to record the progress
1053 * of the scan. It contains a logical address 1053 * of the scan. It contains a logical address
1054 */ 1054 */
1055 __le64 scan; 1055 __le64 rescan;
1056} __attribute__ ((__packed__)); 1056} __attribute__ ((__packed__));
1057 1057
1058struct btrfs_qgroup_info_item { 1058struct btrfs_qgroup_info_item {
@@ -1603,6 +1603,11 @@ struct btrfs_fs_info {
1603 /* used by btrfs_qgroup_record_ref for an efficient tree traversal */ 1603 /* used by btrfs_qgroup_record_ref for an efficient tree traversal */
1604 u64 qgroup_seq; 1604 u64 qgroup_seq;
1605 1605
1606 /* qgroup rescan items */
1607 struct mutex qgroup_rescan_lock; /* protects the progress item */
1608 struct btrfs_key qgroup_rescan_progress;
1609 struct btrfs_workers qgroup_rescan_workers;
1610
1606 /* filesystem state */ 1611 /* filesystem state */
1607 unsigned long fs_state; 1612 unsigned long fs_state;
1608 1613
@@ -2886,8 +2891,8 @@ BTRFS_SETGET_FUNCS(qgroup_status_version, struct btrfs_qgroup_status_item,
2886 version, 64); 2891 version, 64);
2887BTRFS_SETGET_FUNCS(qgroup_status_flags, struct btrfs_qgroup_status_item, 2892BTRFS_SETGET_FUNCS(qgroup_status_flags, struct btrfs_qgroup_status_item,
2888 flags, 64); 2893 flags, 64);
2889BTRFS_SETGET_FUNCS(qgroup_status_scan, struct btrfs_qgroup_status_item, 2894BTRFS_SETGET_FUNCS(qgroup_status_rescan, struct btrfs_qgroup_status_item,
2890 scan, 64); 2895 rescan, 64);
2891 2896
2892/* btrfs_qgroup_info_item */ 2897/* btrfs_qgroup_info_item */
2893BTRFS_SETGET_FUNCS(qgroup_info_generation, struct btrfs_qgroup_info_item, 2898BTRFS_SETGET_FUNCS(qgroup_info_generation, struct btrfs_qgroup_info_item,
@@ -3828,7 +3833,7 @@ int btrfs_quota_enable(struct btrfs_trans_handle *trans,
3828 struct btrfs_fs_info *fs_info); 3833 struct btrfs_fs_info *fs_info);
3829int btrfs_quota_disable(struct btrfs_trans_handle *trans, 3834int btrfs_quota_disable(struct btrfs_trans_handle *trans,
3830 struct btrfs_fs_info *fs_info); 3835 struct btrfs_fs_info *fs_info);
3831int btrfs_quota_rescan(struct btrfs_fs_info *fs_info); 3836int btrfs_qgroup_rescan(struct btrfs_fs_info *fs_info);
3832int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans, 3837int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans,
3833 struct btrfs_fs_info *fs_info, u64 src, u64 dst); 3838 struct btrfs_fs_info *fs_info, u64 src, u64 dst);
3834int btrfs_del_qgroup_relation(struct btrfs_trans_handle *trans, 3839int btrfs_del_qgroup_relation(struct btrfs_trans_handle *trans,