Lines Matching refs:c

47 	struct jffs2_sb_info *c;  member
51 static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);
53 void jffs2_erase_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) in jffs2_erase_block() argument
61 spin_lock_bh(&c->erase_completion_lock); in jffs2_erase_block()
63 list_add(&jeb->list, &c->erase_pending_list); in jffs2_erase_block()
64 c->erasing_size -= c->sector_size; in jffs2_erase_block()
65 spin_unlock_bh(&c->erase_completion_lock); in jffs2_erase_block()
71 instr->mtd = c->mtd; in jffs2_erase_block()
73 instr->len = c->sector_size; in jffs2_erase_block()
78 ((struct erase_priv_struct *)instr->priv)->c = c; in jffs2_erase_block()
80 ret = c->mtd->erase(c->mtd, instr); in jffs2_erase_block()
87 spin_lock_bh(&c->erase_completion_lock); in jffs2_erase_block()
89 list_add(&jeb->list, &c->erase_pending_list); in jffs2_erase_block()
90 c->erasing_size -= c->sector_size; in jffs2_erase_block()
91 spin_unlock_bh(&c->erase_completion_lock); in jffs2_erase_block()
100 spin_lock_bh(&c->erase_completion_lock); in jffs2_erase_block()
102 list_add(&jeb->list, &c->bad_list); in jffs2_erase_block()
103 c->nr_erasing_blocks--; in jffs2_erase_block()
104 c->bad_size += c->sector_size; in jffs2_erase_block()
105 c->erasing_size -= c->sector_size; in jffs2_erase_block()
106 spin_unlock_bh(&c->erase_completion_lock); in jffs2_erase_block()
107 wake_up(&c->erase_wait); in jffs2_erase_block()
111 void jffs2_erase_pending_blocks(struct jffs2_sb_info *c) in jffs2_erase_pending_blocks() argument
115 spin_lock_bh(&c->erase_completion_lock); in jffs2_erase_pending_blocks()
116 while (!list_empty(&c->erase_pending_list)) { in jffs2_erase_pending_blocks()
118 jeb = list_entry(c->erase_pending_list.next, struct jffs2_eraseblock, list); in jffs2_erase_pending_blocks()
123 c->erasing_size += c->sector_size; in jffs2_erase_pending_blocks()
124 c->free_size -= jeb->free_size; in jffs2_erase_pending_blocks()
125 c->used_size -= jeb->used_size; in jffs2_erase_pending_blocks()
126 c->dirty_size -= jeb->dirty_size; in jffs2_erase_pending_blocks()
128 jffs2_free_all_node_refs(c, jeb); in jffs2_erase_pending_blocks()
129 list_add(&jeb->list, &c->erasing_list); in jffs2_erase_pending_blocks()
130 spin_unlock_bh(&c->erase_completion_lock); in jffs2_erase_pending_blocks()
132 jffs2_erase_block(c, jeb); in jffs2_erase_pending_blocks()
136 spin_lock_bh(&c->erase_completion_lock); in jffs2_erase_pending_blocks()
138 spin_unlock_bh(&c->erase_completion_lock); in jffs2_erase_pending_blocks()
149 spin_lock(&priv->c->erase_completion_lock); in jffs2_erase_callback()
150 priv->c->erasing_size -= priv->c->sector_size; in jffs2_erase_callback()
151 priv->c->bad_size += priv->c->sector_size; in jffs2_erase_callback()
153 list_add(&priv->jeb->list, &priv->c->bad_list); in jffs2_erase_callback()
154 priv->c->nr_erasing_blocks--; in jffs2_erase_callback()
155 spin_unlock(&priv->c->erase_completion_lock); in jffs2_erase_callback()
156 wake_up(&priv->c->erase_wait); in jffs2_erase_callback()
159 spin_lock(&priv->c->erase_completion_lock); in jffs2_erase_callback()
161 list_add_tail(&priv->jeb->list, &priv->c->erase_complete_list); in jffs2_erase_callback()
162 spin_unlock(&priv->c->erase_completion_lock); in jffs2_erase_callback()
165 OFNI_BS_2SFFJ(priv->c)->s_dirt = 1; in jffs2_erase_callback()
171 static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, in jffs2_remove_node_refs_from_ino_list() argument
190 if (((*prev)->flash_offset & ~(c->sector_size -1)) == jeb->offset) { in jffs2_remove_node_refs_from_ino_list()
214 jeb->offset, jeb->offset + c->sector_size, ic->ino)); in jffs2_remove_node_refs_from_ino_list()
236 jffs2_del_ino_cache(c, ic); in jffs2_remove_node_refs_from_ino_list()
241 static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) in jffs2_free_all_node_refs() argument
251 jffs2_remove_node_refs_from_ino_list(c, ref, jeb); in jffs2_free_all_node_refs()
259 void jffs2_erase_pending_trigger(struct jffs2_sb_info *c) in jffs2_erase_pending_trigger() argument
261 OFNI_BS_2SFFJ(c)->s_dirt = 1; in jffs2_erase_pending_trigger()
264 void jffs2_mark_erased_blocks(struct jffs2_sb_info *c) in jffs2_mark_erased_blocks() argument
275 spin_lock_bh(&c->erase_completion_lock); in jffs2_mark_erased_blocks()
276 while (!list_empty(&c->erase_complete_list)) { in jffs2_mark_erased_blocks()
277 jeb = list_entry(c->erase_complete_list.next, struct jffs2_eraseblock, list); in jffs2_mark_erased_blocks()
279 spin_unlock_bh(&c->erase_completion_lock); in jffs2_mark_erased_blocks()
285 jffs2_erase_pending_trigger(c); in jffs2_mark_erased_blocks()
296 while(ofs < jeb->offset + c->sector_size) { in jffs2_mark_erased_blocks()
297 __u32 readlen = min((__u32)PAGE_SIZE, jeb->offset + c->sector_size - ofs); in jffs2_mark_erased_blocks()
300 ret = c->mtd->read(c->mtd, ofs, readlen, &retlen, ebuf); in jffs2_mark_erased_blocks()
318 spin_lock_bh(&c->erase_completion_lock); in jffs2_mark_erased_blocks()
319 c->erasing_size -= c->sector_size; in jffs2_mark_erased_blocks()
320 c->bad_size += c->sector_size; in jffs2_mark_erased_blocks()
322 list_add_tail(&jeb->list, &c->bad_list); in jffs2_mark_erased_blocks()
323 c->nr_erasing_blocks--; in jffs2_mark_erased_blocks()
324 spin_unlock_bh(&c->erase_completion_lock); in jffs2_mark_erased_blocks()
325 wake_up(&c->erase_wait); in jffs2_mark_erased_blocks()
336 ret = c->mtd->write(c->mtd, jeb->offset, sizeof(marker), &retlen, (char *)&marker); in jffs2_mark_erased_blocks()
355 jeb->free_size = c->sector_size - marker_ref->totlen; in jffs2_mark_erased_blocks()
359 spin_lock_bh(&c->erase_completion_lock); in jffs2_mark_erased_blocks()
360 c->erasing_size -= c->sector_size; in jffs2_mark_erased_blocks()
361 c->free_size += jeb->free_size; in jffs2_mark_erased_blocks()
362 c->used_size += jeb->used_size; in jffs2_mark_erased_blocks()
364 ACCT_SANITY_CHECK(c,jeb); in jffs2_mark_erased_blocks()
367 list_add_tail(&jeb->list, &c->free_list); in jffs2_mark_erased_blocks()
368 c->nr_erasing_blocks--; in jffs2_mark_erased_blocks()
369 c->nr_free_blocks++; in jffs2_mark_erased_blocks()
370 wake_up(&c->erase_wait); in jffs2_mark_erased_blocks()
372 spin_unlock_bh(&c->erase_completion_lock); in jffs2_mark_erased_blocks()