path: root/fs/jffs2/wbuf.c
AgeCommit message (Collapse)Author
2009-09-03JFFS2: add missing verify buffer allocation/deallocationMassimo Cirillo
The function jffs2_nor_wbuf_flash_setup() doesn't allocate the verify buffer if CONFIG_JFFS2_FS_WBUF_VERIFY is defined, so causing a kernel panic when that macro is enabled and the verify function is called. Similarly the jffs2_nor_wbuf_flash_cleanup() must free the buffer if CONFIG_JFFS2_FS_WBUF_VERIFY is enabled. The following patch fixes the problem. The following patch applies to 2.6.30 kernel. Signed-off-by: Massimo Cirillo <maxcir@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Cc: stable@kernel.org
2008-10-18[JFFS2] Write buffer offset adjustment for NOR-ECC (Sibley) flashAlexander Belyakov
After choosing new c->nextblock, don't leave the wbuf offset field occasionally pointing at the start of the next physical eraseblock. This was causing a BUG() on NOR-ECC (Sibley) flash, where we start writing after the cleanmarker. Among other this fix should cover write buffer offset adjustment after flushing the last page of an eraseblock. Signed-off-by: Alexander Belyakov <abelyako@googlemail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-05-01[JFFS2] Track parent inode for directories (for NFS export)David Woodhouse
To support NFS export, we need to know the parent inode of directories. Rather than growing the jffs2_inode_cache structure, share space with the nlink field -- which was always set to 1 for directories anyway. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-05-01[JFFS2] Invert last argument of jffs2_gc_fetch_inode(), make it boolean.David Woodhouse
We don't actually care about nlink; we only care whether the inode in question is unlinked or not. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22[JFFS2] semaphore->mutex conversionDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22[JFFS2] add write verify on dataflash.michael
Add the write verification buffer to the dataflash. The mtd_dataflash has the CONFIG_DATAFLASH_WRITE_VERIFY so is better a change to Kconfig. Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-09[JFFS2] Correct cleanmarker checks -- we should use only 8 bytesDavid Woodhouse
Commit a7a6ace1406f95c3edb8365788f85984377f3832 revamped the OOB handling but accidentally switched to 12-byte cleanmarkers, which is incompatible with what 'flash_eraseall -j' will do. So using flash_eraseall -j and then trying to mount the 'empty' flash will fail, because the cleanmarkers aren't recognised. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-11[JFFS2] Add support for write-buffer verification.David Woodhouse
We've seen some evil corruption issues, where the corruption seems to be introduced after the JFFS2 crc32 is calculated but before the NAND controller calculates the ECC. So it's in RAM or in the PCI DMA transfer; not on the flash. Attempt to catch it earlier by (optionally) reading back from the flash immediately after writing it. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-10[JFFS2] Whitespace cleanups.David Woodhouse
Convert many spaces to tabs; one or two other minor cosmetic fixes. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-05-05[JFFS2] Don't advance c->wbuf_ofs to next eraseblock after wbuf flushDavid Woodhouse
After flushing the last page of an eraseblock, don't leave the wbuf 'offset' field pointing at the start of the next physical eraseblock. This was causing a BUG() on NOR-ECC (Sibley) flash, where we start writing a little further in, after the cleanmarker. Debugged by Alexander Belyakov <abelyako@googlemail.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-27Merge branch 'master' of ↵David Woodhouse
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: drivers/mtd/Kconfig Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-27JFFS2: add UBI supportArtem Bityutskiy
This patch make JFFS2 able to work with UBI volumes via the emulated MTD devices which are directly mapped to these volumes. Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
2007-04-25[JFFS2] Tidy up licensing/copyright boilerplate.David Woodhouse
In particular, remove the bit in the LICENCE file about contacting Red Hat for alternative arrangements. Their errant IS department broke that arrangement a long time ago -- the policy of collecting copyright assignments from contributors came to an end when the plug was pulled on the servers hosting the project, without notice or reason. We do still dual-license it for use with eCos, with the GPL+exception licence approved by the FSF as being GPL-compatible. It's just that nobody has the right to license it differently. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-23[JFFS2] Fix cross-endian build.David Woodhouse
When compiling a LE-capable JFFS2 on PowerPC, wbuf.c fails to compile: fs/jffs2/wbuf.c:973: error: braced-group within expression allowed only inside a function fs/jffs2/wbuf.c:973: error: initializer element is not constant fs/jffs2/wbuf.c:973: error: (near initialization for ‘oob_cleanmarker.magic’) fs/jffs2/wbuf.c:974: error: braced-group within expression allowed only inside a function fs/jffs2/wbuf.c:974: error: initializer element is not constant fs/jffs2/wbuf.c:974: error: (near initialization for ‘oob_cleanmarker.nodetype’) fs/jffs2/wbuf.c:975: error: braced-group within expression allowed only inside a function fs/jffs2/wbuf.c:976: error: initializer element is not constant fs/jffs2/wbuf.c:976: error: (near initialization for ‘oob_cleanmarker.totlen’) Provide constant_cpu_to_je{16,32} functions, and use them for initialising the offending structure. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17[JFFS2] Disable summary after wbuf recoveryAdrian Hunter
After a write error, any data in the write buffer must be relocated. This is handled by the jffs2_wbuf_recover function. This function does not fix up the erase block summary information that is collected for writing at the end of the block, which results in an incorrect summary (or BUG if the summary was found to be empty). As the summary is not essential (it is an optimisation), it may be disabled for the current erase block when this situation arises. This patch does that. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-09[JFFS2] print a message when marking bad blockArtem Bityutskiy
New bad eraseblock is an event which is important enough to be printed about. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-08[JFFS2] Fix writebuffer recovery in the first page of a blockVitaly Wool
For the case when nand_write_page fail with -EIO for the first page in an eraseblock, jffs2_wbuf_recover ends up producing a BUG in jffs2_block_refile as jeb->first_node is not yet set up (it's set up later in jffs2_wbuf_recover). This BUG is not really a bug; it's just jffs2_wbuf_recover calling jffs2_block_refile with the wrong second parameter. This patch takes care of this situation. Signed-off-by: Vitaly Wool <vwool@ru.mvista.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18[JFFS2] printk warning fixesAndrew Morton
fs/jffs2/wbuf.c: In function 'jffs2_check_oob_empty': fs/jffs2/wbuf.c:993: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' fs/jffs2/wbuf.c:993: warning: format '%d' expects type 'int', but argument 4 has type 'size_t' fs/jffs2/wbuf.c: In function 'jffs2_check_nand_cleanmarker': fs/jffs2/wbuf.c:1036: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' fs/jffs2/wbuf.c:1036: warning: format '%d' expects type 'int', but argument 4 has type 'size_t' fs/jffs2/wbuf.c: In function 'jffs2_write_nand_cleanmarker': fs/jffs2/wbuf.c:1062: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' fs/jffs2/wbuf.c:1062: warning: format '%d' expects type 'int', but argument 4 has type 'size_t' Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09[JFFS2] Use MTD_OOB_AUTO to automatically place cleanmarker on NANDArtem Bityutskiy
Nowadays MTD supports an MTD_OOB_AUTO option which allows users to access free bytes in NAND's OOB as a contiguous buffer, although it may be highly discontinuous. This patch teaches JFFS2 to use this nice feature instead of the old MTD_OOB_PLACE option. This for example caused problems with OneNAND. Now JFFS2 does not care how are the free bytes situated. This may change position of the clean marker on some flashes, but this is not a problem. JFFS2 will just re-erase the empty eraseblocks and write the new (correct) clean marker. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-01-18Merge branch 'master' of ↵David Woodhouse
2006-12-04[PATCH] severing fs.h, radix-tree.h -> sched.hAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2006-11-28[MTD] [NAND] remove len/ooblen confusion.Vitaly Wool
As was discussed between Ricard Wanderlöf, David Woodhouse, Artem Bityutskiy and me, the current API for reading/writing OOB is confusing. The thing that introduces confusion is the need to specify ops.len together with ops.ooblen for reads/writes that concern only OOB not data area. So, ops.len is overloaded: when ops.datbuf != NULL it serves to specify the length of the data read, and when ops.datbuf == NULL, it serves to specify the full OOB read length. The patch inlined below is the slightly updated version of the previous patch serving the same purpose, but with the new Artem's comments taken into account. Artem, BTW, thanks a lot for your valuable input! Signed-off-by: Vitaly Wool <vwool@ru.mvista.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-26[PATCH] fs: use list_move()Akinobu Mita
This patch converts the combination of list_del(A) and list_add(A, B) to list_move(A, B) under fs/. Cc: Ian Kent <raven@themaw.net> Acked-by: Joel Becker <joel.becker@oracle.com> Cc: Neil Brown <neilb@cse.unsw.edu.au> Cc: Hans Reiser <reiserfs-dev@namesys.com> Cc: Urban Widmark <urban@teststation.com> Acked-by: David Howells <dhowells@redhat.com> Acked-by: Mark Fasheh <mark.fasheh@oracle.com> Signed-off-by: Akinobu Mita <mita@miraclelinux.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-29[MTD] NAND Signal that a bitflip was corrected by ECCThomas Gleixner
Return -EUCLEAN on read when a bitflip was detected and corrected, so the clients can react and eventually copy the affected block to a spare one. Make all in kernel users aware of the change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-29[MTD] Rework the out of band handling completelyThomas Gleixner
Hopefully the last iteration on this! The handling of out of band data on NAND was accompanied by tons of fruitless discussions and halfarsed patches to make it work for a particular problem. Sufficiently annoyed by I all those "I know it better" mails and the resonable amount of discarded "it solves my problem" patches, I finally decided to go for the big rework. After removing the _ecc variants of mtd read/write functions the solution to satisfy the various requirements was to refactor the read/write _oob functions in mtd. The major change is that read/write_oob now takes a pointer to an operation descriptor structure "struct mtd_oob_ops".instead of having a function with at least seven arguments. read/write_oob which should probably renamed to a more descriptive name, can do the following tasks: - read/write out of band data - read/write data content and out of band data - read/write raw data content and out of band data (ecc disabled) struct mtd_oob_ops has a mode field, which determines the oob handling mode. Aside of the MTD_OOB_RAW mode, which is intended to be especially for diagnostic purposes and some internal functions e.g. bad block table creation, the other two modes are for mtd clients: MTD_OOB_PLACE puts/gets the given oob data exactly to/from the place which is described by the ooboffs and ooblen fields of the mtd_oob_ops strcuture. It's up to the caller to make sure that the byte positions are not used by the ECC placement algorithms. MTD_OOB_AUTO puts/gets the given oob data automaticaly to/from the places in the out of band area which are described by the oobfree tuples in the ecclayout data structre which is associated to the devicee. The decision whether data plus oob or oob only handling is done depends on the setting of the datbuf member of the data structure. When datbuf == NULL then the internal read/write_oob functions are selected, otherwise the read/write data routines are invoked. Tested on a few platforms with all variants. Please be aware of possible regressions for your particular device / application scenario Disclaimer: Any whining will be ignored from those who just contributed "hot air blurb" and never sat down to tackle the underlying problem of the mess in the NAND driver grown over time and the big chunk of work to fix up the existing users. The problem was not the holiness of the existing MTD interfaces. The problems was the lack of time to go for the big overhaul. It's easy to add more mess to the existing one, but it takes alot of effort to go for a real solution. Improvements and bugfixes are welcome! Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-29[MTD] NAND Replace oobinfo by ecclayoutThomas Gleixner
The nand_oobinfo structure is not fitting the newer error correction demands anymore. Replace it by struct nand_ecclayout and fixup the users all over the place. Keep the nand_oobinfo based ioctl for user space compability reasons. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-29[MTD] NAND Consolidate oobinfo handlingThomas Gleixner
The info structure for out of band data was copied into the mtd structure. Make it a pointer and remove the ability to set it from userspace. The position of ecc bytes is defined by the hardware and should not be changed by software. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-27[JFFS2] Fix wbuf recovery of f->metadata->raw node.David Woodhouse
A data node might not be in the fraglist; it could be f->metadata. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-26[JFFS2] Switch to using an array of jffs2_raw_node_refs instead of a list.David Woodhouse
This allows us to drop another pointer from the struct jffs2_raw_node_ref, shrinking it to 8 bytes on 32-bit machines (if the TEST_TOTLEN) paranoia check is turned off, which will be committed soon). Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-25[JFFS2] Add 'jeb' argument to jffs2_prealloc_raw_node_refs()David Woodhouse
Preallocation of refs is shortly going to be a per-eraseblock thing, rather than per-filesystem. Add the required argument to the function. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-24Merge branch 'master' of git://git.infradead.org/~gleixner/mtd-nand-2.6.gitDavid Woodhouse
2006-05-24[JFFS2] Reduce visibility of raw_node_ref to upper layers of JFFS2 code.David Woodhouse
As the first step towards eliminating the ref->next_phys member and saving memory by using an _array_ of struct jffs2_raw_node_ref per eraseblock, stop the write functions from allocating their own refs; have them just _reserve_ the appropriate number instead. Then jffs2_link_node_ref() can just fill them in. Use a linked list of pre-allocated refs in the superblock, for now. Once we switch to an array, it'll just be a case of extending that array. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-23[MTD] Remove read/write _ecc variantsThomas Gleixner
MTD clients are agnostic of FLASH which needs ECC suppport. Remove the functions and fixup the callers. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23Merge branch 'master' of /home/tglx/work/kernel/git/mtd-2.6/Thomas Gleixner
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23[JFFS2] Simplify writebuffer handlingThomas Gleixner
The writev based write buffer implementation was far to complex as in most use cases the write buffer had to be handled anyway. Simplify the write buffer handling and use mtd->write instead. From extensive testing no performance impact has been noted. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23[JFFS2] Remove flash offset argument from various functions.David Woodhouse
We don't need the upper layers to deal with the physical offset. It's _always_ c->nextblock->offset + c->sector_size - c->nextblock->free_size so we might as well just let the actual write functions deal with that. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-22[MTD] Merge STMicro NOR_ECC code with Intel Sibley codeJoern Engel
In 2002, STMicro started producing NOR flashes with internal ECC protection for small blocks (8 or 16 bytes). Support for those flashes was added by me. In 2005, Intel Sibley flashes copied this strategy and Nico added support for those. Merge the code for both. Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
2006-05-22[MTD] Introduce writesizeJoern Engel
At least two flashes exists that have the concept of a minimum write unit, similar to NAND pages, but no other NAND characteristics. Therefore, rename the minimum write unit to "writesize" for all flashes, including NAND. Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
2006-05-22[JFFS2] Extend jffs2_link_node_ref() to link into per-inode list too.David Woodhouse
Let's avoid the potential for forgetting to set ref->next_in_ino, by doing it within jffs2_link_node_ref() instead. This highlights the ugliness of what we're currently doing with xattr_datum and xattr_ref structures -- we should find a nicer way of dealing with that. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-22[JFFS2] Initialise ref->next_in_ino when marking dirty space in wbuf flushDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-21[JFFS2] File node reference for wasted space when flushing wbufDavid Woodhouse
Next step in ongoing campaign to file a struct jffs2_raw_node_ref for every piece of dirty space in the system, so that __totlen can be killed off.... Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-21[JFFS2] Add length argument to jffs2_add_physical_node_ref()David Woodhouse
If __totlen is going away, we need to pass the length in separately. Also stop callers from needlessly setting ref->next_phys to NULL, since that's done for them... and since that'll also be going away soon. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2005-11-07Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6Linus Torvalds
Some manual fixups for clashing kfree() cleanups etc.
2005-11-07[PATCH] kfree cleanup: fsJesper Juhl
This is the fs/ part of the big kfree cleanup patch. Remove pointless checks for NULL prior to calling kfree() in fs/. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07[JFFS2] Clean up trailing white spacesThomas Gleixner
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-11-06[JFFS2] Fix dataflash supportArtem B. Bityutskiy
- assume wbuf may be of size which is not power of 2 - don't make strange assumption about not padding wbuf for DataFlash - use wbuf = DataFlash page and eraseblock >= 8 Dataflash pages From: Peter Menzebach <pm-mtd@mw-itcon.de> Acked-by: Artem B. Bityutskiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-11-06[JFFS2] Debug code simplification, update TODOArtem B. Bityutskiy
Simplify the debugging code further. Update the TODO list Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-11-06[JFFS2] Add erase block summary support (mount time improvement)Ferenc Havasi
The goal of summary is to speed up the mount time. Erase block summary (EBS) stores summary information at the end of every (closed) erase block. It is no longer necessary to scan all nodes separetly (and read all pages of them) just read this "small" summary, where every information is stored which is needed at mount time. This summary information is stored in a JFFS2_FEATURE_RWCOMPAT_DELETE. During the mount process if there is no summary info the orignal scan process will be executed. EBS works with NAND and NOR flashes, too. There is a user space tool called sumtool to generate this summary information for a JFFS2 image. Signed-off-by: Ferenc Havasi <havasi@inf.u-szeged.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-11-06[JFFS2] Teach JFFS2 about Sibley flashNicolas Pitre
Intels Sibley flash needs JFFS2 write buffer functionality Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-11-06[JFFS2] Debug code clean up - step 3Artem B. Bityutskiy
Various simplifiactions. printk format corrections. Convert more code to use the new debug functions. Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>