diff options
author | Jan Kara <jack@suse.cz> | 2008-08-25 13:56:50 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:40:23 -0500 |
commit | 9e33d69f553aaf11377307e8d6f82deb3385e351 (patch) | |
tree | ded5f48f6cf82db976f30d5f0f4d44b941f60f44 /fs/ocfs2/ocfs2_fs.h | |
parent | bbbd0eb34bf801dee01e345785959a75258f6567 (diff) |
ocfs2: Implementation of local and global quota file handling
For each quota type each node has local quota file. In this file it stores
changes users have made to disk usage via this node. Once in a while this
information is synced to global file (and thus with other nodes) so that
limits enforcement at least aproximately works.
Global quota files contain all the information about usage and limits. It's
mostly handled by the generic VFS code (which implements a trie of structures
inside a quota file). We only have to provide functions to convert structures
from on-disk format to in-memory one. We also have to provide wrappers for
various quota functions starting transactions and acquiring necessary cluster
locks before the actual IO is really started.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/ocfs2_fs.h')
-rw-r--r-- | fs/ocfs2/ocfs2_fs.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index 06e3bd632ff3..0a5ac790a628 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -883,6 +883,109 @@ static inline int ocfs2_xattr_get_type(struct ocfs2_xattr_entry *xe) | |||
883 | return xe->xe_type & OCFS2_XATTR_TYPE_MASK; | 883 | return xe->xe_type & OCFS2_XATTR_TYPE_MASK; |
884 | } | 884 | } |
885 | 885 | ||
886 | /* | ||
887 | * On disk structures for global quota file | ||
888 | */ | ||
889 | |||
890 | /* Magic numbers and known versions for global quota files */ | ||
891 | #define OCFS2_GLOBAL_QMAGICS {\ | ||
892 | 0x0cf52470, /* USRQUOTA */ \ | ||
893 | 0x0cf52471 /* GRPQUOTA */ \ | ||
894 | } | ||
895 | |||
896 | #define OCFS2_GLOBAL_QVERSIONS {\ | ||
897 | 0, \ | ||
898 | 0, \ | ||
899 | } | ||
900 | |||
901 | |||
902 | /* Each block of each quota file has a certain fixed number of bytes reserved | ||
903 | * for OCFS2 internal use at its end. OCFS2 can use it for things like | ||
904 | * checksums, etc. */ | ||
905 | #define OCFS2_QBLK_RESERVED_SPACE 8 | ||
906 | |||
907 | /* Generic header of all quota files */ | ||
908 | struct ocfs2_disk_dqheader { | ||
909 | __le32 dqh_magic; /* Magic number identifying file */ | ||
910 | __le32 dqh_version; /* Quota format version */ | ||
911 | }; | ||
912 | |||
913 | #define OCFS2_GLOBAL_INFO_OFF (sizeof(struct ocfs2_disk_dqheader)) | ||
914 | |||
915 | /* Information header of global quota file (immediately follows the generic | ||
916 | * header) */ | ||
917 | struct ocfs2_global_disk_dqinfo { | ||
918 | /*00*/ __le32 dqi_bgrace; /* Grace time for space softlimit excess */ | ||
919 | __le32 dqi_igrace; /* Grace time for inode softlimit excess */ | ||
920 | __le32 dqi_syncms; /* Time after which we sync local changes to | ||
921 | * global quota file */ | ||
922 | __le32 dqi_blocks; /* Number of blocks in quota file */ | ||
923 | /*10*/ __le32 dqi_free_blk; /* First free block in quota file */ | ||
924 | __le32 dqi_free_entry; /* First block with free dquot entry in quota | ||
925 | * file */ | ||
926 | }; | ||
927 | |||
928 | /* Structure with global user / group information. We reserve some space | ||
929 | * for future use. */ | ||
930 | struct ocfs2_global_disk_dqblk { | ||
931 | /*00*/ __le32 dqb_id; /* ID the structure belongs to */ | ||
932 | __le32 dqb_use_count; /* Number of nodes having reference to this structure */ | ||
933 | __le64 dqb_ihardlimit; /* absolute limit on allocated inodes */ | ||
934 | /*10*/ __le64 dqb_isoftlimit; /* preferred inode limit */ | ||
935 | __le64 dqb_curinodes; /* current # allocated inodes */ | ||
936 | /*20*/ __le64 dqb_bhardlimit; /* absolute limit on disk space */ | ||
937 | __le64 dqb_bsoftlimit; /* preferred limit on disk space */ | ||
938 | /*30*/ __le64 dqb_curspace; /* current space occupied */ | ||
939 | __le64 dqb_btime; /* time limit for excessive disk use */ | ||
940 | /*40*/ __le64 dqb_itime; /* time limit for excessive inode use */ | ||
941 | __le64 dqb_pad1; | ||
942 | /*50*/ __le64 dqb_pad2; | ||
943 | }; | ||
944 | |||
945 | /* | ||
946 | * On-disk structures for local quota file | ||
947 | */ | ||
948 | |||
949 | /* Magic numbers and known versions for local quota files */ | ||
950 | #define OCFS2_LOCAL_QMAGICS {\ | ||
951 | 0x0cf524c0, /* USRQUOTA */ \ | ||
952 | 0x0cf524c1 /* GRPQUOTA */ \ | ||
953 | } | ||
954 | |||
955 | #define OCFS2_LOCAL_QVERSIONS {\ | ||
956 | 0, \ | ||
957 | 0, \ | ||
958 | } | ||
959 | |||
960 | /* Quota flags in dqinfo header */ | ||
961 | #define OLQF_CLEAN 0x0001 /* Quota file is empty (this should be after\ | ||
962 | * quota has been cleanly turned off) */ | ||
963 | |||
964 | #define OCFS2_LOCAL_INFO_OFF (sizeof(struct ocfs2_disk_dqheader)) | ||
965 | |||
966 | /* Information header of local quota file (immediately follows the generic | ||
967 | * header) */ | ||
968 | struct ocfs2_local_disk_dqinfo { | ||
969 | __le32 dqi_flags; /* Flags for quota file */ | ||
970 | __le32 dqi_chunks; /* Number of chunks of quota structures | ||
971 | * with a bitmap */ | ||
972 | __le32 dqi_blocks; /* Number of blocks allocated for quota file */ | ||
973 | }; | ||
974 | |||
975 | /* Header of one chunk of a quota file */ | ||
976 | struct ocfs2_local_disk_chunk { | ||
977 | __le32 dqc_free; /* Number of free entries in the bitmap */ | ||
978 | u8 dqc_bitmap[0]; /* Bitmap of entries in the corresponding | ||
979 | * chunk of quota file */ | ||
980 | }; | ||
981 | |||
982 | /* One entry in local quota file */ | ||
983 | struct ocfs2_local_disk_dqblk { | ||
984 | /*00*/ __le64 dqb_id; /* id this quota applies to */ | ||
985 | __le64 dqb_spacemod; /* Change in the amount of used space */ | ||
986 | /*10*/ __le64 dqb_inodemod; /* Change in the amount of used inodes */ | ||
987 | }; | ||
988 | |||
886 | #ifdef __KERNEL__ | 989 | #ifdef __KERNEL__ |
887 | static inline int ocfs2_fast_symlink_chars(struct super_block *sb) | 990 | static inline int ocfs2_fast_symlink_chars(struct super_block *sb) |
888 | { | 991 | { |