RTEMS 6.1-rc2
Loading...
Searching...
No Matches
jffs2_fs_sb.h
2
3/*
4 * JFFS2 -- Journalling Flash File System, Version 2.
5 *
6 * Copyright © 2001-2007 Red Hat, Inc.
7 * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
8 *
9 * Created by David Woodhouse <dwmw2@infradead.org>
10 *
11 * For licensing information, see the file 'LICENCE' in this directory.
12 *
13 */
14
15#ifndef _JFFS2_FS_SB
16#define _JFFS2_FS_SB
17
18#include <linux/types.h>
19#include <linux/spinlock.h>
20#include <linux/workqueue.h>
21#include <linux/completion.h>
22#include <linux/mutex.h>
23#include <linux/timer.h>
24#include <linux/wait.h>
25#include <linux/list.h>
26#include <linux/rwsem.h>
27
28#define JFFS2_SB_FLAG_RO 1
29#define JFFS2_SB_FLAG_SCANNING 2 /* Flash scanning is in progress */
30#define JFFS2_SB_FLAG_BUILDING 4 /* File system building is in progress */
31
32struct jffs2_inodirty;
33
35 bool override_compr;
36 unsigned int compr;
37
38 /* The size of the reserved pool. The reserved pool is the JFFS2 flash
39 * space which may only be used by root cannot be used by the other
40 * users. This is implemented simply by means of not allowing the
41 * latter users to write to the file system if the amount if the
42 * available space is less then 'rp_size'. */
43 bool set_rp_size;
44 unsigned int rp_size;
45};
46
47/* A struct for the overall file system control. Pointers to
48 jffs2_sb_info structs are named `c' in the source code.
49 Nee jffs_control
50*/
52 struct mtd_info *mtd;
53
54 uint32_t highest_ino;
55 uint32_t check_ino; /* *NEXT* inode to be checked */
56
57 unsigned int flags;
58
59 struct task_struct *gc_task; /* GC task struct */
60 struct completion gc_thread_start; /* GC thread start completion */
61 struct completion gc_thread_exit; /* GC thread exit completion port */
62
63 struct mutex alloc_sem; /* Used to protect all the following
64 fields, and also to protect against
65 out-of-order writing of nodes. And GC. */
66 uint32_t cleanmarker_size; /* Size of an _inline_ CLEANMARKER
67 (i.e. zero for OOB CLEANMARKER */
68
69 uint32_t flash_size;
70 uint32_t used_size;
71 uint32_t dirty_size;
72 uint32_t wasted_size;
73 uint32_t free_size;
74 uint32_t erasing_size;
75 uint32_t bad_size;
76 uint32_t sector_size;
77 uint32_t unchecked_size;
78
79 uint32_t nr_free_blocks;
80 uint32_t nr_erasing_blocks;
81
82 /* Number of free blocks there must be before we... */
83 uint8_t resv_blocks_write; /* ... allow a normal filesystem write */
84 uint8_t resv_blocks_deletion; /* ... allow a normal filesystem deletion */
85 uint8_t resv_blocks_gctrigger; /* ... wake up the GC thread */
86 uint8_t resv_blocks_gcbad; /* ... pick a block from the bad_list to GC */
87 uint8_t resv_blocks_gcmerge; /* ... merge pages when garbage collecting */
88 /* Number of 'very dirty' blocks before we trigger immediate GC */
89 uint8_t vdirty_blocks_gctrigger;
90
91 uint32_t nospc_dirty_size;
92
93 uint32_t nr_blocks;
94 struct jffs2_eraseblock *blocks; /* The whole array of blocks. Used for getting blocks
95 * from the offset (blocks[ofs / sector_size]) */
96 struct jffs2_eraseblock *nextblock; /* The block we're currently filling */
97
98 struct jffs2_eraseblock *gcblock; /* The block we're currently garbage-collecting */
99
100 struct list_head clean_list; /* Blocks 100% full of clean data */
101 struct list_head very_dirty_list; /* Blocks with lots of dirty space */
102 struct list_head dirty_list; /* Blocks with some dirty space */
103 struct list_head erasable_list; /* Blocks which are completely dirty, and need erasing */
104 struct list_head erasable_pending_wbuf_list; /* Blocks which need erasing but only after the current wbuf is flushed */
105 struct list_head erasing_list; /* Blocks which are currently erasing */
106 struct list_head erase_checking_list; /* Blocks which are being checked and marked */
107 struct list_head erase_pending_list; /* Blocks which need erasing now */
108 struct list_head erase_complete_list; /* Blocks which are erased and need the clean marker written to them */
109 struct list_head free_list; /* Blocks which are free and ready to be used */
110 struct list_head bad_list; /* Bad blocks. */
111 struct list_head bad_used_list; /* Bad blocks with valid data in. */
112
113 spinlock_t erase_completion_lock; /* Protect free_list and erasing_list
114 against erase completion handler */
115 wait_queue_head_t erase_wait; /* For waiting for erases to complete */
116
117 wait_queue_head_t inocache_wq;
118 int inocache_hashsize;
119 struct jffs2_inode_cache **inocache_list;
120 spinlock_t inocache_lock;
121
122 /* Sem to allow jffs2_garbage_collect_deletion_dirent to
123 drop the erase_completion_lock while it's holding a pointer
124 to an obsoleted node. I don't like this. Alternatives welcomed. */
125 struct mutex erase_free_sem;
126
127 uint32_t wbuf_pagesize; /* 0 for NOR and other flashes with no wbuf */
128
129#ifdef CONFIG_JFFS2_FS_WBUF_VERIFY
130 unsigned char *wbuf_verify; /* read-back buffer for verification */
131#endif
132#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
133 unsigned char *wbuf; /* Write-behind buffer for NAND flash */
134 uint32_t wbuf_ofs;
135 uint32_t wbuf_len;
136 struct jffs2_inodirty *wbuf_inodes;
137 struct rw_semaphore wbuf_sem; /* Protects the write buffer */
138
139 struct delayed_work wbuf_dwork; /* write-buffer write-out work */
140
141 unsigned char *oobbuf;
142 int oobavail; /* How many bytes are available for JFFS2 in OOB */
143#endif
144
145 struct jffs2_summary *summary; /* Summary information */
146 struct jffs2_mount_opts mount_opts;
147
148#ifdef CONFIG_JFFS2_FS_XATTR
149#define XATTRINDEX_HASHSIZE (57)
150 uint32_t highest_xid;
151 uint32_t highest_xseqno;
152 struct list_head xattrindex[XATTRINDEX_HASHSIZE];
153 struct list_head xattr_unchecked;
154 struct list_head xattr_dead_list;
155 struct jffs2_xattr_ref *xref_dead_list;
156 struct jffs2_xattr_ref *xref_temp;
157 struct rw_semaphore xattr_sem;
158 uint32_t xdatum_mem_usage;
159 uint32_t xdatum_mem_threshold;
160#endif
161 /* OS-private pointer for getting back to master superblock info */
162 void *os_priv;
163};
164
165#endif /* _JFFS2_FS_SB */
Definition: completion.h:4
Definition: workqueue.h:21
Definition: intercom.c:71
Definition: nodelist.h:278
Definition: nodelist.h:158
Definition: wbuf.c:43
Definition: jffs2_fs_sb.h:34
Definition: jffs2_fs_sb.h:51
Definition: summary.h:152
Definition: xattr.h:46
Definition: list.h:57
Definition: mtd.h:9
Definition: mutex.h:4
Definition: rwsem.h:4
Definition: spinlock.h:5
Definition: wait.h:5