source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/jffs2_fs_sb.h

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 3.9 KB
Line 
1
2#ifndef _JFFS2_FS_SB
3#define _JFFS2_FS_SB
4
5#include <linux/types.h>
6#include <linux/workqueue.h>
7#include <asm/semaphore.h>
8#include <linux/wait.h>
9
10#define JFFS2_SB_FLAG_RO 1
11#define JFFS2_SB_FLAG_MOUNTING 2
12
13struct jffs2_inodirty;
14
15/* A struct for the overall file system control.  Pointers to
16   jffs2_sb_info structs are named `c' in the source code. 
17   Nee jffs_control
18*/
19struct jffs2_sb_info {
20        struct mtd_info *mtd;
21
22        uint32_t highest_ino;
23        uint32_t checked_ino;
24
25        unsigned int flags;
26
27        struct task_struct *gc_task;    /* GC task struct */
28        struct semaphore gc_thread_start; /* GC thread start mutex */
29        struct completion gc_thread_exit; /* GC thread exit completion port */
30
31        struct semaphore alloc_sem;     /* Used to protect all the following
32                                           fields, and also to protect against
33                                           out-of-order writing of nodes. And GC. */
34        uint32_t cleanmarker_size;      /* Size of an _inline_ CLEANMARKER
35                                         (i.e. zero for OOB CLEANMARKER */
36
37        uint32_t flash_size;
38        uint32_t used_size;
39        uint32_t dirty_size;
40        uint32_t wasted_size;
41        uint32_t free_size;
42        uint32_t erasing_size;
43        uint32_t bad_size;
44        uint32_t sector_size;
45        uint32_t unchecked_size;
46
47        uint32_t nr_free_blocks;
48        uint32_t nr_erasing_blocks;
49
50        /* Number of free blocks there must be before we... */
51        uint8_t resv_blocks_write;      /* ... allow a normal filesystem write */
52        uint8_t resv_blocks_deletion;   /* ... allow a normal filesystem deletion */
53        uint8_t resv_blocks_gctrigger;  /* ... wake up the GC thread */
54        uint8_t resv_blocks_gcbad;      /* ... pick a block from the bad_list to GC */
55        uint8_t resv_blocks_gcmerge;    /* ... merge pages when garbage collecting */
56
57        uint32_t nospc_dirty_size;
58
59        uint32_t nr_blocks;
60        struct jffs2_eraseblock *blocks;        /* The whole array of blocks. Used for getting blocks
61                                                 * from the offset (blocks[ofs / sector_size]) */
62        struct jffs2_eraseblock *nextblock;     /* The block we're currently filling */
63
64        struct jffs2_eraseblock *gcblock;       /* The block we're currently garbage-collecting */
65
66        struct list_head clean_list;            /* Blocks 100% full of clean data */
67        struct list_head very_dirty_list;       /* Blocks with lots of dirty space */
68        struct list_head dirty_list;            /* Blocks with some dirty space */
69        struct list_head erasable_list;         /* Blocks which are completely dirty, and need erasing */
70        struct list_head erasable_pending_wbuf_list;    /* Blocks which need erasing but only after the current wbuf is flushed */
71        struct list_head erasing_list;          /* Blocks which are currently erasing */
72        struct list_head erase_pending_list;    /* Blocks which need erasing now */
73        struct list_head erase_complete_list;   /* Blocks which are erased and need the clean marker written to them */
74        struct list_head free_list;             /* Blocks which are free and ready to be used */
75        struct list_head bad_list;              /* Bad blocks. */
76        struct list_head bad_used_list;         /* Bad blocks with valid data in. */
77
78        spinlock_t erase_completion_lock;       /* Protect free_list and erasing_list
79                                                   against erase completion handler */
80        wait_queue_head_t erase_wait;           /* For waiting for erases to complete */
81
82        wait_queue_head_t inocache_wq;
83        struct jffs2_inode_cache **inocache_list;
84        spinlock_t inocache_lock;
85       
86        /* Sem to allow jffs2_garbage_collect_deletion_dirent to
87           drop the erase_completion_lock while it's holding a pointer
88           to an obsoleted node. I don't like this. Alternatives welcomed. */
89        struct semaphore erase_free_sem;
90
91#if defined CONFIG_JFFS2_FS_NAND || defined CONFIG_JFFS2_FS_NOR_ECC
92        /* Write-behind buffer for NAND flash */
93        unsigned char *wbuf;
94        uint32_t wbuf_ofs;
95        uint32_t wbuf_len;
96        uint32_t wbuf_pagesize;
97        struct jffs2_inodirty *wbuf_inodes;
98
99        struct rw_semaphore wbuf_sem;   /* Protects the write buffer */
100
101        /* Information about out-of-band area usage... */
102        struct nand_oobinfo *oobinfo;
103        uint32_t badblock_pos;
104        uint32_t fsdata_pos;
105        uint32_t fsdata_len;
106#endif
107
108        /* OS-private pointer for getting back to master superblock info */
109        void *os_priv;
110};
111
112#endif /* _JFFS2_FB_SB */
Note: See TracBrowser for help on using the repository browser.