aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs/jffs_fm.c3
-rw-r--r--fs/jffs2/nodelist.h10
-rw-r--r--fs/jffs2/super.c7
-rw-r--r--fs/jffs2/symlink.c2
-rw-r--r--fs/jffs2/wbuf.c21
-rw-r--r--fs/jffs2/xattr.c5
6 files changed, 22 insertions, 26 deletions
diff --git a/fs/jffs/jffs_fm.c b/fs/jffs/jffs_fm.c
index 29b68d939bd9..6aab317f56e0 100644
--- a/fs/jffs/jffs_fm.c
+++ b/fs/jffs/jffs_fm.c
@@ -17,6 +17,7 @@
17 * 17 *
18 */ 18 */
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/err.h>
20#include <linux/blkdev.h> 21#include <linux/blkdev.h>
21#include <linux/jffs.h> 22#include <linux/jffs.h>
22#include "jffs_fm.h" 23#include "jffs_fm.h"
@@ -104,7 +105,7 @@ jffs_build_begin(struct jffs_control *c, int unit)
104 105
105 mtd = get_mtd_device(NULL, unit); 106 mtd = get_mtd_device(NULL, unit);
106 107
107 if (!mtd) { 108 if (IS_ERR(mtd)) {
108 kfree(fmc); 109 kfree(fmc);
109 DJM(no_jffs_fmcontrol--); 110 DJM(no_jffs_fmcontrol--);
110 return NULL; 111 return NULL;
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index 0ddfd70307fb..4178b4b55948 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -294,23 +294,21 @@ static inline int jffs2_encode_dev(union jffs2_device_node *jdev, dev_t rdev)
294 294
295static inline struct jffs2_node_frag *frag_first(struct rb_root *root) 295static inline struct jffs2_node_frag *frag_first(struct rb_root *root)
296{ 296{
297 struct rb_node *node = root->rb_node; 297 struct rb_node *node = rb_first(root);
298 298
299 if (!node) 299 if (!node)
300 return NULL; 300 return NULL;
301 while(node->rb_left) 301
302 node = node->rb_left;
303 return rb_entry(node, struct jffs2_node_frag, rb); 302 return rb_entry(node, struct jffs2_node_frag, rb);
304} 303}
305 304
306static inline struct jffs2_node_frag *frag_last(struct rb_root *root) 305static inline struct jffs2_node_frag *frag_last(struct rb_root *root)
307{ 306{
308 struct rb_node *node = root->rb_node; 307 struct rb_node *node = rb_last(root);
309 308
310 if (!node) 309 if (!node)
311 return NULL; 310 return NULL;
312 while(node->rb_right) 311
313 node = node->rb_right;
314 return rb_entry(node, struct jffs2_node_frag, rb); 312 return rb_entry(node, struct jffs2_node_frag, rb);
315} 313}
316 314
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index bc4b8106a490..590f60a897c1 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/err.h>
20#include <linux/mount.h> 21#include <linux/mount.h>
21#include <linux/jffs2.h> 22#include <linux/jffs2.h>
22#include <linux/pagemap.h> 23#include <linux/pagemap.h>
@@ -184,9 +185,9 @@ static int jffs2_get_sb_mtdnr(struct file_system_type *fs_type,
184 struct mtd_info *mtd; 185 struct mtd_info *mtd;
185 186
186 mtd = get_mtd_device(NULL, mtdnr); 187 mtd = get_mtd_device(NULL, mtdnr);
187 if (!mtd) { 188 if (IS_ERR(mtd)) {
188 D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", mtdnr)); 189 D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", mtdnr));
189 return -EINVAL; 190 return PTR_ERR(mtd);
190 } 191 }
191 192
192 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt); 193 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt);
@@ -221,7 +222,7 @@ static int jffs2_get_sb(struct file_system_type *fs_type,
221 D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd:%%s, name \"%s\"\n", dev_name+4)); 222 D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd:%%s, name \"%s\"\n", dev_name+4));
222 for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) { 223 for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
223 mtd = get_mtd_device(NULL, mtdnr); 224 mtd = get_mtd_device(NULL, mtdnr);
224 if (mtd) { 225 if (!IS_ERR(mtd)) {
225 if (!strcmp(mtd->name, dev_name+4)) 226 if (!strcmp(mtd->name, dev_name+4))
226 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt); 227 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt);
227 put_mtd_device(mtd); 228 put_mtd_device(mtd);
diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c
index fc211b6e9b03..b90d5aa3d969 100644
--- a/fs/jffs2/symlink.c
+++ b/fs/jffs2/symlink.c
@@ -51,7 +51,7 @@ static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
51 */ 51 */
52 52
53 if (!p) { 53 if (!p) {
54 printk(KERN_ERR "jffs2_follow_link(): can't find symlink taerget\n"); 54 printk(KERN_ERR "jffs2_follow_link(): can't find symlink target\n");
55 p = ERR_PTR(-EIO); 55 p = ERR_PTR(-EIO);
56 } 56 }
57 D1(printk(KERN_DEBUG "jffs2_follow_link(): target path is '%s'\n", (char *) f->target)); 57 D1(printk(KERN_DEBUG "jffs2_follow_link(): target path is '%s'\n", (char *) f->target));
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;
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 4da09ce1d1f5..4bb3f1897330 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -399,8 +399,6 @@ static void unrefer_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datu
399{ 399{
400 /* must be called under down_write(xattr_sem) */ 400 /* must be called under down_write(xattr_sem) */
401 if (atomic_dec_and_lock(&xd->refcnt, &c->erase_completion_lock)) { 401 if (atomic_dec_and_lock(&xd->refcnt, &c->erase_completion_lock)) {
402 uint32_t xid = xd->xid, version = xd->version;
403
404 unload_xattr_datum(c, xd); 402 unload_xattr_datum(c, xd);
405 xd->flags |= JFFS2_XFLAGS_DEAD; 403 xd->flags |= JFFS2_XFLAGS_DEAD;
406 if (xd->node == (void *)xd) { 404 if (xd->node == (void *)xd) {
@@ -411,7 +409,8 @@ static void unrefer_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datu
411 } 409 }
412 spin_unlock(&c->erase_completion_lock); 410 spin_unlock(&c->erase_completion_lock);
413 411
414 dbg_xattr("xdatum(xid=%u, version=%u) was removed.\n", xid, version); 412 dbg_xattr("xdatum(xid=%u, version=%u) was removed.\n",
413 xd->xid, xd->version);
415 } 414 }
416} 415}
417 416