]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/jffs2/erase.c
hugetlb: factor out prep_new_huge_page
[linux-2.6-omap-h63xx.git] / fs / jffs2 / erase.c
index 65d91943fc2d365c96d4598304fa468dc7bc9ac4..dddb2a6c9e2cfc087b6becc7f88d9e85ab1d02b4 100644 (file)
@@ -116,7 +116,7 @@ void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
 
                if (!list_empty(&c->erase_complete_list)) {
                        jeb = list_entry(c->erase_complete_list.next, struct jffs2_eraseblock, list);
-                       list_del(&jeb->list);
+                       list_move(&jeb->list, &c->erase_checking_list);
                        spin_unlock(&c->erase_completion_lock);
                        mutex_unlock(&c->erase_free_sem);
                        jffs2_mark_erased_block(c, jeb);
@@ -294,7 +294,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
                        break;
 #endif
                default:
-                       if (ic->nodes == (void *)ic && ic->nlink == 0)
+                       if (ic->nodes == (void *)ic && ic->pino_nlink == 0)
                                jffs2_del_ino_cache(c, ic);
        }
 }
@@ -332,7 +332,8 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
        if (c->mtd->point) {
                unsigned long *wordebuf;
 
-               ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, &retlen, (unsigned char **)&ebuf);
+               ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size,
+                                   &retlen, &ebuf, NULL);
                if (ret) {
                        D1(printk(KERN_DEBUG "MTD point failed %d\n", ret));
                        goto do_flash_read;
@@ -340,7 +341,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
                if (retlen < c->sector_size) {
                        /* Don't muck about if it won't let us point to the whole erase sector */
                        D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen));
-                       c->mtd->unpoint(c->mtd, ebuf, jeb->offset, retlen);
+                       c->mtd->unpoint(c->mtd, jeb->offset, retlen);
                        goto do_flash_read;
                }
                wordebuf = ebuf-sizeof(*wordebuf);
@@ -349,10 +350,12 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
                   if (*++wordebuf != ~0)
                           break;
                } while(--retlen);
-               c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size);
-               if (retlen)
+               c->mtd->unpoint(c->mtd, jeb->offset, c->sector_size);
+               if (retlen) {
                        printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n",
                               *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf));
+                       return -EIO;
+               }
                return 0;
        }
  do_flash_read:
@@ -373,10 +376,12 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
                ret = c->mtd->read(c->mtd, ofs, readlen, &retlen, ebuf);
                if (ret) {
                        printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret);
+                       ret = -EIO;
                        goto fail;
                }
                if (retlen != readlen) {
                        printk(KERN_WARNING "Short read from newly-erased block at 0x%08x. Wanted %d, got %zd\n", ofs, readlen, retlen);
+                       ret = -EIO;
                        goto fail;
                }
                for (i=0; i<readlen; i += sizeof(unsigned long)) {
@@ -385,6 +390,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
                        if (*datum + 1) {
                                *bad_offset += i;
                                printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", *datum, *bad_offset);
+                               ret = -EIO;
                                goto fail;
                        }
                }
@@ -460,7 +466,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
        if (c->cleanmarker_size && !jffs2_cleanmarker_oob(c))
                jffs2_link_node_ref(c, jeb, jeb->offset | REF_NORMAL, c->cleanmarker_size, NULL);
 
-       list_add_tail(&jeb->list, &c->free_list);
+       list_move_tail(&jeb->list, &c->free_list);
        c->nr_erasing_blocks--;
        c->nr_free_blocks++;
 
@@ -477,7 +483,7 @@ filebad:
        spin_lock(&c->erase_completion_lock);
        /* Stick it on a list (any list) so erase_failed can take it
           right off again.  Silly, but shouldn't happen often. */
-       list_add(&jeb->list, &c->erasing_list);
+       list_move(&jeb->list, &c->erasing_list);
        spin_unlock(&c->erase_completion_lock);
        mutex_unlock(&c->erase_free_sem);
        jffs2_erase_failed(c, jeb, bad_offset);
@@ -488,7 +494,7 @@ refile:
        jffs2_erase_pending_trigger(c);
        mutex_lock(&c->erase_free_sem);
        spin_lock(&c->erase_completion_lock);
-       list_add(&jeb->list, &c->erase_complete_list);
+       list_move(&jeb->list, &c->erase_complete_list);
        spin_unlock(&c->erase_completion_lock);
        mutex_unlock(&c->erase_free_sem);
        return;