aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/erase.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/erase.c')
-rw-r--r--fs/jffs2/erase.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index 347de4efeeeb..dad68fdffe9e 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -24,7 +24,7 @@ struct erase_priv_struct {
24 struct jffs2_eraseblock *jeb; 24 struct jffs2_eraseblock *jeb;
25 struct jffs2_sb_info *c; 25 struct jffs2_sb_info *c;
26}; 26};
27 27
28#ifndef __ECOS 28#ifndef __ECOS
29static void jffs2_erase_callback(struct erase_info *); 29static void jffs2_erase_callback(struct erase_info *);
30#endif 30#endif
@@ -71,7 +71,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
71 instr->callback = jffs2_erase_callback; 71 instr->callback = jffs2_erase_callback;
72 instr->priv = (unsigned long)(&instr[1]); 72 instr->priv = (unsigned long)(&instr[1]);
73 instr->fail_addr = 0xffffffff; 73 instr->fail_addr = 0xffffffff;
74 74
75 ((struct erase_priv_struct *)instr->priv)->jeb = jeb; 75 ((struct erase_priv_struct *)instr->priv)->jeb = jeb;
76 ((struct erase_priv_struct *)instr->priv)->c = c; 76 ((struct erase_priv_struct *)instr->priv)->c = c;
77 77
@@ -96,7 +96,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
96 return; 96 return;
97 } 97 }
98 98
99 if (ret == -EROFS) 99 if (ret == -EROFS)
100 printk(KERN_WARNING "Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset); 100 printk(KERN_WARNING "Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset);
101 else 101 else
102 printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret); 102 printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret);
@@ -197,7 +197,7 @@ static void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock
197 c->nr_erasing_blocks--; 197 c->nr_erasing_blocks--;
198 spin_unlock(&c->erase_completion_lock); 198 spin_unlock(&c->erase_completion_lock);
199 wake_up(&c->erase_wait); 199 wake_up(&c->erase_wait);
200} 200}
201 201
202#ifndef __ECOS 202#ifndef __ECOS
203static void jffs2_erase_callback(struct erase_info *instr) 203static void jffs2_erase_callback(struct erase_info *instr)
@@ -209,7 +209,7 @@ static void jffs2_erase_callback(struct erase_info *instr)
209 jffs2_erase_failed(priv->c, priv->jeb, instr->fail_addr); 209 jffs2_erase_failed(priv->c, priv->jeb, instr->fail_addr);
210 } else { 210 } else {
211 jffs2_erase_succeeded(priv->c, priv->jeb); 211 jffs2_erase_succeeded(priv->c, priv->jeb);
212 } 212 }
213 kfree(instr); 213 kfree(instr);
214} 214}
215#endif /* !__ECOS */ 215#endif /* !__ECOS */
@@ -227,13 +227,13 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
227 /* Walk the inode's list once, removing any nodes from this eraseblock */ 227 /* Walk the inode's list once, removing any nodes from this eraseblock */
228 while (1) { 228 while (1) {
229 if (!(*prev)->next_in_ino) { 229 if (!(*prev)->next_in_ino) {
230 /* We're looking at the jffs2_inode_cache, which is 230 /* We're looking at the jffs2_inode_cache, which is
231 at the end of the linked list. Stash it and continue 231 at the end of the linked list. Stash it and continue
232 from the beginning of the list */ 232 from the beginning of the list */
233 ic = (struct jffs2_inode_cache *)(*prev); 233 ic = (struct jffs2_inode_cache *)(*prev);
234 prev = &ic->nodes; 234 prev = &ic->nodes;
235 continue; 235 continue;
236 } 236 }
237 237
238 if (SECTOR_ADDR((*prev)->flash_offset) == jeb->offset) { 238 if (SECTOR_ADDR((*prev)->flash_offset) == jeb->offset) {
239 /* It's in the block we're erasing */ 239 /* It's in the block we're erasing */
@@ -267,7 +267,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
267 printk(KERN_DEBUG "After remove_node_refs_from_ino_list: \n" KERN_DEBUG); 267 printk(KERN_DEBUG "After remove_node_refs_from_ino_list: \n" KERN_DEBUG);
268 268
269 this = ic->nodes; 269 this = ic->nodes;
270 270
271 while(this) { 271 while(this) {
272 printk( "0x%08x(%d)->", ref_offset(this), ref_flags(this)); 272 printk( "0x%08x(%d)->", ref_offset(this), ref_flags(this));
273 if (++i == 5) { 273 if (++i == 5) {
@@ -290,7 +290,7 @@ static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_erase
290 while(jeb->first_node) { 290 while(jeb->first_node) {
291 ref = jeb->first_node; 291 ref = jeb->first_node;
292 jeb->first_node = ref->next_phys; 292 jeb->first_node = ref->next_phys;
293 293
294 /* Remove from the inode-list */ 294 /* Remove from the inode-list */
295 if (ref->next_in_ino) 295 if (ref->next_in_ino)
296 jffs2_remove_node_refs_from_ino_list(c, ref, jeb); 296 jffs2_remove_node_refs_from_ino_list(c, ref, jeb);
@@ -307,7 +307,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
307 uint32_t ofs; 307 uint32_t ofs;
308 size_t retlen; 308 size_t retlen;
309 int ret = -EIO; 309 int ret = -EIO;
310 310
311 ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL); 311 ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
312 if (!ebuf) { 312 if (!ebuf) {
313 printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Refiling\n", jeb->offset); 313 printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Refiling\n", jeb->offset);
@@ -361,7 +361,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
361 case -EIO: goto filebad; 361 case -EIO: goto filebad;
362 } 362 }
363 363
364 /* Write the erase complete marker */ 364 /* Write the erase complete marker */
365 D1(printk(KERN_DEBUG "Writing erased marker to block at 0x%08x\n", jeb->offset)); 365 D1(printk(KERN_DEBUG "Writing erased marker to block at 0x%08x\n", jeb->offset));
366 bad_offset = jeb->offset; 366 bad_offset = jeb->offset;
367 367
@@ -399,7 +399,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
399 vecs[0].iov_base = (unsigned char *) ▮ 399 vecs[0].iov_base = (unsigned char *) ▮
400 vecs[0].iov_len = sizeof(marker); 400 vecs[0].iov_len = sizeof(marker);
401 ret = jffs2_flash_direct_writev(c, vecs, 1, jeb->offset, &retlen); 401 ret = jffs2_flash_direct_writev(c, vecs, 1, jeb->offset, &retlen);
402 402
403 if (ret || retlen != sizeof(marker)) { 403 if (ret || retlen != sizeof(marker)) {
404 if (ret) 404 if (ret)
405 printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n", 405 printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n",
@@ -416,9 +416,9 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
416 marker_ref->next_phys = NULL; 416 marker_ref->next_phys = NULL;
417 marker_ref->flash_offset = jeb->offset | REF_NORMAL; 417 marker_ref->flash_offset = jeb->offset | REF_NORMAL;
418 marker_ref->__totlen = c->cleanmarker_size; 418 marker_ref->__totlen = c->cleanmarker_size;
419 419
420 jeb->first_node = jeb->last_node = marker_ref; 420 jeb->first_node = jeb->last_node = marker_ref;
421 421
422 jeb->free_size = c->sector_size - c->cleanmarker_size; 422 jeb->free_size = c->sector_size - c->cleanmarker_size;
423 jeb->used_size = c->cleanmarker_size; 423 jeb->used_size = c->cleanmarker_size;
424 jeb->dirty_size = 0; 424 jeb->dirty_size = 0;