0001
0002
0003
0004
0005
0006 #ifndef _LINUX_DQBLK_QTREE_H
0007 #define _LINUX_DQBLK_QTREE_H
0008
0009 #include <linux/types.h>
0010
0011
0012
0013 #define QTREE_INIT_ALLOC 4
0014 #define QTREE_INIT_REWRITE 2
0015 #define QTREE_DEL_ALLOC 0
0016 #define QTREE_DEL_REWRITE 6
0017
0018 struct dquot;
0019 struct kqid;
0020
0021
0022 struct qtree_fmt_operations {
0023 void (*mem2disk_dqblk)(void *disk, struct dquot *dquot);
0024 void (*disk2mem_dqblk)(struct dquot *dquot, void *disk);
0025 int (*is_id)(void *disk, struct dquot *dquot);
0026 };
0027
0028
0029 struct qtree_mem_dqinfo {
0030 struct super_block *dqi_sb;
0031 int dqi_type;
0032 unsigned int dqi_blocks;
0033 unsigned int dqi_free_blk;
0034 unsigned int dqi_free_entry;
0035 unsigned int dqi_blocksize_bits;
0036 unsigned int dqi_entry_size;
0037 unsigned int dqi_usable_bs;
0038 unsigned int dqi_qtree_depth;
0039 const struct qtree_fmt_operations *dqi_ops;
0040 };
0041
0042 int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
0043 int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
0044 int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
0045 int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
0046 int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk);
0047 static inline int qtree_depth(struct qtree_mem_dqinfo *info)
0048 {
0049 unsigned int epb = info->dqi_usable_bs >> 2;
0050 unsigned long long entries = epb;
0051 int i;
0052
0053 for (i = 1; entries < (1ULL << 32); i++)
0054 entries *= epb;
0055 return i;
0056 }
0057 int qtree_get_next_id(struct qtree_mem_dqinfo *info, struct kqid *qid);
0058
0059 #endif