v2.4.9.9 -> v2.4.9.10
[opensuse:kernel.git] / include / linux / jffs2_fs_sb.h
1 /* $Id: jffs2_fs_sb.h,v 1.15 2001/04/18 13:05:28 dwmw2 Exp $ */
2
3 #ifndef _JFFS2_FS_SB
4 #define _JFFS2_FS_SB
5
6 #include <linux/types.h>
7 #include <linux/spinlock.h>
8 #include <linux/completion.h>
9 #include <asm/semaphore.h>
10 #include <linux/list.h>
11
12 #define INOCACHE_HASHSIZE 1
13
14 #define JFFS2_SB_FLAG_RO 1
15
16 /* A struct for the overall file system control.  Pointers to
17    jffs2_sb_info structs are named `c' in the source code.  
18    Nee jffs_control
19 */
20 struct jffs2_sb_info {
21         struct mtd_info *mtd;
22
23         __u32 highest_ino;
24         unsigned int flags;
25         spinlock_t nodelist_lock;
26
27         //      pid_t thread_pid;               /* GC thread's PID */
28         struct task_struct *gc_task;    /* GC task struct */
29         struct semaphore gc_thread_sem; /* GC thread startup mutex */
30         struct completion gc_thread_exit; /* GC thread exit completion */
31
32         //      __u32 gc_minfree_threshold;     /* GC trigger thresholds */
33         //      __u32 gc_maxdirty_threshold;
34
35         struct semaphore alloc_sem;     /* Used to protect all the following 
36                                            fields, and also to protect against
37                                            out-of-order writing of nodes.
38                                            And GC.
39                                         */
40         __u32 flash_size;
41         __u32 used_size;
42         __u32 dirty_size;
43         __u32 free_size;
44         __u32 erasing_size;
45         __u32 bad_size;
46         __u32 sector_size;
47         //      __u32 min_free_size;
48         //      __u32 max_chunk_size;
49
50         __u32 nr_free_blocks;
51         __u32 nr_erasing_blocks;
52
53         __u32 nr_blocks;
54         struct jffs2_eraseblock *blocks;        /* The whole array of blocks. Used for getting blocks 
55                                                  * from the offset (blocks[ofs / sector_size]) */
56         struct jffs2_eraseblock *nextblock;     /* The block we're currently filling */
57
58         struct jffs2_eraseblock *gcblock;       /* The block we're currently garbage-collecting */
59
60         struct list_head clean_list;            /* Blocks 100% full of clean data */
61         struct list_head dirty_list;            /* Blocks with some dirty space */
62         struct list_head erasing_list;          /* Blocks which are currently erasing */
63         struct list_head erase_pending_list;    /* Blocks which need erasing */
64         struct list_head erase_complete_list;   /* Blocks which are erased and need the clean marker written to them */
65         struct list_head free_list;             /* Blocks which are free and ready to be used */
66         struct list_head bad_list;              /* Bad blocks. */
67         struct list_head bad_used_list;         /* Bad blocks with valid data in. */
68
69         spinlock_t erase_completion_lock;       /* Protect free_list and erasing_list 
70                                                    against erase completion handler */
71         wait_queue_head_t erase_wait;           /* For waiting for erases to complete */
72         struct jffs2_inode_cache *inocache_list[INOCACHE_HASHSIZE];
73         spinlock_t inocache_lock;
74 };
75
76 #ifdef JFFS2_OUT_OF_KERNEL
77 #define JFFS2_SB_INFO(sb) ((struct jffs2_sb_info *) &(sb)->u)
78 #else
79 #define JFFS2_SB_INFO(sb) (&sb->u.jffs2_sb)
80 #endif
81
82 #define OFNI_BS_2SFFJ(c)  ((struct super_block *) ( ((char *)c) - ((char *)(&((struct super_block *)NULL)->u)) ) )
83
84 #endif /* _JFFS2_FB_SB */