diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jffs2/wbuf.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index b9b700730dfe..dcb18e9a646e 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
@@ -968,8 +968,7 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c, | |||
968 | int oobsize = c->mtd->oobsize; | 968 | int oobsize = c->mtd->oobsize; |
969 | struct mtd_oob_ops ops; | 969 | struct mtd_oob_ops ops; |
970 | 970 | ||
971 | ops.len = NR_OOB_SCAN_PAGES * oobsize; | 971 | ops.ooblen = NR_OOB_SCAN_PAGES * oobsize; |
972 | ops.ooblen = oobsize; | ||
973 | ops.oobbuf = c->oobbuf; | 972 | ops.oobbuf = c->oobbuf; |
974 | ops.ooboffs = 0; | 973 | ops.ooboffs = 0; |
975 | ops.datbuf = NULL; | 974 | ops.datbuf = NULL; |
@@ -982,10 +981,10 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c, | |||
982 | return ret; | 981 | return ret; |
983 | } | 982 | } |
984 | 983 | ||
985 | if (ops.retlen < ops.len) { | 984 | if (ops.oobretlen < ops.ooblen) { |
986 | D1(printk(KERN_WARNING "jffs2_check_oob_empty(): Read OOB " | 985 | D1(printk(KERN_WARNING "jffs2_check_oob_empty(): Read OOB " |
987 | "returned short read (%zd bytes not %d) for block " | 986 | "returned short read (%zd bytes not %d) for block " |
988 | "at %08x\n", ops.retlen, ops.len, jeb->offset)); | 987 | "at %08x\n", ops.oobretlen, ops.ooblen, jeb->offset)); |
989 | return -EIO; | 988 | return -EIO; |
990 | } | 989 | } |
991 | 990 | ||
@@ -1004,7 +1003,7 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c, | |||
1004 | } | 1003 | } |
1005 | 1004 | ||
1006 | /* we know, we are aligned :) */ | 1005 | /* we know, we are aligned :) */ |
1007 | for (page = oobsize; page < ops.len; page += sizeof(long)) { | 1006 | for (page = oobsize; page < ops.ooblen; page += sizeof(long)) { |
1008 | long dat = *(long *)(&ops.oobbuf[page]); | 1007 | long dat = *(long *)(&ops.oobbuf[page]); |
1009 | if(dat != -1) | 1008 | if(dat != -1) |
1010 | return 1; | 1009 | return 1; |
@@ -1032,7 +1031,6 @@ int jffs2_check_nand_cleanmarker (struct jffs2_sb_info *c, | |||
1032 | return 2; | 1031 | return 2; |
1033 | } | 1032 | } |
1034 | 1033 | ||
1035 | ops.len = oobsize; | ||
1036 | ops.ooblen = oobsize; | 1034 | ops.ooblen = oobsize; |
1037 | ops.oobbuf = c->oobbuf; | 1035 | ops.oobbuf = c->oobbuf; |
1038 | ops.ooboffs = 0; | 1036 | ops.ooboffs = 0; |
@@ -1047,10 +1045,10 @@ int jffs2_check_nand_cleanmarker (struct jffs2_sb_info *c, | |||
1047 | return ret; | 1045 | return ret; |
1048 | } | 1046 | } |
1049 | 1047 | ||
1050 | if (ops.retlen < ops.len) { | 1048 | if (ops.oobretlen < ops.ooblen) { |
1051 | D1 (printk (KERN_WARNING "jffs2_check_nand_cleanmarker(): " | 1049 | D1 (printk (KERN_WARNING "jffs2_check_nand_cleanmarker(): " |
1052 | "Read OOB return short read (%zd bytes not %d) " | 1050 | "Read OOB return short read (%zd bytes not %d) " |
1053 | "for block at %08x\n", ops.retlen, ops.len, | 1051 | "for block at %08x\n", ops.oobretlen, ops.ooblen, |
1054 | jeb->offset)); | 1052 | jeb->offset)); |
1055 | return -EIO; | 1053 | return -EIO; |
1056 | } | 1054 | } |
@@ -1089,8 +1087,7 @@ int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, | |||
1089 | n.nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER); | 1087 | n.nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER); |
1090 | n.totlen = cpu_to_je32(8); | 1088 | n.totlen = cpu_to_je32(8); |
1091 | 1089 | ||
1092 | ops.len = c->fsdata_len; | 1090 | ops.ooblen = c->fsdata_len; |
1093 | ops.ooblen = c->fsdata_len;; | ||
1094 | ops.oobbuf = (uint8_t *)&n; | 1091 | ops.oobbuf = (uint8_t *)&n; |
1095 | ops.ooboffs = c->fsdata_pos; | 1092 | ops.ooboffs = c->fsdata_pos; |
1096 | ops.datbuf = NULL; | 1093 | ops.datbuf = NULL; |
@@ -1104,10 +1101,10 @@ int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, | |||
1104 | jeb->offset, ret)); | 1101 | jeb->offset, ret)); |
1105 | return ret; | 1102 | return ret; |
1106 | } | 1103 | } |
1107 | if (ops.retlen != ops.len) { | 1104 | if (ops.oobretlen != ops.ooblen) { |
1108 | D1(printk(KERN_WARNING "jffs2_write_nand_cleanmarker(): " | 1105 | D1(printk(KERN_WARNING "jffs2_write_nand_cleanmarker(): " |
1109 | "Short write for block at %08x: %zd not %d\n", | 1106 | "Short write for block at %08x: %zd not %d\n", |
1110 | jeb->offset, ops.retlen, ops.len)); | 1107 | jeb->offset, ops.oobretlen, ops.ooblen)); |
1111 | return -EIO; | 1108 | return -EIO; |
1112 | } | 1109 | } |
1113 | return 0; | 1110 | return 0; |