Update of /cvsroot/linux-mips/linux/fs/jffs2 In directory usw-pr-cvs1:/tmp/cvs-serv11592/fs/jffs2 Modified Files: Makefile background.c compr_rubin.c erase.c file.c nodelist.h readinode.c scan.c super.c write.c Log Message: Further syncing with OSS 2.4.10. Massive restructuring of TLB handling. Index: Makefile =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 2001/07/11 16:55:46 1.1 +++ Makefile 2001/10/22 19:16:45 1.2 @@ -18,8 +18,6 @@ EXTRA_CFLAGS= -DCONFIG_JFFS2_FS_DEBUG=1 -g endif -EXTRA_CFLAGS += -DJFFS2_OUT_OF_KERNEL - obj-$(CONFIG_JFFS2_FS) += jffs2.o COMPR_OBJS := compr.o compr_rubin.o compr_rtime.o pushpull.o \ Index: background.c =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/background.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- background.c 2001/07/11 16:55:46 1.1 +++ background.c 2001/10/22 19:16:45 1.2 @@ -43,6 +43,7 @@ #include <linux/jffs2.h> #include <linux/mtd/mtd.h> #include <linux/interrupt.h> +#include <linux/smp_lock.h> #include "nodelist.h" @@ -62,6 +63,7 @@ pid_t pid; int ret = 0; init_MUTEX_LOCKED(&c->gc_thread_sem); + init_completion(&c->gc_thread_exit); pid = kernel_thread(jffs2_garbage_collect_thread, c, CLONE_FS|CLONE_FILES); if (pid < 0) { @@ -86,6 +88,7 @@ } spin_unlock_bh(&c->erase_completion_lock); down(&c->gc_thread_sem); + wait_for_completion(&c->gc_thread_exit); } static int jffs2_garbage_collect_thread(void *_c) @@ -139,7 +142,8 @@ spin_lock_bh(&c->erase_completion_lock); c->gc_task = NULL; spin_unlock_bh(&c->erase_completion_lock); - up_and_exit(&c->gc_thread_sem, 0); + up(&c->gc_thread_sem); + complete_and_exit(&c->gc_thread_exit,0 ); case SIGHUP: D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGHUP received.\n")); Index: compr_rubin.c =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/compr_rubin.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- compr_rubin.c 2001/07/11 16:55:46 1.1 +++ compr_rubin.c 2001/10/22 19:16:45 1.2 @@ -37,7 +37,6 @@ #include <linux/string.h> -#include <linux/types.h> #include "compr_rubin.h" #include "histo_mips.h" Index: erase.c =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/erase.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- erase.c 2001/07/11 16:55:46 1.1 +++ erase.c 2001/10/22 19:16:45 1.2 @@ -38,6 +38,7 @@ #include <linux/slab.h> #include <linux/mtd/mtd.h> #include <linux/jffs2.h> +#include <linux/interrupt.h> #include "nodelist.h" #include "crc32.h" @@ -151,7 +152,7 @@ spin_unlock(&priv->c->erase_completion_lock); wake_up(&priv->c->erase_wait); } else { - D1(printk(KERN_DEBUG "Erase completed successfully at 0x%08x\n", instr->addr)); + D1(printk(KERN_DEBUG "Erase completed successfully at 0x%08lx\n", instr->addr)); spin_lock(&priv->c->erase_completion_lock); list_del(&priv->jeb->list); list_add_tail(&priv->jeb->list, &priv->c->erase_complete_list); Index: file.c =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/file.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- file.c 2001/07/11 16:55:46 1.1 +++ file.c 2001/10/22 19:16:45 1.2 @@ -54,6 +54,7 @@ struct file_operations jffs2_file_operations = { + llseek: generic_file_llseek, open: generic_file_open, read: generic_file_read, write: generic_file_write, Index: nodelist.h =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/nodelist.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- nodelist.h 2001/07/11 16:55:46 1.1 +++ nodelist.h 2001/10/22 19:16:45 1.2 @@ -234,8 +234,8 @@ #define PAD(x) (((x)+3)&~3) /* These probably ought to be somewhere central. */ -#define min(x,y) ({ typeof((x)) _x = (x); typeof((y)) _y = (y); (_x>_y)?_y:_x; }) -#define max(x,y) ({ typeof((x)) _x = (x); typeof((y)) _y = (y); (_x>_y)?_x:_y; }) +//#define min(x,y) ({ typeof((x)) _x = (x); typeof((y)) _y = (y); (_x>_y)?_y:_x; }) +//#define max(x,y) ({ typeof((x)) _x = (x); typeof((y)) _y = (y); (_x>_y)?_x:_y; }) static inline int jffs2_raw_ref_to_inum(struct jffs2_raw_node_ref *raw) { Index: readinode.c =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/readinode.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- readinode.c 2001/07/11 16:55:46 1.1 +++ readinode.c 2001/10/22 19:16:45 1.2 @@ -460,8 +460,11 @@ frags = f->fraglist; fds = f->dents; - if (f->metadata) + if (f->metadata) { + if (!f->inocache->nlink) + jffs2_mark_node_obsolete(c, f->metadata->raw); jffs2_free_full_dnode(f->metadata); + } while (frags) { frag = frags; Index: scan.c =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/scan.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- scan.c 2001/07/11 16:55:46 1.1 +++ scan.c 2001/10/22 19:16:45 1.2 @@ -76,8 +76,6 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) { int i, ret; - __u32 empty_blocks = 0; - if (!c->blocks) { printk(KERN_WARNING "EEEK! c->blocks is NULL!\n"); return -EINVAL; @@ -86,24 +84,13 @@ struct jffs2_eraseblock *jeb = &c->blocks[i]; ret = jffs2_scan_eraseblock(c, jeb); - if (ret < 0) + if (ret) return ret; ACCT_PARANOIA_CHECK(jeb); /* Now decide which list to put it on */ - if (ret == 1) { - /* - * Empty block. Since we can't be sure it - * was entirely erased, we just queue it for erase - * again. It will be marked as such when the erase - * is complete. Meanwhile we still count it as empty - * for later checks. - */ - list_add(&jeb->list, &c->erase_pending_list); - empty_blocks++; - c->nr_erasing_blocks++; - } else if (jeb->used_size == PAD(sizeof(struct jffs2_unknown_node)) && !jeb->first_node->next_in_ino) { + if (jeb->used_size == PAD(sizeof(struct jffs2_unknown_node)) && !jeb->first_node->next_in_ino) { /* Only a CLEANMARKER node is valid */ if (!jeb->dirty_size) { /* It's actually free */ @@ -142,13 +129,9 @@ c->nr_erasing_blocks++; } } - if (c->nr_erasing_blocks) { - if (!c->used_size && empty_blocks != c->nr_blocks) { - printk(KERN_NOTICE "Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes\n"); - return -EIO; - } + if (c->nr_erasing_blocks) jffs2_erase_pending_trigger(c); - } + return 0; } @@ -157,22 +140,13 @@ __u32 ofs, prevofs; __u32 hdr_crc, nodetype; int err; - int noise = 0; + int noise = 10; ofs = jeb->offset; prevofs = jeb->offset - 1; D1(printk(KERN_DEBUG "jffs2_scan_eraseblock(): Scanning block at 0x%x\n", ofs)); - err = jffs2_scan_empty(c, jeb, &ofs, &noise); - if (err) return err; - if (ofs == jeb->offset + c->sector_size) { - D1(printk(KERN_DEBUG "Block at 0x%08x is empty (erased)\n", jeb->offset)); - return 1; /* special return code */ - } - - noise = 10; - while(ofs < jeb->offset + c->sector_size) { ssize_t retlen; ACCT_PARANOIA_CHECK(jeb); @@ -632,8 +606,6 @@ if (crc != rd.name_crc) { printk(KERN_NOTICE "jffs2_scan_dirent_node(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", *ofs, rd.name_crc, crc); - fd->name[rd.nsize]=0; - D1(printk(KERN_NOTICE "Name for which CRC failed is (now) '%s', ino #%d\n", fd->name, rd.ino)); jffs2_free_full_dirent(fd); /* FIXME: Why do we believe totlen? */ DIRTY_SPACE(PAD(rd.totlen)); Index: super.c =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/super.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- super.c 2001/07/11 16:55:46 1.1 +++ super.c 2001/10/22 19:16:45 1.2 @@ -46,6 +46,8 @@ #include <linux/jffs2.h> #include <linux/pagemap.h> #include <linux/mtd/mtd.h> +#include <linux/interrupt.h> + #include "nodelist.h" #ifndef MTD_BLOCK_MAJOR @@ -292,8 +294,6 @@ jffs2_free_ino_caches(c); jffs2_free_raw_node_refs(c); kfree(c->blocks); - if (c->mtd->sync) - c->mtd->sync(c->mtd); put_mtd_device(c->mtd); D1(printk(KERN_DEBUG "jffs2_put_super returning\n")); Index: write.c =================================================================== RCS file: /cvsroot/linux-mips/linux/fs/jffs2/write.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- write.c 2001/07/11 16:55:46 1.1 +++ write.c 2001/10/22 19:16:45 1.2 @@ -255,7 +255,7 @@ struct iovec vecs[2]; int ret; - D1(printk(KERN_DEBUG "jffs2_write_dirent(ino #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x)\n", rd->pino, name, name, rd->ino, rd->name_crc)); + D1(printk(KERN_DEBUG "jffs2_write_dirent(ino #%u, name \"%s\"->ino #%u\n", rd->pino, name, rd->ino)); writecheck(c->mtd, flash_ofs); D1(if(rd->hdr_crc != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) { |