aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/wbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/wbuf.c')
-rw-r--r--fs/jffs2/wbuf.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index 4fac6dd53954..c556e85a565c 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -1,16 +1,14 @@
1/* 1/*
2 * JFFS2 -- Journalling Flash File System, Version 2. 2 * JFFS2 -- Journalling Flash File System, Version 2.
3 * 3 *
4 * Copyright (C) 2001-2003 Red Hat, Inc. 4 * Copyright © 2001-2007 Red Hat, Inc.
5 * Copyright (C) 2004 Thomas Gleixner <tglx@linutronix.de> 5 * Copyright © 2004 Thomas Gleixner <tglx@linutronix.de>
6 * 6 *
7 * Created by David Woodhouse <dwmw2@infradead.org> 7 * Created by David Woodhouse <dwmw2@infradead.org>
8 * Modified debugged and enhanced by Thomas Gleixner <tglx@linutronix.de> 8 * Modified debugged and enhanced by Thomas Gleixner <tglx@linutronix.de>
9 * 9 *
10 * For licensing information, see the file 'LICENCE' in this directory. 10 * For licensing information, see the file 'LICENCE' in this directory.
11 * 11 *
12 * $Id: wbuf.c,v 1.100 2005/09/30 13:59:13 dedekind Exp $
13 *
14 */ 12 */
15 13
16#include <linux/kernel.h> 14#include <linux/kernel.h>
@@ -345,6 +343,9 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
345 return; 343 return;
346 } 344 }
347 345
346 /* The summary is not recovered, so it must be disabled for this erase block */
347 jffs2_sum_disable_collecting(c->summary);
348
348 ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, nr_refile); 349 ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, nr_refile);
349 if (ret) { 350 if (ret) {
350 printk(KERN_WARNING "Failed to allocate node refs for wbuf recovery. Data loss ensues.\n"); 351 printk(KERN_WARNING "Failed to allocate node refs for wbuf recovery. Data loss ensues.\n");
@@ -967,9 +968,9 @@ exit:
967 968
968static const struct jffs2_unknown_node oob_cleanmarker = 969static const struct jffs2_unknown_node oob_cleanmarker =
969{ 970{
970 .magic = cpu_to_je16(JFFS2_MAGIC_BITMASK), 971 .magic = constant_cpu_to_je16(JFFS2_MAGIC_BITMASK),
971 .nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER), 972 .nodetype = constant_cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
972 .totlen = cpu_to_je32(8) 973 .totlen = constant_cpu_to_je32(8)
973}; 974};
974 975
975/* 976/*
@@ -1208,3 +1209,27 @@ int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c) {
1208void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) { 1209void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) {
1209 kfree(c->wbuf); 1210 kfree(c->wbuf);
1210} 1211}
1212
1213int jffs2_ubivol_setup(struct jffs2_sb_info *c) {
1214 c->cleanmarker_size = 0;
1215
1216 if (c->mtd->writesize == 1)
1217 /* We do not need write-buffer */
1218 return 0;
1219
1220 init_rwsem(&c->wbuf_sem);
1221
1222 c->wbuf_pagesize = c->mtd->writesize;
1223 c->wbuf_ofs = 0xFFFFFFFF;
1224 c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
1225 if (!c->wbuf)
1226 return -ENOMEM;
1227
1228 printk(KERN_INFO "JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n", c->wbuf_pagesize, c->sector_size);
1229
1230 return 0;
1231}
1232
1233void jffs2_ubivol_cleanup(struct jffs2_sb_info *c) {
1234 kfree(c->wbuf);
1235}