summaryrefslogtreecommitdiffstats
path: root/fs/jffs2/scan.c
Commit message (Collapse)AuthorAgeFilesLines
* jffs2: Use pr_fmt and remove jffs: from formatsJoe Perches2012-03-271-3/+4
| | | | | | | | | | Use pr_fmt to prefix KBUILD_MODNAME to appropriate logging messages. Remove now unnecessary internal prefixes from formats. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* jffs2: Convert printks to pr_<level>Joe Perches2012-03-271-38/+46
| | | | | | | | | | | | | Use the more current logging style. Coalesce formats, align arguments. Convert uses of embedded function names to %s, __func__. A couple of long line checkpatch errors I don't care about exist. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* jffs2: Convert most D1/D2 macros to jffs2_dbgJoe Perches2012-03-271-52/+74
| | | | | | | | | | | | | | D1 and D2 macros are mostly uses to emit debugging messages. Convert the logging uses of D1 & D2 to jffs2_dbg(level, fmt, ...) to be a bit more consistent style with the rest of the kernel. All jffs2_dbg output is now at KERN_DEBUG where some of the previous uses were emitted at various KERN_<LEVEL>s. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* jffs2: fix typo in scan.cMasanari Iida2012-03-271-1/+1
| | | | | | | | | Correct spelling "scaning" to scanning" in fs/jffs2/scan.c Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* jffs2: remove direct mtd->point referenceArtem Bityutskiy2012-03-271-11/+9
| | | | | | | | Commit 10934478e44d9a5a7b16dadd89094fb608cf101e did not remove now useless "if (mtd->point)" check mistakingly - let's kill it now. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: do use mtd->point directlyArtem Bityutskiy2012-01-091-1/+1
| | | | | | | | Remove direct usage of the "mtd->point" function pointer. Instead, test the mtd_point() return code for '-EOPNOTSUPP'. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: introduce mtd_block_isbad interfaceArtem Bityutskiy2012-01-091-1/+1
| | | | | Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: introduce mtd_unpoint interfaceArtem Bityutskiy2012-01-091-2/+2
| | | | | Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: introduce mtd_point interfaceArtem Bityutskiy2012-01-091-2/+2
| | | | | Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* jffs2: Avoid unneeded 'if' before kfreeJesper Juhl2011-09-111-3/+1
| | | | | | | | | kfree() deals gracefully with NULL pointers, so it's pointless to test for one prior to calling it. This removes such a test from jffs2_scan_medium(). Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
* JFFS2: retry large buffer allocationsGrant Erickson2011-05-251-8/+11
| | | | | | | | | | | Replace direct call to kmalloc for a potentially large, contiguous buffer allocation with one to mtd_kmalloc_up_to which helps ensure the operation can succeed under low-memory, highly- fragmented situations albeit somewhat more slowly. Signed-off-by: Grant Erickson <marathon96@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* jffs2: Reduce excessive scan of empty blocksJoakim Tjernlund2010-10-251-6/+6
| | | | | | | | | | Scanning 1024 bytes to see if an EB is empty is a bit much. Lower it to 256 bytes and make sure the while loop is optimized. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* jffs2: Use jffs2_garbage_collect_trigger() to trigger pending erasesDavid Woodhouse2010-05-191-1/+3
| | | | | | This is now done in a GC pass; we don't need to trigger kupdated to do it. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* jffs2: fix another potential leak on error path in scan.cDavid Woodhouse2009-06-231-2/+2
| | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* jffs2: leaking jffs2_summary in function jffs2_scan_mediumChristian Engelmayer2009-06-151-2/+2
| | | | | | | | | | In case of an error returned by file_dirty() 's' is not freed as the cleanup path is skipped. Reported by Coverity. Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* [MTD][NOR] Add physical address to point() methodJared Hulbert2008-05-011-3/+4
| | | | | | | | | | | | 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>
* [JFFS2] Track parent inode for directories (for NFS export)David Woodhouse2008-05-011-1/+1
| | | | | | | | 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>
* [JFFS2] Handle dirents on the flash with embedded zero bytes in names.David Woodhouse2007-10-131-4/+11
| | | | | | | | | 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>
* [JFFS2] Fix unpoint lengthAndy Lowe2007-09-231-1/+1
| | | | | | | | | | 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>
* [JFFS2] Whitespace cleanups.David Woodhouse2007-07-101-1/+1
| | | | | | Convert many spaces to tabs; one or two other minor cosmetic fixes. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2] Deletion dirents should be REF_NORMAL, not REF_PRISTINE.David Woodhouse2007-06-291-1/+2
| | | | | | | Otherwise they'll never actually get garbage-collected. Noted by Jonathan Larmour. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2] Tidy up licensing/copyright boilerplate.David Woodhouse2007-04-251-3/+2
| | | | | | | | | | | | | | 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>
* [JFFS2] Better fix for all-zero node headersJoakim Tjernlund2007-04-251-11/+1
| | | | | | | | | | | 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>
* [JFFS2] Speed up mount for directly-mapped NOR flashJoakim Tjernlund2007-04-171-4/+11
| | | | | | | | | | | 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>
* [JFFS2] check node crc before doing anything elseThomas Gleixner2007-04-171-15/+15
| | | | | | | 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>
* [JFFS2] Check for all-zero node headersDavid Woodhouse2007-03-091-0/+9
| | | | | | | | 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>
* [JFFS2] Use MTD_OOB_AUTO to automatically place cleanmarker on NANDArtem Bityutskiy2007-02-091-3/+7
| | | | | | | | | | | | | | | | | 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>
* [JFFS2] Reschedule in loopsArtem Bityutskiy2007-01-101-0/+2
| | | | | | | 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>
* [JFFS2] Fix error-path leak in summary scanAmit Choudhary2007-01-021-0/+1
| | | | | | Signed-off-by: Amit Choudhary <amit2030@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2] replace kmalloc+memset with kzallocYan Burman2006-12-101-2/+1
| | | | | | | | 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>
* fs/jffs2/: make 2 functions staticAdrian Bunk2006-06-291-2/+2
| | | | | | | This patch makes two needlessly global functions static. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2][XATTR] rid unnecessary writing of delete marker.KaiGai Kohei2006-06-271-4/+2
| | | | | | | | | | | | | | | 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>
* [JFFS2][XATTR] using 'delete marker' for xdatum/xref deletionKaiGai Kohei2006-06-271-24/+33
| | | | | | | | | | | | | | | | | - 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>
* [JFFS2] Fix calculation of potential summary marker offset on NOR flash.David Woodhouse2006-05-301-1/+1
| | | | | | | Helps if we look _inside_ the buffer, rather than adding jeb->offset to it. Doh. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2] Preallocate raw_node_refs in a couple of missing places in scanDavid Woodhouse2006-05-291-2/+7
| | | | Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2] Fix 64-bit size_t problems in XATTR code.David Woodhouse2006-05-251-1/+1
| | | | Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2] Fix and improve debugging output during scan.David Woodhouse2006-05-251-3/+3
| | | | | | | Print wasted_size in scanned eraseblocks, print range correctly for summary dirent and inode entries. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2] Add 'jeb' argument to jffs2_prealloc_raw_node_refs()David Woodhouse2006-05-251-2/+2
| | | | | | | 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>
* [JFFS2] Allocate node_ref for wasted space when skipping to page boundaryDavid Woodhouse2006-05-251-5/+2
| | | | | | | 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>
* [JFFS2] Introduce ref_next() macro for finding next physical nodeDavid Woodhouse2006-05-241-2/+2
| | | | | | Another part of the preparation for switching to an array... Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [JFFS2] Reduce visibility of raw_node_ref to upper layers of JFFS2 code.David Woodhouse2006-05-241-63/+14
| | | | | | | | | | | | | 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>
* [JFFS2] Extend jffs2_link_node_ref() to link into per-inode list too.David Woodhouse2006-05-221-16/+8
| | | | | | | | | | | 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>
* [JFFS2] Discard remaining free space when filing a dirty block in scan.David Woodhouse2006-05-211-21/+26
| | | | | | | | 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>
* [JFFS2] Introduce jffs2_scan_dirty_space() function.David Woodhouse2006-05-211-24/+52
| | | | | | | | 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>
* [JFFS2] Fix memory leak in scan code; improve comments.David Woodhouse2006-05-211-2/+7
| | | | | | | | | | | | 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>
* [JFFS2] Correct handling of JFFS2_FEATURE_RWCOMPAT_COPY nodes.David Woodhouse2006-05-211-2/+13
| | | | | | | | | 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>
* [JFFS2] Introduce jffs2_link_node_ref() function to reduce code duplicationDavid Woodhouse2006-05-201-38/+11
| | | | | | | | 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>
* Merge git://git.infradead.org/jffs2-xattr-2.6David Woodhouse2006-05-201-0/+168
|\ | | | | | | Signed-off-by: David Woodhouse <dwmw2@infradead.org>
| * Merge git://git.infradead.org/mtd-2.6KaiGai Kohei2006-05-191-3/+3
| |\
| * | [JFFS2][XATTR] Remove 'struct list_head ilist' from jffs2_inode_cache.KaiGai Kohei2006-05-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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>
OpenPOWER on IntegriCloud