diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/ext4_common.h | 10 | ||||
-rw-r--r-- | fs/jffs2/Kconfig | 4 | ||||
-rw-r--r-- | fs/jffs2/build.c | 2 | ||||
-rw-r--r-- | fs/jffs2/compr.c | 2 | ||||
-rw-r--r-- | fs/jffs2/compr_rubin.c | 2 | ||||
-rw-r--r-- | fs/jffs2/compr_zlib.c | 2 | ||||
-rw-r--r-- | fs/jffs2/debug.c | 2 | ||||
-rw-r--r-- | fs/jffs2/dir.c | 2 | ||||
-rw-r--r-- | fs/jffs2/fs.c | 13 | ||||
-rw-r--r-- | fs/jffs2/jffs2_fs_sb.h | 16 | ||||
-rw-r--r-- | fs/jffs2/malloc.c | 2 | ||||
-rw-r--r-- | fs/jffs2/nodelist.c | 2 | ||||
-rw-r--r-- | fs/jffs2/nodelist.h | 8 | ||||
-rw-r--r-- | fs/jffs2/os-linux.h | 87 | ||||
-rw-r--r-- | fs/jffs2/read.c | 2 | ||||
-rw-r--r-- | fs/jffs2/readinode.c | 2 | ||||
-rw-r--r-- | fs/jffs2/scan.c | 61 | ||||
-rw-r--r-- | fs/jffs2/super.c | 6 |
18 files changed, 45 insertions, 180 deletions
diff --git a/fs/ext4/ext4_common.h b/fs/ext4/ext4_common.h index f8ebd76266..3286a21c0e 100644 --- a/fs/ext4/ext4_common.h +++ b/fs/ext4/ext4_common.h @@ -36,15 +36,7 @@ #include "ext4fs.h" #include "ext_common.h" -static inline void *zalloc(size_t size) -{ - void *p = dma_alloc(size); - - if (p) - memset(p, 0, size); - - return p; -} +#define zalloc dma_zalloc int ext4fs_read_inode(struct ext2_data *data, int ino, struct ext2_inode *inode); diff --git a/fs/jffs2/Kconfig b/fs/jffs2/Kconfig index 329e7b806a..76f2a9f70a 100644 --- a/fs/jffs2/Kconfig +++ b/fs/jffs2/Kconfig @@ -20,7 +20,7 @@ config FS_JFFS2_COMPRESSION_OPTIONS compression modules, if any, are enabled in JFFS2. Removing compressors can mean you cannot read existing file systems, and enabling experimental compressors can mean that you - write a file system which cannot be read by a standard kernel. + write a file system which cannot be read by the bootloader. If unsure, you should _definitely_ say 'N'. @@ -30,6 +30,8 @@ config FS_JFFS2_COMPRESSION_ZLIB bool select ZLIB prompt "ZLIB compression support" + help + Enable zlib, if compression type 0x06 is missed at run-time. config FS_JFFS2_COMPRESSION_LZO bool diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c index d5757d100b..3871547b99 100644 --- a/fs/jffs2/build.c +++ b/fs/jffs2/build.c @@ -8,7 +8,7 @@ * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/fs/jffs2/compr.c b/fs/jffs2/compr.c index 04b014199f..a056be051c 100644 --- a/fs/jffs2/compr.c +++ b/fs/jffs2/compr.c @@ -9,7 +9,7 @@ * * Created by Arjan van de Ven <arjan@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include "compr.h" diff --git a/fs/jffs2/compr_rubin.c b/fs/jffs2/compr_rubin.c index 91a500f4fb..913276d986 100644 --- a/fs/jffs2/compr_rubin.c +++ b/fs/jffs2/compr_rubin.c @@ -8,7 +8,7 @@ * Created by Arjan van de Ven <arjanv@redhat.com> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <linux/string.h> #include <linux/types.h> diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c index 2b7914f1f5..0580bab0de 100644 --- a/fs/jffs2/compr_zlib.c +++ b/fs/jffs2/compr_zlib.c @@ -7,7 +7,7 @@ * * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <linux/kernel.h> #include <linux/zlib.h> diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c index edf8539762..4ac501e2de 100644 --- a/fs/jffs2/debug.c +++ b/fs/jffs2/debug.c @@ -8,7 +8,7 @@ * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <crc.h> diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 34f8d141f2..94ef51f778 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c @@ -7,7 +7,7 @@ * * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <linux/fs.h> #include <linux/hash.h> diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 6f2cbff6c9..f65cd62585 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -7,7 +7,7 @@ * * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <crc.h> #include <driver.h> @@ -269,17 +269,6 @@ int jffs2_do_fill_super(struct super_block *sb, int silent) c = JFFS2_SB_INFO(sb); -#ifndef CONFIG_JFFS2_FS_WRITEBUFFER - if (c->mtd->type == MTD_NANDFLASH) { - pr_err("Cannot operate on NAND flash unless jffs2 NAND support is compiled in"); - return -EINVAL; - } - if (c->mtd->type == MTD_DATAFLASH) { - pr_err("Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in"); - return -EINVAL; - } -#endif - c->flash_size = c->mtd->size; c->sector_size = c->mtd->erasesize; blocks = c->flash_size / c->sector_size; diff --git a/fs/jffs2/jffs2_fs_sb.h b/fs/jffs2/jffs2_fs_sb.h index 20fa9a26a4..9e35a142e4 100644 --- a/fs/jffs2/jffs2_fs_sb.h +++ b/fs/jffs2/jffs2_fs_sb.h @@ -120,22 +120,6 @@ struct jffs2_sb_info { uint32_t wbuf_pagesize; /* 0 for NOR and other flashes with no wbuf */ -#ifdef CONFIG_JFFS2_FS_WBUF_VERIFY - unsigned char *wbuf_verify; /* read-back buffer for verification */ -#endif -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - unsigned char *wbuf; /* Write-behind buffer for NAND flash */ - uint32_t wbuf_ofs; - uint32_t wbuf_len; - struct jffs2_inodirty *wbuf_inodes; - struct rw_semaphore wbuf_sem; /* Protects the write buffer */ - - struct delayed_work wbuf_dwork; /* write-buffer write-out work */ - - unsigned char *oobbuf; - int oobavail; /* How many bytes are available for JFFS2 in OOB */ -#endif - struct jffs2_summary *summary; /* Summary information */ struct jffs2_mount_opts mount_opts; diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c index 202191be94..e0e29fa648 100644 --- a/fs/jffs2/malloc.c +++ b/fs/jffs2/malloc.c @@ -7,7 +7,7 @@ * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <linux/kernel.h> diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c index 94753e1995..debf10e751 100644 --- a/fs/jffs2/nodelist.c +++ b/fs/jffs2/nodelist.c @@ -7,7 +7,7 @@ * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <crc.h> diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index b5f7716ce2..d8687319c7 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h @@ -489,14 +489,6 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c); int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count); void jffs2_free_jeb_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER -/* wbuf.c */ -int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino); -int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c); -int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -#endif - #include "debug.h" #endif /* __JFFS2_NODELIST_H__ */ diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index 29915715bb..9c1c05eb6c 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h @@ -11,6 +11,8 @@ #ifndef __JFFS2_OS_LINUX_H__ #define __JFFS2_OS_LINUX_H__ +#include <linux/mtd/mtd.h> + /* JFFS2 uses Linux mode bits natively -- no need for conversion */ #define os_to_jffs2_mode(x) (x) #define jffs2_to_os_mode(x) (x) @@ -67,11 +69,29 @@ struct jffs2_file { unsigned int offset; }; -#define jffs2_is_readonly(c) (OFNI_BS_2SFFJ(c)->s_flags & SB_RDONLY) +/* Read-only support */ +#define jffs2_is_readonly(c) (1) #define SECTOR_ADDR(x) ( (((unsigned long)(x) / c->sector_size) * c->sector_size) ) -#ifndef CONFIG_JFFS2_FS_WRITEBUFFER +/** + * Read data from memory and ignore any hints about bitflips in case of NAND + * memory (because we cannot repair them). + */ +static inline int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *retlen, u_char *buf) +{ + int rc = mtd_read((c)->mtd, ofs, len, retlen, buf); + if (rc == -EUCLEAN) + return 0; // we are read-only, we cannot repair anything. + + return rc; +} + +/* support run-time speed-up while scanning NAND flashs */ +#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH) +/* no write buffer, due to read-only suppport */ +#define jffs2_wbuf_dirty(c) (0) +#define jffs2_is_writebuffered(c) (0) #ifdef CONFIG_JFFS2_SUMMARY #define jffs2_can_mark_obsolete(c) (0) @@ -79,74 +99,19 @@ struct jffs2_file { #define jffs2_can_mark_obsolete(c) (1) #endif -#define jffs2_is_writebuffered(c) (0) -#define jffs2_cleanmarker_oob(c) (0) -#define jffs2_write_nand_cleanmarker(c,jeb) (-EIO) - -#define jffs2_flash_write(c, ofs, len, retlen, buf) jffs2_flash_direct_write(c, ofs, len, retlen, buf) -#define jffs2_flash_read(c, ofs, len, retlen, buf) (mtd_read((c)->mtd, ofs, len, retlen, buf)) -#define jffs2_flush_wbuf_pad(c) ({ do{} while(0); (void)(c), 0; }) -#define jffs2_flush_wbuf_gc(c, i) ({ do{} while(0); (void)(c), (void) i, 0; }) -#define jffs2_write_nand_badblock(c,jeb,bad_offset) (1) #define jffs2_nand_flash_setup(c) (0) #define jffs2_nand_flash_cleanup(c) do {} while(0) -#define jffs2_wbuf_dirty(c) (0) -#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_dataflash(c) (0) #define jffs2_dataflash_setup(c) (0) #define jffs2_dataflash_cleanup(c) do {} while (0) -#define jffs2_nor_wbuf_flash(c) (0) -#define jffs2_nor_wbuf_flash_setup(c) (0) -#define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0) + #define jffs2_ubivol(c) (0) #define jffs2_ubivol_setup(c) (0) #define jffs2_ubivol_cleanup(c) do {} while (0) -#define jffs2_dirty_trigger(c) do {} while (0) - -#else /* NAND and/or ECC'd NOR support present */ - -#define jffs2_is_writebuffered(c) (c->wbuf != NULL) -#ifdef CONFIG_JFFS2_SUMMARY -#define jffs2_can_mark_obsolete(c) (0) -#else -#define jffs2_can_mark_obsolete(c) (c->mtd->flags & (MTD_BIT_WRITEABLE)) -#endif - -#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH) - -#define jffs2_wbuf_dirty(c) (!!(c)->wbuf_len) - -/* wbuf.c */ -int jffs2_flash_writev(struct jffs2_sb_info *c, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen, uint32_t ino); -int jffs2_flash_write(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *retlen, const u_char *buf); -int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *retlen, u_char *buf); -int jffs2_check_oob_empty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,int mode); -int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t bad_offset); -void jffs2_wbuf_timeout(unsigned long data); -void jffs2_wbuf_process(void *data); -int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino); -int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c); -int jffs2_nand_flash_setup(struct jffs2_sb_info *c); -void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c); - -#define jffs2_dataflash(c) (c->mtd->type == MTD_DATAFLASH) -int jffs2_dataflash_setup(struct jffs2_sb_info *c); -void jffs2_dataflash_cleanup(struct jffs2_sb_info *c); -#define jffs2_ubivol(c) (c->mtd->type == MTD_UBIVOLUME) -int jffs2_ubivol_setup(struct jffs2_sb_info *c); -void jffs2_ubivol_cleanup(struct jffs2_sb_info *c); - -#define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE)) -int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c); -void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c); -void jffs2_dirty_trigger(struct jffs2_sb_info *c); - -#endif /* WRITEBUFFER */ +#define jffs2_nor_wbuf_flash(c) (0) +#define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0) /* background.c */ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c); diff --git a/fs/jffs2/read.c b/fs/jffs2/read.c index a1c3b9d47b..fffa5f60cb 100644 --- a/fs/jffs2/read.c +++ b/fs/jffs2/read.c @@ -7,7 +7,7 @@ * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <crc.h> #include <linux/kernel.h> diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index aaf2619613..605130d60c 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c @@ -7,7 +7,7 @@ * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <crc.h> diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 0d74a8f51f..535c22d59d 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c @@ -7,7 +7,7 @@ * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <crc.h> #include <linux/kernel.h> @@ -47,12 +47,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo static inline int min_free(struct jffs2_sb_info *c) { uint32_t min = 2 * sizeof(struct jffs2_raw_inode); -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (!jffs2_can_mark_obsolete(c) && min < c->wbuf_pagesize) - return c->wbuf_pagesize; -#endif return min; - } static inline uint32_t EMPTY_SCAN_SIZE(uint32_t sector_size) { @@ -229,20 +224,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) c->dirty_size -= c->nextblock->dirty_size; c->nextblock->dirty_size = 0; } -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (!jffs2_can_mark_obsolete(c) && c->wbuf_pagesize && c->nextblock && (c->nextblock->free_size % c->wbuf_pagesize)) { - /* If we're going to start writing into a block which already - contains data, and the end of the data isn't page-aligned, - skip a little and align it. */ - - uint32_t skip = c->nextblock->free_size % c->wbuf_pagesize; - - jffs2_dbg(1, "%s(): Skipping %d bytes in nextblock to ensure page alignment\n", - __func__, skip); - jffs2_prealloc_raw_node_refs(c, c->nextblock, 1); - jffs2_scan_dirty_space(c, c->nextblock, skip); - } -#endif + if (c->nr_erasing_blocks) { if ( !c->used_size && ((c->nr_free_blocks+empty_blocks+bad_blocks)!= c->nr_blocks || bad_blocks == c->nr_blocks) ) { pr_notice("Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes\n"); @@ -424,37 +406,11 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo int err; int noise = 0; - -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - int cleanmarkerfound = 0; -#endif - ofs = jeb->offset; prevofs = jeb->offset - 1; jffs2_dbg(1, "%s(): Scanning block at 0x%x\n", __func__, ofs); -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (jffs2_cleanmarker_oob(c)) { - int ret; - - if (mtd_block_isbad(c->mtd, jeb->offset)) - return BLK_STATE_BADBLOCK; - - ret = jffs2_check_nand_cleanmarker(c, jeb); - jffs2_dbg(2, "jffs_check_nand_cleanmarker returned %d\n", ret); - - /* Even if it's not found, we still scan to see - if the block is empty. We use this information - to decide whether to erase it or not. */ - switch (ret) { - case 0: cleanmarkerfound = 1; break; - case 1: break; - default: return ret; - } - } -#endif - if (jffs2_sum_active()) { struct jffs2_sum_marker *sm; void *sumptr = NULL; @@ -548,19 +504,6 @@ full_scan: ofs += 4; if (ofs == max_ofs) { -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (jffs2_cleanmarker_oob(c)) { - /* scan oob, take care of cleanmarker */ - int ret = jffs2_check_oob_empty(c, jeb, cleanmarkerfound); - jffs2_dbg(2, "jffs2_check_oob_empty returned %d\n", - ret); - switch (ret) { - case 0: return cleanmarkerfound ? BLK_STATE_CLEANMARKER : BLK_STATE_ALLFF; - case 1: return BLK_STATE_ALLDIRTY; - default: return ret; - } - } -#endif jffs2_dbg(1, "Block at 0x%08x is empty (erased)\n", jeb->offset); if (c->cleanmarker_size == 0) diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 37b3f328c6..b9a5b99744 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -7,7 +7,7 @@ * * Created by David Woodhouse <dwmw2@infradead.org> */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define pr_fmt(fmt) "jffs2: " fmt #include <common.h> #include <init.h> #include <linux/slab.h> @@ -106,9 +106,7 @@ static int __init init_jffs2_fs(void) BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); pr_info("JFFS version 2.2." -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - " (NAND)" -#endif + " (NAND ro)" #ifdef CONFIG_JFFS2_SUMMARY " (SUMMARY) " #endif |