aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-27 16:16:10 -0400
committerThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-29 09:06:50 -0400
commit5bd34c091a044d130601370c370f84b1c59f1627 (patch)
tree8b08012a9a30186a8805d506f8438e2944f5f31b /fs/jffs2
parentff268fb8791cf18df536113355d7184007c269d9 (diff)
[MTD] NAND Replace oobinfo by ecclayout
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>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/jffs2_fs_sb.h2
-rw-r--r--fs/jffs2/wbuf.c51
2 files changed, 17 insertions, 36 deletions
diff --git a/fs/jffs2/jffs2_fs_sb.h b/fs/jffs2/jffs2_fs_sb.h
index 272fbea55192..506690cc9a78 100644
--- a/fs/jffs2/jffs2_fs_sb.h
+++ b/fs/jffs2/jffs2_fs_sb.h
@@ -107,7 +107,7 @@ struct jffs2_sb_info {
107 struct rw_semaphore wbuf_sem; /* Protects the write buffer */ 107 struct rw_semaphore wbuf_sem; /* Protects the write buffer */
108 108
109 /* Information about out-of-band area usage... */ 109 /* Information about out-of-band area usage... */
110 struct nand_oobinfo *oobinfo; 110 struct nand_ecclayout *ecclayout;
111 uint32_t badblock_pos; 111 uint32_t badblock_pos;
112 uint32_t fsdata_pos; 112 uint32_t fsdata_pos;
113 uint32_t fsdata_len; 113 uint32_t fsdata_len;
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index dc275cedfe4a..c6a62e162963 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -1140,18 +1140,9 @@ int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *
1140 return 1; 1140 return 1;
1141} 1141}
1142 1142
1143#define NAND_JFFS2_OOB16_FSDALEN 8
1144
1145static struct nand_oobinfo jffs2_oobinfo_docecc = {
1146 .useecc = MTD_NANDECC_PLACE,
1147 .eccbytes = 6,
1148 .eccpos = {0,1,2,3,4,5}
1149};
1150
1151
1152static int jffs2_nand_set_oobinfo(struct jffs2_sb_info *c) 1143static int jffs2_nand_set_oobinfo(struct jffs2_sb_info *c)
1153{ 1144{
1154 struct nand_oobinfo *oinfo = c->mtd->oobinfo; 1145 struct nand_ecclayout *oinfo = c->mtd->ecclayout;
1155 1146
1156 /* Do this only, if we have an oob buffer */ 1147 /* Do this only, if we have an oob buffer */
1157 if (!c->mtd->oobsize) 1148 if (!c->mtd->oobsize)
@@ -1161,33 +1152,23 @@ static int jffs2_nand_set_oobinfo(struct jffs2_sb_info *c)
1161 c->cleanmarker_size = 0; 1152 c->cleanmarker_size = 0;
1162 1153
1163 /* Should we use autoplacement ? */ 1154 /* Should we use autoplacement ? */
1164 if (oinfo && oinfo->useecc == MTD_NANDECC_AUTOPLACE) { 1155 if (!oinfo) {
1165 D1(printk(KERN_DEBUG "JFFS2 using autoplace on NAND\n")); 1156 D1(printk(KERN_DEBUG "JFFS2 on NAND. No autoplacment info found\n"));
1166 /* Get the position of the free bytes */ 1157 return -EINVAL;
1167 if (!oinfo->oobfree[0][1]) { 1158 }
1168 printk (KERN_WARNING "jffs2_nand_set_oobinfo(): Eeep. Autoplacement selected and no empty space in oob\n");
1169 return -ENOSPC;
1170 }
1171 c->fsdata_pos = oinfo->oobfree[0][0];
1172 c->fsdata_len = oinfo->oobfree[0][1];
1173 if (c->fsdata_len > 8)
1174 c->fsdata_len = 8;
1175 } else {
1176 /* This is just a legacy fallback and should go away soon */
1177 switch(c->mtd->ecctype) {
1178 case MTD_ECC_RS_DiskOnChip:
1179 printk(KERN_WARNING "JFFS2 using DiskOnChip hardware ECC without autoplacement. Fix it!\n");
1180 c->oobinfo = &jffs2_oobinfo_docecc;
1181 c->fsdata_pos = 6;
1182 c->fsdata_len = NAND_JFFS2_OOB16_FSDALEN;
1183 c->badblock_pos = 15;
1184 break;
1185 1159
1186 default: 1160 D1(printk(KERN_DEBUG "JFFS2 using autoplace on NAND\n"));
1187 D1(printk(KERN_DEBUG "JFFS2 on NAND. No autoplacment info found\n")); 1161 /* Get the position of the free bytes */
1188 return -EINVAL; 1162 if (!oinfo->oobfree[0].length) {
1189 } 1163 printk (KERN_WARNING "jffs2_nand_set_oobinfo(): Eeep."
1164 " Autoplacement selected and no empty space in oob\n");
1165 return -ENOSPC;
1190 } 1166 }
1167 c->fsdata_pos = oinfo->oobfree[0].offset;
1168 c->fsdata_len = oinfo->oobfree[0].length;
1169 if (c->fsdata_len > 8)
1170 c->fsdata_len = 8;
1171
1191 return 0; 1172 return 0;
1192} 1173}
1193 1174