aboutsummaryrefslogtreecommitdiff
path: root/fs/jffs2/scan.c
AgeCommit message (Collapse)Author
2008-05-01[MTD][NOR] Add physical address to point() methodJared Hulbert
Adding the ability to get a physical address from point() in addition to virtual address. This physical address is required for XIP of userspace code from flash. Signed-off-by: Jared Hulbert <jaredeh@gmail.com> Reviewed-by: Jörn Engel <joern@logfs.org> Acked-by: Nicolas Pitre <nico@cam.org> Acked-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
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>
2007-10-13[JFFS2] Handle dirents on the flash with embedded zero bytes in names.David Woodhouse
In three places: summary scan, normal scan, REF_PRISTINE GC. Just truncate at the NUL, since that was the correct thing to do in the only case where this (inexplicable) breakage has been seen. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-09-23[JFFS2] Fix unpoint lengthAndy Lowe
Fix a couple of instances in JFFS2 where the unpoint() routine is being called with the wrong length in cases where the point() routine truncated a request. Signed-off-by: Andy Lowe <alowe@mvista.com> Signed-off-by: Nicolas Pitre <nico@cam.org> 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-06-29[JFFS2] Deletion dirents should be REF_NORMAL, not REF_PRISTINE.David Woodhouse
Otherwise they'll never actually get garbage-collected. Noted by Jonathan Larmour. Signed-off-by: David Woodhouse <dwmw2@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-25[JFFS2] Better fix for all-zero node headersJoakim Tjernlund
No need to check for all-zero header since the header cannot be zero due to other checks. Replace the all-zero header check in readinode.c with a check for the magic word. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17[JFFS2] Speed up mount for directly-mapped NOR flashJoakim Tjernlund
Remove excessive scanning of empty flash after a clean marker for users of the point/unpoint method. cfi_cmdset_0001 uses point/unpoint by default iff flash mapping is linear. The speedup is several orders of magnitude if FS is less than half full. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17[JFFS2] check node crc before doing anything elseThomas Gleixner
Check the node CRC on scan before doing anything else with the node. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-09[JFFS2] Check for all-zero node headersDavid Woodhouse
Due to a poor choice of CRC32 seed, a node header which is all zeroes would pass the CRC32 check. Explicitly check for this case, and treat it as we do a CRC failure. 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-10[JFFS2] Reschedule in loopsArtem Bityutskiy
Make JFFS2 nicer and teach it to call cond_resched() in loops which may be quite large. Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
2007-01-02[JFFS2] Fix error-path leak in summary scanAmit Choudhary
Signed-off-by: Amit Choudhary <amit2030@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-10[JFFS2] replace kmalloc+memset with kzallocYan Burman
Replace kmalloc+memset with kzalloc Signed-off-by: Yan Burman <burman.yan@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-29fs/jffs2/: make 2 functions staticAdrian Bunk
This patch makes two needlessly global functions static. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-27[JFFS2][XATTR] rid unnecessary writing of delete marker.KaiGai Kohei
In the followinf situation, an explicit delete marker is not necessary, because we can certainlly detect those obsolete xattr_datum or xattr_ref on next mounting. - When to delete xattr_datum node. - When to delete xattr_ref node on removing inode. - When to delete xattr_ref node on updating xattr. This patch rids writing delete marker in those situations. Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-27[JFFS2][XATTR] using 'delete marker' for xdatum/xref deletionKaiGai Kohei
- When xdatum is removed, a new xdatum with 'delete marker' is written. (version==0xffffffff means 'delete marker') - When xref is removed, a new xref with 'delete marker' is written. (odd-numbered xseqno means 'delete marker') - delete_xattr_(datum/xref)_delay() are new deletion functions are added. We can only use them if we can detect the target obsolete xdatum/xref as a orphan or errir one. (e.g when inode deletion, or detecting crc error) [1/3] jffs2-xattr-v6-01-delete_marker.patch Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-30[JFFS2] Fix calculation of potential summary marker offset on NOR flash.David Woodhouse
Helps if we look _inside_ the buffer, rather than adding jeb->offset to it. Doh. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-29[JFFS2] Preallocate raw_node_refs in a couple of missing places in scanDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-25[JFFS2] Fix 64-bit size_t problems in XATTR code.David Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-25[JFFS2] Fix and improve debugging output during scan.David Woodhouse
Print wasted_size in scanned eraseblocks, print range correctly for summary dirent and inode entries. 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-25[JFFS2] Allocate node_ref for wasted space when skipping to page boundaryDavid Woodhouse
One more place where we were changing the accounting info without actually allocating a ref for the lost space... Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-24[JFFS2] Introduce ref_next() macro for finding next physical nodeDavid Woodhouse
Another part of the preparation for switching to an array... Signed-off-by: David Woodhouse <dwmw2@infradead.org>
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-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-21[JFFS2] Discard remaining free space when filing a dirty block in scan.David Woodhouse
The incoming ref_totlen() calculation is going to rely on the existence of nodes which cover all dirty space. We can't just tweak the accounting data any more; we have to call jffs2_scan_dirty_space() to do it. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-21[JFFS2] Introduce jffs2_scan_dirty_space() function.David Woodhouse
To eliminate the __totlen field from struct jffs2_raw_node_ref, we need to allocate nodes for dirty space instead of just tweaking the accounting data. Introduce jffs2_scan_dirty_space() in preparation for that. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-21[JFFS2] Fix memory leak in scan code; improve comments.David Woodhouse
If we had to allocate extra space for the summary node, we weren't correctly freeing it when jffs2_sum_scan_sumnode() returned nonzero -- which is both the success and the failure case. Only when it returned zero, which means fall through to the full scan, were we correctly freeing the buffer. Document the meaning of those return codes while we're at it. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-21[JFFS2] Correct handling of JFFS2_FEATURE_RWCOMPAT_COPY nodes.David Woodhouse
We should preserve these when we come to garbage collect them, not let them get erased. Use jffs2_garbage_collect_pristine() for this, and make sure the summary code copes -- just refrain from writing a summary for any block which contains a node we don't understand. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-20[JFFS2] Introduce jffs2_link_node_ref() function to reduce code duplicationDavid Woodhouse
The same sequence of code was repeated in many places, to add a new struct jffs2_raw_node_ref to an eraseblock and adjust the space accounting accordingly. Move it out-of-line. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-20Merge git://git.infradead.org/jffs2-xattr-2.6David Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-20[JFFS2] Optimise reading of eraseblock summary nodesDavid Woodhouse
This improves the time to mount 512MiB of NAND flash on my OLPC prototype by about 4%. We used to read the last page of the eraseblock twice -- once to find the offset of the summary node, and again to actually _read_ the summary node. Now we read the last page only once, and read more only if we need to. We also don't allocate a new buffer just for the summary code -- we use the buffer which was already allocated for the scan. Better still, if the 'buffer' for the scan is actually just a pointer directly into NOR flash, we use that too, avoiding the memcpy() which we used to do. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-19[JFFS2] Remove forgotten summary codeFerenc Havasi
Remove forgotten lines from jffs2_scan_eraseblock() which were unnecessary and may cause problem in some environments. Thanks to Alexander Belyakov <alexander.belyakov@intel.com>. Signed-off-by: Ferenc Havasi <havasi@inf.u-szeged.hu> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-19Merge git://git.infradead.org/mtd-2.6KaiGai Kohei
2006-05-15[PATCH] jffs2: memory leak in jffs2_scan_medium()Florin Malita
If jffs2_scan_eraseblock() fails and the exit path is taken, 's' is not being deallocated. Reported by Coverity, CID: 1258. Signed-off-by: Florin Malita <fmalita@gmail.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-13[JFFS2][XATTR] Remove 'struct list_head ilist' from jffs2_inode_cache.KaiGai Kohei
This patch can reduce 4-byte of memory usage per inode_cache. [4/10] jffs2-xattr-v5.1-04-remove_ilist_from_ic.patch Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com>
2006-05-13[JFFS2][XATTR] XATTR support on JFFS2 (version. 5)KaiGai Kohei
This attached patches provide xattr support including POSIX-ACL and SELinux support on JFFS2 (version.5). There are some significant differences from previous version posted at last December. The biggest change is addition of EBS(Erase Block Summary) support. Currently, both kernel and usermode utility (sumtool) can recognize xattr nodes which have JFFS2_NODETYPE_XATTR/_XREF nodetype. In addition, some bugs are fixed. - A potential race condition was fixed. - Unexpected fail when updating a xattr by same name/value pair was fixed. - A bug when removing xattr name/value pair was fixed. The fundamental structures (such as using two new nodetypes and exclusion mechanism by rwsem) are unchanged. But most of implementation were reviewed and updated if necessary. Espacially, we had to change several internal implementations related to load_xattr_datum() to avoid a potential race condition. [1/2] xattr_on_jffs2.kernel.version-5.patch [2/2] xattr_on_jffs2.utils.version-5.patch Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-03-08[PATCH] jffs2: avoid divide-by-zeroDavid Woodhouse
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-13[JFFS2] Remove broken and useless debug codeThomas Gleixner
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
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] 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>
2005-11-06[JFFS2] Debug code clean up - step 1Artem B. Bityutskiy
Move debug functions into a seperate source file Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23[JFFS2] Fix node lookupArtem B. Bityuckiy
Look the ref->next_phys field instead of ->next_in_ino to determine if the block has more then one node. Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23[JFFS2] Use a single config option for write buffer supportAndrew Victor
This patch replaces the current CONFIG_JFFS2_FS_NAND, CONFIG_JFFS2_FS_NOR_ECC and CONFIG_JFFS2_FS_DATAFLASH with a single configuration option - CONFIG_JFFS2_FS_WRITEBUFFER. The only functional change of this patch is that the slower div/mod calculations for SECTOR_ADDR(), PAGE_DIV() and PAGE_MOD() are now always used when CONFIG_JFFS2_FS_WRITEBUFFER is enabled. Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23[JFFS2] Add support for JFFS2-on-Dataflash devices.Andrew Victor
For Dataflash, can_mark_obsolete = false and the NAND write buffering code (wbuf.c) is used. Since the DataFlash chip will automatically erase pages when writing, the cleanmarkers are not needed - so cleanmarker_oob = false and cleanmarker_size = 0 DataFlash page-sizes are not a power of two (they're multiples of 528 bytes). The SECTOR_ADDR macro (added in the previous core patch) is replaced with a (slower) div/mod version if CONFIG_JFFS2_FS_DATAFLASH is selected. Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>