0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _OCFS2_QUOTA_H
0011 #define _OCFS2_QUOTA_H
0012
0013 #include <linux/types.h>
0014 #include <linux/slab.h>
0015 #include <linux/quota.h>
0016 #include <linux/list.h>
0017 #include <linux/dqblk_qtree.h>
0018
0019 #include "ocfs2.h"
0020
0021
0022 #define OCFS2_MAXQUOTAS 2
0023
0024
0025
0026
0027 struct ocfs2_dquot {
0028 struct dquot dq_dquot;
0029 loff_t dq_local_off;
0030 u64 dq_local_phys_blk;
0031 struct ocfs2_quota_chunk *dq_chunk;
0032 unsigned int dq_use_count;
0033 s64 dq_origspace;
0034 s64 dq_originodes;
0035 struct llist_node list;
0036 };
0037
0038
0039 struct ocfs2_recovery_chunk {
0040 struct list_head rc_list;
0041 int rc_chunk;
0042 unsigned long *rc_bitmap;
0043 };
0044
0045 struct ocfs2_quota_recovery {
0046 struct list_head r_list[OCFS2_MAXQUOTAS];
0047 };
0048
0049
0050 struct ocfs2_mem_dqinfo {
0051 unsigned int dqi_type;
0052 unsigned int dqi_flags;
0053 unsigned int dqi_chunks;
0054 unsigned int dqi_blocks;
0055 unsigned int dqi_syncms;
0056 struct list_head dqi_chunk;
0057 struct inode *dqi_gqinode;
0058 struct ocfs2_lock_res dqi_gqlock;
0059 struct buffer_head *dqi_gqi_bh;
0060 int dqi_gqi_count;
0061 u64 dqi_giblk;
0062 struct buffer_head *dqi_lqi_bh;
0063 struct buffer_head *dqi_libh;
0064 struct qtree_mem_dqinfo dqi_gi;
0065 struct delayed_work dqi_sync_work;
0066 struct ocfs2_quota_recovery *dqi_rec;
0067
0068
0069
0070 };
0071
0072 static inline struct ocfs2_dquot *OCFS2_DQUOT(struct dquot *dquot)
0073 {
0074 return container_of(dquot, struct ocfs2_dquot, dq_dquot);
0075 }
0076
0077 struct ocfs2_quota_chunk {
0078 struct list_head qc_chunk;
0079 int qc_num;
0080 struct buffer_head *qc_headerbh;
0081 };
0082
0083 extern struct kmem_cache *ocfs2_dquot_cachep;
0084 extern struct kmem_cache *ocfs2_qf_chunk_cachep;
0085
0086 extern const struct qtree_fmt_operations ocfs2_global_ops;
0087
0088 struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
0089 struct ocfs2_super *osb, int slot_num);
0090 int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
0091 struct ocfs2_quota_recovery *rec,
0092 int slot_num);
0093 void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec);
0094 ssize_t ocfs2_quota_read(struct super_block *sb, int type, char *data,
0095 size_t len, loff_t off);
0096 ssize_t ocfs2_quota_write(struct super_block *sb, int type,
0097 const char *data, size_t len, loff_t off);
0098 int ocfs2_global_read_info(struct super_block *sb, int type);
0099 int ocfs2_global_write_info(struct super_block *sb, int type);
0100 int ocfs2_global_read_dquot(struct dquot *dquot);
0101 int __ocfs2_sync_dquot(struct dquot *dquot, int freeing);
0102 static inline int ocfs2_sync_dquot(struct dquot *dquot)
0103 {
0104 return __ocfs2_sync_dquot(dquot, 0);
0105 }
0106 static inline int ocfs2_global_release_dquot(struct dquot *dquot)
0107 {
0108 return __ocfs2_sync_dquot(dquot, 1);
0109 }
0110
0111 int ocfs2_lock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex);
0112 void ocfs2_unlock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex);
0113 int ocfs2_validate_quota_block(struct super_block *sb, struct buffer_head *bh);
0114 int ocfs2_read_quota_phys_block(struct inode *inode, u64 p_block,
0115 struct buffer_head **bh);
0116 int ocfs2_create_local_dquot(struct dquot *dquot);
0117 int ocfs2_local_release_dquot(handle_t *handle, struct dquot *dquot);
0118 int ocfs2_local_write_dquot(struct dquot *dquot);
0119 void ocfs2_drop_dquot_refs(struct work_struct *work);
0120
0121 extern const struct dquot_operations ocfs2_quota_operations;
0122 extern struct quota_format_type ocfs2_quota_format;
0123
0124 #endif