ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / affs_fs_i.h
1 #ifndef _AFFS_FS_I
2 #define _AFFS_FS_I
3
4 #include <linux/a.out.h>
5 #include <linux/fs.h>
6 #include <asm/semaphore.h>
7
8 #define AFFS_CACHE_SIZE         PAGE_SIZE
9 //#define AFFS_CACHE_SIZE               (4*4)
10
11 #define AFFS_MAX_PREALLOC       32
12 #define AFFS_LC_SIZE            (AFFS_CACHE_SIZE/sizeof(u32)/2)
13 #define AFFS_AC_SIZE            (AFFS_CACHE_SIZE/sizeof(struct affs_ext_key)/2)
14 #define AFFS_AC_MASK            (AFFS_AC_SIZE-1)
15
16 struct affs_ext_key {
17         u32     ext;                            /* idx of the extended block */
18         u32     key;                            /* block number */
19 };
20
21 /*
22  * affs fs inode data in memory
23  */
24 struct affs_inode_info {
25         u32      i_opencnt;
26         struct semaphore i_link_lock;           /* Protects internal inode access. */
27         struct semaphore i_ext_lock;            /* Protects internal inode access. */
28 #define i_hash_lock i_ext_lock
29         u32      i_blkcnt;                      /* block count */
30         u32      i_extcnt;                      /* extended block count */
31         u32     *i_lc;                          /* linear cache of extended blocks */
32         u32      i_lc_size;
33         u32      i_lc_shift;
34         u32      i_lc_mask;
35         struct affs_ext_key *i_ac;              /* associative cache of extended blocks */
36         u32      i_ext_last;                    /* last accessed extended block */
37         struct buffer_head *i_ext_bh;           /* bh of last extended block */
38         loff_t   mmu_private;
39         u32      i_protect;                     /* unused attribute bits */
40         u32      i_lastalloc;                   /* last allocated block */
41         int      i_pa_cnt;                      /* number of preallocated blocks */
42 #if 0
43         s32      i_original;                    /* if != 0, this is the key of the original */
44         u32      i_data[AFFS_MAX_PREALLOC];     /* preallocated blocks */
45         int      i_cache_users;                 /* Cache cannot be freed while > 0 */
46         unsigned char i_hlink;                  /* This is a fake */
47         unsigned char i_pad;
48         s32      i_parent;                      /* parent ino */
49 #endif
50         struct inode vfs_inode;
51 };
52
53 /* short cut to get to the affs specific inode data */
54 static inline struct affs_inode_info *AFFS_I(struct inode *inode)
55 {
56         return list_entry(inode, struct affs_inode_info, vfs_inode);
57 }
58
59 #endif