diff options
author | Arne Jansen <sensille@gmx.net> | 2011-09-13 05:06:07 -0400 |
---|---|---|
committer | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-07-10 09:14:42 -0400 |
commit | 630dc772ea51bca3ec6fac609f450cbe0cafd1d6 (patch) | |
tree | a8d9bb1a88f9e791aa8509acf34873c849f45024 /fs/btrfs/ctree.h | |
parent | 097b8a7c9e48e2cb50fd0eb9315791921beaf484 (diff) |
Btrfs: qgroup on-disk format
Not all features are in use by the current version
and thus may change in the future.
Signed-off-by: Arne Jansen <sensille@gmx.net>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 8f8dc46f44e7..33088b0dbf3f 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -91,6 +91,9 @@ struct btrfs_ordered_sum; | |||
91 | /* for storing balance parameters in the root tree */ | 91 | /* for storing balance parameters in the root tree */ |
92 | #define BTRFS_BALANCE_OBJECTID -4ULL | 92 | #define BTRFS_BALANCE_OBJECTID -4ULL |
93 | 93 | ||
94 | /* holds quota configuration and tracking */ | ||
95 | #define BTRFS_QUOTA_TREE_OBJECTID 8ULL | ||
96 | |||
94 | /* orhpan objectid for tracking unlinked/truncated files */ | 97 | /* orhpan objectid for tracking unlinked/truncated files */ |
95 | #define BTRFS_ORPHAN_OBJECTID -5ULL | 98 | #define BTRFS_ORPHAN_OBJECTID -5ULL |
96 | 99 | ||
@@ -883,6 +886,72 @@ struct btrfs_block_group_item { | |||
883 | __le64 flags; | 886 | __le64 flags; |
884 | } __attribute__ ((__packed__)); | 887 | } __attribute__ ((__packed__)); |
885 | 888 | ||
889 | /* | ||
890 | * is subvolume quota turned on? | ||
891 | */ | ||
892 | #define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0) | ||
893 | /* | ||
894 | * SCANNING is set during the initialization phase | ||
895 | */ | ||
896 | #define BTRFS_QGROUP_STATUS_FLAG_SCANNING (1ULL << 1) | ||
897 | /* | ||
898 | * Some qgroup entries are known to be out of date, | ||
899 | * either because the configuration has changed in a way that | ||
900 | * makes a rescan necessary, or because the fs has been mounted | ||
901 | * with a non-qgroup-aware version. | ||
902 | * Turning qouta off and on again makes it inconsistent, too. | ||
903 | */ | ||
904 | #define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2) | ||
905 | |||
906 | #define BTRFS_QGROUP_STATUS_VERSION 1 | ||
907 | |||
908 | struct btrfs_qgroup_status_item { | ||
909 | __le64 version; | ||
910 | /* | ||
911 | * the generation is updated during every commit. As older | ||
912 | * versions of btrfs are not aware of qgroups, it will be | ||
913 | * possible to detect inconsistencies by checking the | ||
914 | * generation on mount time | ||
915 | */ | ||
916 | __le64 generation; | ||
917 | |||
918 | /* flag definitions see above */ | ||
919 | __le64 flags; | ||
920 | |||
921 | /* | ||
922 | * only used during scanning to record the progress | ||
923 | * of the scan. It contains a logical address | ||
924 | */ | ||
925 | __le64 scan; | ||
926 | } __attribute__ ((__packed__)); | ||
927 | |||
928 | struct btrfs_qgroup_info_item { | ||
929 | __le64 generation; | ||
930 | __le64 rfer; | ||
931 | __le64 rfer_cmpr; | ||
932 | __le64 excl; | ||
933 | __le64 excl_cmpr; | ||
934 | } __attribute__ ((__packed__)); | ||
935 | |||
936 | /* flags definition for qgroup limits */ | ||
937 | #define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0) | ||
938 | #define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1) | ||
939 | #define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2) | ||
940 | #define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3) | ||
941 | #define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4) | ||
942 | #define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5) | ||
943 | |||
944 | struct btrfs_qgroup_limit_item { | ||
945 | /* | ||
946 | * only updated when any of the other values change | ||
947 | */ | ||
948 | __le64 flags; | ||
949 | __le64 max_rfer; | ||
950 | __le64 max_excl; | ||
951 | __le64 rsv_rfer; | ||
952 | __le64 rsv_excl; | ||
953 | } __attribute__ ((__packed__)); | ||
954 | |||
886 | struct btrfs_space_info { | 955 | struct btrfs_space_info { |
887 | u64 flags; | 956 | u64 flags; |
888 | 957 | ||
@@ -1534,6 +1603,30 @@ struct btrfs_ioctl_defrag_range_args { | |||
1534 | #define BTRFS_DEV_ITEM_KEY 216 | 1603 | #define BTRFS_DEV_ITEM_KEY 216 |
1535 | #define BTRFS_CHUNK_ITEM_KEY 228 | 1604 | #define BTRFS_CHUNK_ITEM_KEY 228 |
1536 | 1605 | ||
1606 | /* | ||
1607 | * Records the overall state of the qgroups. | ||
1608 | * There's only one instance of this key present, | ||
1609 | * (0, BTRFS_QGROUP_STATUS_KEY, 0) | ||
1610 | */ | ||
1611 | #define BTRFS_QGROUP_STATUS_KEY 240 | ||
1612 | /* | ||
1613 | * Records the currently used space of the qgroup. | ||
1614 | * One key per qgroup, (0, BTRFS_QGROUP_INFO_KEY, qgroupid). | ||
1615 | */ | ||
1616 | #define BTRFS_QGROUP_INFO_KEY 242 | ||
1617 | /* | ||
1618 | * Contains the user configured limits for the qgroup. | ||
1619 | * One key per qgroup, (0, BTRFS_QGROUP_LIMIT_KEY, qgroupid). | ||
1620 | */ | ||
1621 | #define BTRFS_QGROUP_LIMIT_KEY 244 | ||
1622 | /* | ||
1623 | * Records the child-parent relationship of qgroups. For | ||
1624 | * each relation, 2 keys are present: | ||
1625 | * (childid, BTRFS_QGROUP_RELATION_KEY, parentid) | ||
1626 | * (parentid, BTRFS_QGROUP_RELATION_KEY, childid) | ||
1627 | */ | ||
1628 | #define BTRFS_QGROUP_RELATION_KEY 246 | ||
1629 | |||
1537 | #define BTRFS_BALANCE_ITEM_KEY 248 | 1630 | #define BTRFS_BALANCE_ITEM_KEY 248 |
1538 | 1631 | ||
1539 | /* | 1632 | /* |
@@ -2474,6 +2567,49 @@ static inline void btrfs_set_dev_stats_value(struct extent_buffer *eb, | |||
2474 | sizeof(val)); | 2567 | sizeof(val)); |
2475 | } | 2568 | } |
2476 | 2569 | ||
2570 | /* btrfs_qgroup_status_item */ | ||
2571 | BTRFS_SETGET_FUNCS(qgroup_status_generation, struct btrfs_qgroup_status_item, | ||
2572 | generation, 64); | ||
2573 | BTRFS_SETGET_FUNCS(qgroup_status_version, struct btrfs_qgroup_status_item, | ||
2574 | version, 64); | ||
2575 | BTRFS_SETGET_FUNCS(qgroup_status_flags, struct btrfs_qgroup_status_item, | ||
2576 | flags, 64); | ||
2577 | BTRFS_SETGET_FUNCS(qgroup_status_scan, struct btrfs_qgroup_status_item, | ||
2578 | scan, 64); | ||
2579 | |||
2580 | /* btrfs_qgroup_info_item */ | ||
2581 | BTRFS_SETGET_FUNCS(qgroup_info_generation, struct btrfs_qgroup_info_item, | ||
2582 | generation, 64); | ||
2583 | BTRFS_SETGET_FUNCS(qgroup_info_rfer, struct btrfs_qgroup_info_item, rfer, 64); | ||
2584 | BTRFS_SETGET_FUNCS(qgroup_info_rfer_cmpr, struct btrfs_qgroup_info_item, | ||
2585 | rfer_cmpr, 64); | ||
2586 | BTRFS_SETGET_FUNCS(qgroup_info_excl, struct btrfs_qgroup_info_item, excl, 64); | ||
2587 | BTRFS_SETGET_FUNCS(qgroup_info_excl_cmpr, struct btrfs_qgroup_info_item, | ||
2588 | excl_cmpr, 64); | ||
2589 | |||
2590 | BTRFS_SETGET_STACK_FUNCS(stack_qgroup_info_generation, | ||
2591 | struct btrfs_qgroup_info_item, generation, 64); | ||
2592 | BTRFS_SETGET_STACK_FUNCS(stack_qgroup_info_rfer, struct btrfs_qgroup_info_item, | ||
2593 | rfer, 64); | ||
2594 | BTRFS_SETGET_STACK_FUNCS(stack_qgroup_info_rfer_cmpr, | ||
2595 | struct btrfs_qgroup_info_item, rfer_cmpr, 64); | ||
2596 | BTRFS_SETGET_STACK_FUNCS(stack_qgroup_info_excl, struct btrfs_qgroup_info_item, | ||
2597 | excl, 64); | ||
2598 | BTRFS_SETGET_STACK_FUNCS(stack_qgroup_info_excl_cmpr, | ||
2599 | struct btrfs_qgroup_info_item, excl_cmpr, 64); | ||
2600 | |||
2601 | /* btrfs_qgroup_limit_item */ | ||
2602 | BTRFS_SETGET_FUNCS(qgroup_limit_flags, struct btrfs_qgroup_limit_item, | ||
2603 | flags, 64); | ||
2604 | BTRFS_SETGET_FUNCS(qgroup_limit_max_rfer, struct btrfs_qgroup_limit_item, | ||
2605 | max_rfer, 64); | ||
2606 | BTRFS_SETGET_FUNCS(qgroup_limit_max_excl, struct btrfs_qgroup_limit_item, | ||
2607 | max_excl, 64); | ||
2608 | BTRFS_SETGET_FUNCS(qgroup_limit_rsv_rfer, struct btrfs_qgroup_limit_item, | ||
2609 | rsv_rfer, 64); | ||
2610 | BTRFS_SETGET_FUNCS(qgroup_limit_rsv_excl, struct btrfs_qgroup_limit_item, | ||
2611 | rsv_excl, 64); | ||
2612 | |||
2477 | static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb) | 2613 | static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb) |
2478 | { | 2614 | { |
2479 | return sb->s_fs_info; | 2615 | return sb->s_fs_info; |