diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/ChangeLog fs/jffs2/current/ChangeLog --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/ChangeLog 2004-10-21 20:13:44.000000000 +0200 +++ fs/jffs2/current/ChangeLog 2004-11-12 17:44:00.000000000 +0100 @@ -1,3 +1,12 @@ +2004-11-11 Andrew Lunn + + * Merge from public MTD. + +2004-11-11 Andrew Lunn + + * src/build.c: Removed Oyvind Harboe's patch from 2004-04-19 + since it was rejected upstream. + 2004-10-20 Per Hedblom * src/fs-ecos.c (jffs2_open): Call iput on dir node if diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/cdl/jffs2.cdl fs/jffs2/current/cdl/jffs2.cdl --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/cdl/jffs2.cdl 2004-09-19 16:28:45.000000000 +0200 +++ fs/jffs2/current/cdl/jffs2.cdl 2004-11-12 17:44:00.000000000 +0100 @@ -4,7 +4,7 @@ # # JFFS2 Filesystem configuration data # -# $Id: jffs2.cdl,v 1.15 2004/04/21 18:50:52 gthomas Exp $ +# $Id: jffs2.cdl,v 1.16 2004/11/11 20:48:54 lunn Exp $ # # ==================================================================== #####ECOSGPLCOPYRIGHTBEGIN#### diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/doc/TODO fs/jffs2/current/doc/TODO --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/doc/TODO 2004-08-12 23:35:27.000000000 +0200 +++ fs/jffs2/current/doc/TODO 2004-11-12 17:44:00.000000000 +0100 @@ -1,4 +1,4 @@ -$Id: TODO,v 1.16 2004/03/20 15:01:34 dwmw2 Exp $ +$Id: TODO,v 1.17 2004/04/14 20:11:38 gleixner Exp $ - support asynchronous operation -- add a per-fs 'reserved_space' count, let each outstanding write reserve the _maximum_ amount of physical diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/doc/TODO.eCos fs/jffs2/current/doc/TODO.eCos --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/doc/TODO.eCos 2004-08-12 23:35:27.000000000 +0200 +++ fs/jffs2/current/doc/TODO.eCos 2004-11-12 17:44:00.000000000 +0100 @@ -1,4 +1,4 @@ -$Id: TODO.eCos,v 1.4 2003/11/28 11:15:56 dwmw2 Exp $ +$Id: TODO.eCos,v 1.2 2003/11/28 11:15:56 dwmw2 Exp $ - Make symlinks work properly. diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/include/linux/jffs2_fs_i.h fs/jffs2/current/include/linux/jffs2_fs_i.h --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/include/linux/jffs2_fs_i.h 2003-02-05 01:00:40.000000000 +0100 +++ fs/jffs2/current/include/linux/jffs2_fs_i.h 2004-11-12 17:44:00.000000000 +0100 @@ -1,10 +1,11 @@ -/* $Id: jffs2_fs_i.h,v 1.16 2003/01/09 14:03:21 dwmw2 Exp $ */ +/* $Id: jffs2_fs_i.h,v 1.17 2004/11/11 23:51:27 dwmw2 Exp $ */ #ifndef _JFFS2_FS_I #define _JFFS2_FS_I #include #include +#include struct jffs2_inode_info { /* We need an internal semaphore similar to inode->i_sem. diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/include/linux/jffs2_fs_sb.h fs/jffs2/current/include/linux/jffs2_fs_sb.h --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/include/linux/jffs2_fs_sb.h 2003-11-20 17:52:35.000000000 +0100 +++ fs/jffs2/current/include/linux/jffs2_fs_sb.h 2004-11-12 17:44:00.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: jffs2_fs_sb.h,v 1.45 2003/10/08 11:46:27 dwmw2 Exp $ */ +/* $Id: jffs2_fs_sb.h,v 1.46 2004/11/03 12:57:39 jwboyer Exp $ */ #ifndef _JFFS2_FS_SB #define _JFFS2_FS_SB @@ -95,7 +95,7 @@ to an obsoleted node. I don't like this. Alternatives welcomed. */ struct semaphore erase_free_sem; -#ifdef CONFIG_JFFS2_FS_NAND +#if defined CONFIG_JFFS2_FS_NAND || defined CONFIG_JFFS2_FS_NOR_ECC /* Write-behind buffer for NAND flash */ unsigned char *wbuf; uint32_t wbuf_ofs; diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/build.c fs/jffs2/current/src/build.c --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/build.c 2004-04-29 09:16:11.000000000 +0200 +++ fs/jffs2/current/src/build.c 2004-11-12 17:44:00.000000000 +0100 @@ -259,14 +259,6 @@ c->resv_blocks_write = c->resv_blocks_deletion + (size / c->sector_size); - // If the flash disk is smaller than resv_blocks_write, then we - // allow writing to the disk anyway. The flash disk is then most likely - // being used as write once - read many medimum, e.g. configuration of - // static paramters. - if (c->resv_blocks_write * c->sector_size > c->flash_size) { - c->resv_blocks_write = 0; - } - /* When do we let the GC thread run in the background */ c->resv_blocks_gctrigger = c->resv_blocks_write + 1; diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/compr.c fs/jffs2/current/src/compr.c --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/compr.c 2004-08-12 23:35:28.000000000 +0200 +++ fs/jffs2/current/src/compr.c 2004-11-12 17:44:00.000000000 +0100 @@ -9,7 +9,7 @@ * * For licensing information, see the file 'LICENCE' in this directory. * - * $Id: compr.c,v 1.41 2004/06/24 09:51:38 havasi Exp $ + * $Id: compr.c,v 1.42 2004/08/07 21:56:08 dwmw2 Exp $ * */ @@ -180,6 +180,11 @@ struct jffs2_compressor *this; int ret; + /* Older code had a bug where it would write non-zero 'usercompr' + fields. Deal with it. */ + if ((comprtype & 0xff) <= JFFS2_COMPR_ZLIB) + comprtype &= 0xff; + switch (comprtype & 0xff) { case JFFS2_COMPR_NONE: /* This should be special-cased elsewhere, but we might as well deal with it */ @@ -208,7 +213,7 @@ return ret; } } - printk(KERN_WARNING "JFFS2 compression type 0x%02x not avaiable.\n", comprtype); + printk(KERN_WARNING "JFFS2 compression type 0x%02x not available.\n", comprtype); spin_unlock(&jffs2_compressor_list_lock); return -EIO; } diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/compr.h fs/jffs2/current/src/compr.h --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/compr.h 2004-08-13 12:55:27.000000000 +0200 +++ fs/jffs2/current/src/compr.h 2004-11-12 17:44:00.000000000 +0100 @@ -23,8 +23,8 @@ #include #include #include -#include #include +#include #include "nodelist.h" #define JFFS2_RUBINMIPS_PRIORITY 10 diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/erase.c fs/jffs2/current/src/erase.c --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/erase.c 2004-08-12 23:35:28.000000000 +0200 +++ fs/jffs2/current/src/erase.c 2004-11-12 17:44:00.000000000 +0100 @@ -7,7 +7,7 @@ * * For licensing information, see the file 'LICENCE' in this directory. * - * $Id: erase.c,v 1.60 2004/06/30 17:26:15 dbrown Exp $ + * $Id: erase.c,v 1.64 2004/11/12 15:25:14 jwboyer Exp $ * */ @@ -387,6 +387,7 @@ jeb->dirty_size = 0; jeb->wasted_size = 0; } else { + struct iovec vecs[1]; struct jffs2_unknown_node marker = { .magic = cpu_to_je16(JFFS2_MAGIC_BITMASK), .nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER), @@ -395,15 +396,17 @@ marker.hdr_crc = cpu_to_je32(crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4)); - /* We only write the header; the rest was noise or padding anyway */ - ret = jffs2_flash_write(c, jeb->offset, sizeof(marker), &retlen, (char *)&marker); + vecs[0].iov_base = (unsigned char *) ▮ + vecs[0].iov_len = sizeof(marker); + ret = jffs2_flash_direct_writev(c, vecs, 1, jeb->offset, &retlen); + if (ret) { printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n", jeb->offset, ret); goto bad2; } if (retlen != sizeof(marker)) { - printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %d, got %zd\n", + printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n", jeb->offset, sizeof(marker), retlen); goto bad2; } Only in /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src: file-ecos.c diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/fs-ecos.c fs/jffs2/current/src/fs-ecos.c --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/fs-ecos.c 2004-10-21 20:13:44.000000000 +0200 +++ fs/jffs2/current/src/fs-ecos.c 2004-11-12 17:44:00.000000000 +0100 @@ -8,7 +8,7 @@ * * For licensing information, see the file 'LICENCE' in this directory. * - * $Id: fs-ecos.c,v 1.37 2004/04/21 18:45:54 gthomas Exp $ + * $Id: fs-ecos.c,v 1.39 2004/11/11 12:46:17 dwmw2 Exp $ * */ @@ -1671,7 +1671,8 @@ /* FIXME: This works only with one file system mounted at a time */ int ret; - ret = jffs2_read_inode_range(c, f, gc_buffer, offset, PAGE_CACHE_SIZE); + ret = jffs2_read_inode_range(c, f, gc_buffer, + offset & ~(PAGE_CACHE_SIZE-1), PAGE_CACHE_SIZE); if (ret) return ERR_PTR(ret); Only in /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src: jffs2port.h diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/nodelist.h fs/jffs2/current/src/nodelist.h --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/nodelist.h 2004-08-12 23:35:28.000000000 +0200 +++ fs/jffs2/current/src/nodelist.h 2004-11-12 17:44:00.000000000 +0100 @@ -7,7 +7,7 @@ * * For licensing information, see the file 'LICENCE' in this directory. * - * $Id: nodelist.h,v 1.119 2004/05/26 12:28:12 gleixner Exp $ + * $Id: nodelist.h,v 1.120 2004/10/07 15:11:54 havasi Exp $ * */ @@ -281,9 +281,14 @@ else if (!ref_obsolete(ref2)) \ my_used_size += ref_totlen(c, jeb, ref2); \ if (unlikely((!ref2->next_phys) != (ref2 == jeb->last_node))) { \ - printk("ref for node at %p (phys %08x) has next_phys->%p (%08x), last_node->%p (phys %08x)\n", \ - ref2, ref_offset(ref2), ref2->next_phys, ref_offset(ref2->next_phys), \ - jeb->last_node, ref_offset(jeb->last_node)); \ + if (!ref2->next_phys) \ + printk("ref for node at %p (phys %08x) has next_phys->%p (----), last_node->%p (phys %08x)\n", \ + ref2, ref_offset(ref2), ref2->next_phys, \ + jeb->last_node, ref_offset(jeb->last_node)); \ + else \ + printk("ref for node at %p (phys %08x) has next_phys->%p (%08x), last_node->%p (phys %08x)\n", \ + ref2, ref_offset(ref2), ref2->next_phys, ref_offset(ref2->next_phys), \ + jeb->last_node, ref_offset(jeb->last_node)); \ paranoia_failed_dump(jeb); \ BUG(); \ } \ diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/nodemgmt.c fs/jffs2/current/src/nodemgmt.c --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/nodemgmt.c 2003-12-12 00:33:54.000000000 +0100 +++ fs/jffs2/current/src/nodemgmt.c 2004-11-12 17:44:00.000000000 +0100 @@ -7,7 +7,7 @@ * * For licensing information, see the file 'LICENCE' in this directory. * - * $Id: nodemgmt.c,v 1.107 2003/11/26 15:30:58 dwmw2 Exp $ + * $Id: nodemgmt.c,v 1.109 2004/10/07 15:08:47 havasi Exp $ * */ @@ -549,6 +549,59 @@ printk(KERN_WARNING "Short write in obliterating obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen); return; } + + /* Nodes which have been marked obsolete no longer need to be + associated with any inode. Remove them from the per-inode list */ + if (ref->next_in_ino) { + struct jffs2_inode_cache *ic; + struct jffs2_raw_node_ref **p; + + ic = jffs2_raw_ref_to_ic(ref); + for (p = &ic->nodes; (*p) != ref; p = &((*p)->next_in_ino)) + ; + + *p = ref->next_in_ino; + ref->next_in_ino = NULL; + } + + + /* Merge with the next node in the physical list, if there is one + and if it's also obsolete. */ + if (ref->next_phys && ref_obsolete(ref->next_phys) ) { + struct jffs2_raw_node_ref *n = ref->next_phys; + + ref->__totlen += n->__totlen; + ref->next_phys = n->next_phys; + if (jeb->last_node == n) jeb->last_node = ref; + if (jeb->gc_node == n) { + /* gc will be happy continuing gc on this node */ + jeb->gc_node=ref; + } + BUG_ON(n->next_in_ino); + jffs2_free_raw_node_ref(n); + } + + /* Also merge with the previous node in the list, if there is one + and that one is obsolete */ + if (ref != jeb->first_node ) { + struct jffs2_raw_node_ref *p = jeb->first_node; + + while (p->next_phys != ref) + p = p->next_phys; + + if (ref_obsolete(p) ) { + p->__totlen += ref->__totlen; + if (jeb->last_node == ref) { + jeb->last_node = p; + } + if (jeb->gc_node == ref) { + /* gc will be happy continuing gc on this node */ + jeb->gc_node=p; + } + p->next_phys = ref->next_phys; + jffs2_free_raw_node_ref(ref); + } + } } #if CONFIG_JFFS2_FS_DEBUG > 0 diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/os-ecos.h fs/jffs2/current/src/os-ecos.h --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/os-ecos.h 2004-11-12 17:45:34.000000000 +0100 +++ fs/jffs2/current/src/os-ecos.h 2004-11-12 17:44:00.000000000 +0100 @@ -198,6 +198,7 @@ #define jffs2_flash_writev(a,b,c,d,e,f) jffs2_flash_direct_writev(a,b,c,d,e) #define jffs2_wbuf_timeout NULL #define jffs2_wbuf_process NULL +#define jffs2_nor_ecc(c) (0) #else #error no nand yet #endif Only in /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src: os-ecos.h.~1.9.~ diff -xCVS -ur /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/scan.c fs/jffs2/current/src/scan.c --- /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current/src/scan.c 2004-08-12 23:35:28.000000000 +0200 +++ fs/jffs2/current/src/scan.c 2004-11-12 17:44:00.000000000 +0100 @@ -7,7 +7,7 @@ * * For licensing information, see the file 'LICENCE' in this directory. * - * $Id: scan.c,v 1.111 2004/07/27 14:13:43 gleixner Exp $ + * $Id: scan.c,v 1.113 2004/11/03 12:57:39 jwboyer Exp $ * */ #include @@ -68,7 +68,7 @@ static inline int min_free(struct jffs2_sb_info *c) { uint32_t min = 2 * sizeof(struct jffs2_raw_inode); -#ifdef CONFIG_JFFS2_FS_NAND +#if defined CONFIG_JFFS2_FS_NAND || defined CONFIG_JFFS2_FS_NOR_ECC if (!jffs2_can_mark_obsolete(c) && min < c->wbuf_pagesize) return c->wbuf_pagesize; #endif @@ -223,7 +223,7 @@ c->dirty_size -= c->nextblock->dirty_size; c->nextblock->dirty_size = 0; } -#ifdef CONFIG_JFFS2_FS_NAND +#if defined CONFIG_JFFS2_FS_NAND || defined CONFIG_JFFS2_FS_NOR_ECC if (!jffs2_can_mark_obsolete(c) && c->nextblock && (c->nextblock->free_size & (c->wbuf_pagesize-1))) { /* If we're going to start writing into a block which already contains data, and the end of the data isn't page-aligned, @@ -241,7 +241,7 @@ } #endif if (c->nr_erasing_blocks) { - if ( !c->used_size && ((empty_blocks+bad_blocks)!= c->nr_blocks || bad_blocks == c->nr_blocks) ) { + if ( !c->used_size && ((c->nr_free_blocks+empty_blocks+bad_blocks)!= c->nr_blocks || bad_blocks == c->nr_blocks) ) { printk(KERN_NOTICE "Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes\n"); printk(KERN_NOTICE "empty_blocks %d, bad_blocks %d, c->nr_blocks %d\n",empty_blocks,bad_blocks,c->nr_blocks); ret = -EIO; Only in /home/lunn/eCos/anoncvs-clean/packages/fs/jffs2/current: support