aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/nodemgmt.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2005-11-07 06:16:07 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-07 08:18:56 -0500
commit182ec4eee397543101a6db8906ed88727d3f7e53 (patch)
tree0f6dd2c52697123702bdf0c3a7143537f947b060 /fs/jffs2/nodemgmt.c
parent97894cda5773e59bd13e87b72077751099419a9f (diff)
[JFFS2] Clean up trailing white spaces
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/nodemgmt.c')
-rw-r--r--fs/jffs2/nodemgmt.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index 2c938d1bffb0..49127a1f0458 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -88,12 +88,12 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs
88 up(&c->alloc_sem); 88 up(&c->alloc_sem);
89 return -ENOSPC; 89 return -ENOSPC;
90 } 90 }
91 91
92 /* Calc possibly available space. Possibly available means that we 92 /* Calc possibly available space. Possibly available means that we
93 * don't know, if unchecked size contains obsoleted nodes, which could give us some 93 * don't know, if unchecked size contains obsoleted nodes, which could give us some
94 * more usable space. This will affect the sum only once, as gc first finishes checking 94 * more usable space. This will affect the sum only once, as gc first finishes checking
95 * of nodes. 95 * of nodes.
96 + Return -ENOSPC, if the maximum possibly available space is less or equal than 96 + Return -ENOSPC, if the maximum possibly available space is less or equal than
97 * blocksneeded * sector_size. 97 * blocksneeded * sector_size.
98 * This blocks endless gc looping on a filesystem, which is nearly full, even if 98 * This blocks endless gc looping on a filesystem, which is nearly full, even if
99 * the check above passes. 99 * the check above passes.
@@ -118,7 +118,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs
118 c->nr_free_blocks, c->nr_erasing_blocks, c->free_size, c->dirty_size, c->wasted_size, c->used_size, c->erasing_size, c->bad_size, 118 c->nr_free_blocks, c->nr_erasing_blocks, c->free_size, c->dirty_size, c->wasted_size, c->used_size, c->erasing_size, c->bad_size,
119 c->free_size + c->dirty_size + c->wasted_size + c->used_size + c->erasing_size + c->bad_size, c->flash_size)); 119 c->free_size + c->dirty_size + c->wasted_size + c->used_size + c->erasing_size + c->bad_size, c->flash_size));
120 spin_unlock(&c->erase_completion_lock); 120 spin_unlock(&c->erase_completion_lock);
121 121
122 ret = jffs2_garbage_collect_pass(c); 122 ret = jffs2_garbage_collect_pass(c);
123 if (ret) 123 if (ret)
124 return ret; 124 return ret;
@@ -183,7 +183,7 @@ static void jffs2_close_nextblock(struct jffs2_sb_info *c, struct jffs2_eraseblo
183 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); 183 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size));
184 list_add_tail(&jeb->list, &c->dirty_list); 184 list_add_tail(&jeb->list, &c->dirty_list);
185 } 185 }
186 } else { 186 } else {
187 D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n", 187 D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
188 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); 188 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size));
189 list_add_tail(&jeb->list, &c->clean_list); 189 list_add_tail(&jeb->list, &c->clean_list);
@@ -197,7 +197,7 @@ static void jffs2_close_nextblock(struct jffs2_sb_info *c, struct jffs2_eraseblo
197static int jffs2_find_nextblock(struct jffs2_sb_info *c) 197static int jffs2_find_nextblock(struct jffs2_sb_info *c)
198{ 198{
199 struct list_head *next; 199 struct list_head *next;
200 200
201 /* Take the next block off the 'free' list */ 201 /* Take the next block off the 'free' list */
202 202
203 if (list_empty(&c->free_list)) { 203 if (list_empty(&c->free_list)) {
@@ -229,8 +229,8 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
229 if (!c->nr_erasing_blocks) { 229 if (!c->nr_erasing_blocks) {
230 /* Ouch. We're in GC, or we wouldn't have got here. 230 /* Ouch. We're in GC, or we wouldn't have got here.
231 And there's no space left. At all. */ 231 And there's no space left. At all. */
232 printk(KERN_CRIT "Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n", 232 printk(KERN_CRIT "Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n",
233 c->nr_erasing_blocks, c->nr_free_blocks, list_empty(&c->erasable_list)?"yes":"no", 233 c->nr_erasing_blocks, c->nr_free_blocks, list_empty(&c->erasable_list)?"yes":"no",
234 list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no"); 234 list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no");
235 return -ENOSPC; 235 return -ENOSPC;
236 } 236 }
@@ -250,7 +250,7 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
250 list_del(next); 250 list_del(next);
251 c->nextblock = list_entry(next, struct jffs2_eraseblock, list); 251 c->nextblock = list_entry(next, struct jffs2_eraseblock, list);
252 c->nr_free_blocks--; 252 c->nr_free_blocks--;
253 253
254 jffs2_sum_reset_collected(c->summary); /* reset collected summary */ 254 jffs2_sum_reset_collected(c->summary); /* reset collected summary */
255 255
256 D1(printk(KERN_DEBUG "jffs2_find_nextblock(): new nextblock = 0x%08x\n", c->nextblock->offset)); 256 D1(printk(KERN_DEBUG "jffs2_find_nextblock(): new nextblock = 0x%08x\n", c->nextblock->offset));
@@ -354,9 +354,9 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uin
354 354
355 if (c->cleanmarker_size && jeb->used_size == c->cleanmarker_size && 355 if (c->cleanmarker_size && jeb->used_size == c->cleanmarker_size &&
356 !jeb->first_node->next_in_ino) { 356 !jeb->first_node->next_in_ino) {
357 /* Only node in it beforehand was a CLEANMARKER node (we think). 357 /* Only node in it beforehand was a CLEANMARKER node (we think).
358 So mark it obsolete now that there's going to be another node 358 So mark it obsolete now that there's going to be another node
359 in the block. This will reduce used_size to zero but We've 359 in the block. This will reduce used_size to zero but We've
360 already set c->nextblock so that jffs2_mark_node_obsolete() 360 already set c->nextblock so that jffs2_mark_node_obsolete()
361 won't try to refile it to the dirty_list. 361 won't try to refile it to the dirty_list.
362 */ 362 */
@@ -376,12 +376,12 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uin
376 * @len: length of this physical node 376 * @len: length of this physical node
377 * @dirty: dirty flag for new node 377 * @dirty: dirty flag for new node
378 * 378 *
379 * Should only be used to report nodes for which space has been allocated 379 * Should only be used to report nodes for which space has been allocated
380 * by jffs2_reserve_space. 380 * by jffs2_reserve_space.
381 * 381 *
382 * Must be called with the alloc_sem held. 382 * Must be called with the alloc_sem held.
383 */ 383 */
384 384
385int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new) 385int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new)
386{ 386{
387 struct jffs2_eraseblock *jeb; 387 struct jffs2_eraseblock *jeb;
@@ -488,8 +488,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
488 488
489 if (jffs2_can_mark_obsolete(c) && !jffs2_is_readonly(c) && 489 if (jffs2_can_mark_obsolete(c) && !jffs2_is_readonly(c) &&
490 !(c->flags & (JFFS2_SB_FLAG_SCANNING | JFFS2_SB_FLAG_BUILDING))) { 490 !(c->flags & (JFFS2_SB_FLAG_SCANNING | JFFS2_SB_FLAG_BUILDING))) {
491 /* Hm. This may confuse static lock analysis. If any of the above 491 /* Hm. This may confuse static lock analysis. If any of the above
492 three conditions is false, we're going to return from this 492 three conditions is false, we're going to return from this
493 function without actually obliterating any nodes or freeing 493 function without actually obliterating any nodes or freeing
494 any jffs2_raw_node_refs. So we don't need to stop erases from 494 any jffs2_raw_node_refs. So we don't need to stop erases from
495 happening, or protect against people holding an obsolete 495 happening, or protect against people holding an obsolete
@@ -546,17 +546,17 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
546 D1(printk(KERN_DEBUG "Wasting\n")); 546 D1(printk(KERN_DEBUG "Wasting\n"));
547 addedsize = 0; 547 addedsize = 0;
548 jeb->wasted_size += ref_totlen(c, jeb, ref); 548 jeb->wasted_size += ref_totlen(c, jeb, ref);
549 c->wasted_size += ref_totlen(c, jeb, ref); 549 c->wasted_size += ref_totlen(c, jeb, ref);
550 } 550 }
551 ref->flash_offset = ref_offset(ref) | REF_OBSOLETE; 551 ref->flash_offset = ref_offset(ref) | REF_OBSOLETE;
552 552
553 jffs2_dbg_acct_sanity_check_nolock(c, jeb); 553 jffs2_dbg_acct_sanity_check_nolock(c, jeb);
554 jffs2_dbg_acct_paranoia_check_nolock(c, jeb); 554 jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
555 555
556 if (c->flags & JFFS2_SB_FLAG_SCANNING) { 556 if (c->flags & JFFS2_SB_FLAG_SCANNING) {
557 /* Flash scanning is in progress. Don't muck about with the block 557 /* Flash scanning is in progress. Don't muck about with the block
558 lists because they're not ready yet, and don't actually 558 lists because they're not ready yet, and don't actually
559 obliterate nodes that look obsolete. If they weren't 559 obliterate nodes that look obsolete. If they weren't
560 marked obsolete on the flash at the time they _became_ 560 marked obsolete on the flash at the time they _became_
561 obsolete, there was probably a reason for that. */ 561 obsolete, there was probably a reason for that. */
562 spin_unlock(&c->erase_completion_lock); 562 spin_unlock(&c->erase_completion_lock);
@@ -590,7 +590,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
590 immediately reused, and we spread the load a bit. */ 590 immediately reused, and we spread the load a bit. */
591 D1(printk(KERN_DEBUG "...and adding to erasable_list\n")); 591 D1(printk(KERN_DEBUG "...and adding to erasable_list\n"));
592 list_add_tail(&jeb->list, &c->erasable_list); 592 list_add_tail(&jeb->list, &c->erasable_list);
593 } 593 }
594 } 594 }
595 D1(printk(KERN_DEBUG "Done OK\n")); 595 D1(printk(KERN_DEBUG "Done OK\n"));
596 } else if (jeb == c->gcblock) { 596 } else if (jeb == c->gcblock) {
@@ -608,8 +608,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
608 list_add_tail(&jeb->list, &c->very_dirty_list); 608 list_add_tail(&jeb->list, &c->very_dirty_list);
609 } else { 609 } else {
610 D1(printk(KERN_DEBUG "Eraseblock at 0x%08x not moved anywhere. (free 0x%08x, dirty 0x%08x, used 0x%08x)\n", 610 D1(printk(KERN_DEBUG "Eraseblock at 0x%08x not moved anywhere. (free 0x%08x, dirty 0x%08x, used 0x%08x)\n",
611 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); 611 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size));
612 } 612 }
613 613
614 spin_unlock(&c->erase_completion_lock); 614 spin_unlock(&c->erase_completion_lock);
615 615
@@ -656,11 +656,11 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
656 656
657 /* Nodes which have been marked obsolete no longer need to be 657 /* Nodes which have been marked obsolete no longer need to be
658 associated with any inode. Remove them from the per-inode list. 658 associated with any inode. Remove them from the per-inode list.
659 659
660 Note we can't do this for NAND at the moment because we need 660 Note we can't do this for NAND at the moment because we need
661 obsolete dirent nodes to stay on the lists, because of the 661 obsolete dirent nodes to stay on the lists, because of the
662 horridness in jffs2_garbage_collect_deletion_dirent(). Also 662 horridness in jffs2_garbage_collect_deletion_dirent(). Also
663 because we delete the inocache, and on NAND we need that to 663 because we delete the inocache, and on NAND we need that to
664 stay around until all the nodes are actually erased, in order 664 stay around until all the nodes are actually erased, in order
665 to stop us from giving the same inode number to another newly 665 to stop us from giving the same inode number to another newly
666 created inode. */ 666 created inode. */
@@ -689,7 +689,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
689 if (ref->next_phys && ref_obsolete(ref->next_phys) && 689 if (ref->next_phys && ref_obsolete(ref->next_phys) &&
690 !ref->next_phys->next_in_ino) { 690 !ref->next_phys->next_in_ino) {
691 struct jffs2_raw_node_ref *n = ref->next_phys; 691 struct jffs2_raw_node_ref *n = ref->next_phys;
692 692
693 spin_lock(&c->erase_completion_lock); 693 spin_lock(&c->erase_completion_lock);
694 694
695 ref->__totlen += n->__totlen; 695 ref->__totlen += n->__totlen;
@@ -703,7 +703,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
703 703
704 jffs2_free_raw_node_ref(n); 704 jffs2_free_raw_node_ref(n);
705 } 705 }
706 706
707 /* Also merge with the previous node in the list, if there is one 707 /* Also merge with the previous node in the list, if there is one
708 and that one is obsolete */ 708 and that one is obsolete */
709 if (ref != jeb->first_node ) { 709 if (ref != jeb->first_node ) {
@@ -713,7 +713,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
713 713
714 while (p->next_phys != ref) 714 while (p->next_phys != ref)
715 p = p->next_phys; 715 p = p->next_phys;
716 716
717 if (ref_obsolete(p) && !ref->next_in_ino) { 717 if (ref_obsolete(p) && !ref->next_in_ino) {
718 p->__totlen += ref->__totlen; 718 p->__totlen += ref->__totlen;
719 if (jeb->last_node == ref) { 719 if (jeb->last_node == ref) {
@@ -753,11 +753,11 @@ int jffs2_thread_should_wake(struct jffs2_sb_info *c)
753 */ 753 */
754 dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size; 754 dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size;
755 755
756 if (c->nr_free_blocks + c->nr_erasing_blocks < c->resv_blocks_gctrigger && 756 if (c->nr_free_blocks + c->nr_erasing_blocks < c->resv_blocks_gctrigger &&
757 (dirty > c->nospc_dirty_size)) 757 (dirty > c->nospc_dirty_size))
758 ret = 1; 758 ret = 1;
759 759
760 D1(printk(KERN_DEBUG "jffs2_thread_should_wake(): nr_free_blocks %d, nr_erasing_blocks %d, dirty_size 0x%x: %s\n", 760 D1(printk(KERN_DEBUG "jffs2_thread_should_wake(): nr_free_blocks %d, nr_erasing_blocks %d, dirty_size 0x%x: %s\n",
761 c->nr_free_blocks, c->nr_erasing_blocks, c->dirty_size, ret?"yes":"no")); 761 c->nr_free_blocks, c->nr_erasing_blocks, c->dirty_size, ret?"yes":"no"));
762 762
763 return ret; 763 return ret;