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