diff options
author | Mark Fasheh <mfasheh@suse.de> | 2014-05-07 13:07:17 -0700 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-08-22 14:39:33 +0200 |
commit | 96ec888aad41969d728ba62c1778d6e8ebe6bd4e (patch) | |
tree | 413ea722f864ba14714ad47a57e479e29ce6d848 /ctree.h | |
parent | 2ab405af95d43972b57c7806981220a6949df643 (diff) | |
download | btrfs-progs-96ec888aad41969d728ba62c1778d6e8ebe6bd4e.tar.gz |
btrfs-progs: add quota group verify code
This patch adds functionality (in qgroup-verify.c) to compute bytecounts in
subvolume quota groups. The original groups are read in and stored in memory
so that after we compute our own bytecounts, we can compare them with those
on disk. A print function is provided to do this comparison and show the
results on the console.
A 'qgroup check' pass is added to btrfsck. If any subvolume quota groups
differ from what we compute, the differences for them are printed. We also
provide an option '--qgroup-report' which will run only the quota check code
and print a report on all quota groups. Other than making it possible to
verify that our qgroup changes work correctly, this mode can also be used in
xfstests for automated checking after qgroup tests.
This patch does not address the following:
- compressed counts are identical to non compressed, because kernel doesn't
make the distinction yet. Adding the code to verify compressed counts
shouldn't be hard at all though once kernel can do this.
- It is only concerned with subvolume quota groups (like most of
btrfs-progs).
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'ctree.h')
-rw-r--r-- | ctree.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -943,6 +943,7 @@ struct btrfs_fs_info { struct btrfs_root *chunk_root; struct btrfs_root *dev_root; struct btrfs_root *csum_root; + struct btrfs_root *quota_root; struct rb_root fs_root_tree; @@ -988,6 +989,7 @@ struct btrfs_fs_info { unsigned int readonly:1; unsigned int on_restoring:1; unsigned int is_chunk_recover:1; + unsigned int quota_enabled:1; int (*free_extent_hook)(struct btrfs_trans_handle *trans, struct btrfs_root *root, @@ -2382,4 +2384,12 @@ int btrfs_csum_truncate(struct btrfs_trans_handle *trans, int btrfs_lookup_uuid_subvol_item(int fd, const u8 *uuid, u64 *subvol_id); int btrfs_lookup_uuid_received_subvol_item(int fd, const u8 *uuid, u64 *subvol_id); + +static inline int is_fstree(u64 rootid) +{ + if (rootid == BTRFS_FS_TREE_OBJECTID || + (signed long long)rootid >= (signed long long)BTRFS_FIRST_FREE_OBJECTID) + return 1; + return 0; +} #endif |