async: make sure independent async domains can't accidentally entangle
[linux-2.6/mini2440.git] / include / linux / dqblk_qtree.h
blob82a16527b367a26c1fbcf199da8a418540ee1847
1 /*
2 * Definitions of structures and functions for quota formats using trie
3 */
5 #ifndef _LINUX_DQBLK_QTREE_H
6 #define _LINUX_DQBLK_QTREE_H
8 #include <linux/types.h>
10 /* Numbers of blocks needed for updates - we count with the smallest
11 * possible block size (1024) */
12 #define QTREE_INIT_ALLOC 4
13 #define QTREE_INIT_REWRITE 2
14 #define QTREE_DEL_ALLOC 0
15 #define QTREE_DEL_REWRITE 6
17 struct dquot;
19 /* Operations */
20 struct qtree_fmt_operations {
21 void (*mem2disk_dqblk)(void *disk, struct dquot *dquot); /* Convert given entry from in memory format to disk one */
22 void (*disk2mem_dqblk)(struct dquot *dquot, void *disk); /* Convert given entry from disk format to in memory one */
23 int (*is_id)(void *disk, struct dquot *dquot); /* Is this structure for given id? */
26 /* Inmemory copy of version specific information */
27 struct qtree_mem_dqinfo {
28 struct super_block *dqi_sb; /* Sb quota is on */
29 int dqi_type; /* Quota type */
30 unsigned int dqi_blocks; /* # of blocks in quota file */
31 unsigned int dqi_free_blk; /* First block in list of free blocks */
32 unsigned int dqi_free_entry; /* First block with free entry */
33 unsigned int dqi_blocksize_bits; /* Block size of quota file */
34 unsigned int dqi_entry_size; /* Size of quota entry in quota file */
35 unsigned int dqi_usable_bs; /* Space usable in block for quota data */
36 unsigned int dqi_qtree_depth; /* Precomputed depth of quota tree */
37 struct qtree_fmt_operations *dqi_ops; /* Operations for entry manipulation */
40 int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
41 int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
42 int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
43 int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
44 int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk);
45 static inline int qtree_depth(struct qtree_mem_dqinfo *info)
47 unsigned int epb = info->dqi_usable_bs >> 2;
48 unsigned long long entries = epb;
49 int i;
51 for (i = 1; entries < (1ULL << 32); i++)
52 entries *= epb;
53 return i;
56 #endif /* _LINUX_DQBLK_QTREE_H */