diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/jffs2 | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/TODO | 2 | ||||
-rw-r--r-- | fs/jffs2/acl.c | 7 | ||||
-rw-r--r-- | fs/jffs2/acl.h | 2 | ||||
-rw-r--r-- | fs/jffs2/build.c | 7 | ||||
-rw-r--r-- | fs/jffs2/compr.c | 6 | ||||
-rw-r--r-- | fs/jffs2/compr.h | 4 | ||||
-rw-r--r-- | fs/jffs2/compr_lzo.c | 4 | ||||
-rw-r--r-- | fs/jffs2/compr_rtime.c | 6 | ||||
-rw-r--r-- | fs/jffs2/compr_rubin.c | 11 | ||||
-rw-r--r-- | fs/jffs2/compr_zlib.c | 13 | ||||
-rw-r--r-- | fs/jffs2/dir.c | 20 | ||||
-rw-r--r-- | fs/jffs2/erase.c | 2 | ||||
-rw-r--r-- | fs/jffs2/fs.c | 28 | ||||
-rw-r--r-- | fs/jffs2/gc.c | 7 | ||||
-rw-r--r-- | fs/jffs2/jffs2_fs_sb.h | 3 | ||||
-rw-r--r-- | fs/jffs2/nodelist.c | 8 | ||||
-rw-r--r-- | fs/jffs2/nodelist.h | 5 | ||||
-rw-r--r-- | fs/jffs2/os-linux.h | 2 | ||||
-rw-r--r-- | fs/jffs2/readinode.c | 2 | ||||
-rw-r--r-- | fs/jffs2/scan.c | 31 | ||||
-rw-r--r-- | fs/jffs2/security.c | 5 | ||||
-rw-r--r-- | fs/jffs2/summary.c | 4 | ||||
-rw-r--r-- | fs/jffs2/super.c | 27 | ||||
-rw-r--r-- | fs/jffs2/wbuf.c | 2 | ||||
-rw-r--r-- | fs/jffs2/write.c | 18 | ||||
-rw-r--r-- | fs/jffs2/xattr.c | 14 | ||||
-rw-r--r-- | fs/jffs2/xattr.h | 5 |
27 files changed, 132 insertions, 113 deletions
diff --git a/fs/jffs2/TODO b/fs/jffs2/TODO index 5d3ea4070f01..ca28964abd4b 100644 --- a/fs/jffs2/TODO +++ b/fs/jffs2/TODO | |||
@@ -11,7 +11,7 @@ | |||
11 | - checkpointing (do we need this? scan is quite fast) | 11 | - checkpointing (do we need this? scan is quite fast) |
12 | - make the scan code populate real inodes so read_inode just after | 12 | - make the scan code populate real inodes so read_inode just after |
13 | mount doesn't have to read the flash twice for large files. | 13 | mount doesn't have to read the flash twice for large files. |
14 | Make this a per-inode option, changable with chattr, so you can | 14 | Make this a per-inode option, changeable with chattr, so you can |
15 | decide which inodes should be in-core immediately after mount. | 15 | decide which inodes should be in-core immediately after mount. |
16 | - test, test, test | 16 | - test, test, test |
17 | 17 | ||
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 54a92fd02bbd..828a0e1ea438 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
@@ -259,11 +259,14 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
259 | return rc; | 259 | return rc; |
260 | } | 260 | } |
261 | 261 | ||
262 | int jffs2_check_acl(struct inode *inode, int mask) | 262 | int jffs2_check_acl(struct inode *inode, int mask, unsigned int flags) |
263 | { | 263 | { |
264 | struct posix_acl *acl; | 264 | struct posix_acl *acl; |
265 | int rc; | 265 | int rc; |
266 | 266 | ||
267 | if (flags & IPERM_FLAG_RCU) | ||
268 | return -ECHILD; | ||
269 | |||
267 | acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS); | 270 | acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS); |
268 | if (IS_ERR(acl)) | 271 | if (IS_ERR(acl)) |
269 | return PTR_ERR(acl); | 272 | return PTR_ERR(acl); |
@@ -399,7 +402,7 @@ static int jffs2_acl_setxattr(struct dentry *dentry, const char *name, | |||
399 | 402 | ||
400 | if (name[0] != '\0') | 403 | if (name[0] != '\0') |
401 | return -EINVAL; | 404 | return -EINVAL; |
402 | if (!is_owner_or_cap(dentry->d_inode)) | 405 | if (!inode_owner_or_capable(dentry->d_inode)) |
403 | return -EPERM; | 406 | return -EPERM; |
404 | 407 | ||
405 | if (value) { | 408 | if (value) { |
diff --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h index 5e42de8d9541..3119f59253d3 100644 --- a/fs/jffs2/acl.h +++ b/fs/jffs2/acl.h | |||
@@ -26,7 +26,7 @@ struct jffs2_acl_header { | |||
26 | 26 | ||
27 | #ifdef CONFIG_JFFS2_FS_POSIX_ACL | 27 | #ifdef CONFIG_JFFS2_FS_POSIX_ACL |
28 | 28 | ||
29 | extern int jffs2_check_acl(struct inode *, int); | 29 | extern int jffs2_check_acl(struct inode *, int, unsigned int); |
30 | extern int jffs2_acl_chmod(struct inode *); | 30 | extern int jffs2_acl_chmod(struct inode *); |
31 | extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *); | 31 | extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *); |
32 | extern int jffs2_init_acl_post(struct inode *); | 32 | extern int jffs2_init_acl_post(struct inode *); |
diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c index a906f538d11c..3005ec4520ad 100644 --- a/fs/jffs2/build.c +++ b/fs/jffs2/build.c | |||
@@ -23,7 +23,7 @@ static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *, | |||
23 | static inline struct jffs2_inode_cache * | 23 | static inline struct jffs2_inode_cache * |
24 | first_inode_chain(int *i, struct jffs2_sb_info *c) | 24 | first_inode_chain(int *i, struct jffs2_sb_info *c) |
25 | { | 25 | { |
26 | for (; *i < INOCACHE_HASHSIZE; (*i)++) { | 26 | for (; *i < c->inocache_hashsize; (*i)++) { |
27 | if (c->inocache_list[*i]) | 27 | if (c->inocache_list[*i]) |
28 | return c->inocache_list[*i]; | 28 | return c->inocache_list[*i]; |
29 | } | 29 | } |
@@ -336,14 +336,13 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) | |||
336 | size = sizeof(struct jffs2_eraseblock) * c->nr_blocks; | 336 | size = sizeof(struct jffs2_eraseblock) * c->nr_blocks; |
337 | #ifndef __ECOS | 337 | #ifndef __ECOS |
338 | if (jffs2_blocks_use_vmalloc(c)) | 338 | if (jffs2_blocks_use_vmalloc(c)) |
339 | c->blocks = vmalloc(size); | 339 | c->blocks = vzalloc(size); |
340 | else | 340 | else |
341 | #endif | 341 | #endif |
342 | c->blocks = kmalloc(size, GFP_KERNEL); | 342 | c->blocks = kzalloc(size, GFP_KERNEL); |
343 | if (!c->blocks) | 343 | if (!c->blocks) |
344 | return -ENOMEM; | 344 | return -ENOMEM; |
345 | 345 | ||
346 | memset(c->blocks, 0, size); | ||
347 | for (i=0; i<c->nr_blocks; i++) { | 346 | for (i=0; i<c->nr_blocks; i++) { |
348 | INIT_LIST_HEAD(&c->blocks[i].list); | 347 | INIT_LIST_HEAD(&c->blocks[i].list); |
349 | c->blocks[i].offset = i * c->sector_size; | 348 | c->blocks[i].offset = i * c->sector_size; |
diff --git a/fs/jffs2/compr.c b/fs/jffs2/compr.c index 617a1e5694c1..de4247021d25 100644 --- a/fs/jffs2/compr.c +++ b/fs/jffs2/compr.c | |||
@@ -103,7 +103,7 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
103 | spin_unlock(&jffs2_compressor_list_lock); | 103 | spin_unlock(&jffs2_compressor_list_lock); |
104 | *datalen = orig_slen; | 104 | *datalen = orig_slen; |
105 | *cdatalen = orig_dlen; | 105 | *cdatalen = orig_dlen; |
106 | compr_ret = this->compress(data_in, output_buf, datalen, cdatalen, NULL); | 106 | compr_ret = this->compress(data_in, output_buf, datalen, cdatalen); |
107 | spin_lock(&jffs2_compressor_list_lock); | 107 | spin_lock(&jffs2_compressor_list_lock); |
108 | this->usecount--; | 108 | this->usecount--; |
109 | if (!compr_ret) { | 109 | if (!compr_ret) { |
@@ -152,7 +152,7 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
152 | spin_unlock(&jffs2_compressor_list_lock); | 152 | spin_unlock(&jffs2_compressor_list_lock); |
153 | *datalen = orig_slen; | 153 | *datalen = orig_slen; |
154 | *cdatalen = orig_dlen; | 154 | *cdatalen = orig_dlen; |
155 | compr_ret = this->compress(data_in, this->compr_buf, datalen, cdatalen, NULL); | 155 | compr_ret = this->compress(data_in, this->compr_buf, datalen, cdatalen); |
156 | spin_lock(&jffs2_compressor_list_lock); | 156 | spin_lock(&jffs2_compressor_list_lock); |
157 | this->usecount--; | 157 | this->usecount--; |
158 | if (!compr_ret) { | 158 | if (!compr_ret) { |
@@ -220,7 +220,7 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
220 | if (comprtype == this->compr) { | 220 | if (comprtype == this->compr) { |
221 | this->usecount++; | 221 | this->usecount++; |
222 | spin_unlock(&jffs2_compressor_list_lock); | 222 | spin_unlock(&jffs2_compressor_list_lock); |
223 | ret = this->decompress(cdata_in, data_out, cdatalen, datalen, NULL); | 223 | ret = this->decompress(cdata_in, data_out, cdatalen, datalen); |
224 | spin_lock(&jffs2_compressor_list_lock); | 224 | spin_lock(&jffs2_compressor_list_lock); |
225 | if (ret) { | 225 | if (ret) { |
226 | printk(KERN_WARNING "Decompressor \"%s\" returned %d\n", this->name, ret); | 226 | printk(KERN_WARNING "Decompressor \"%s\" returned %d\n", this->name, ret); |
diff --git a/fs/jffs2/compr.h b/fs/jffs2/compr.h index e471a9106fd9..13bb7597ab39 100644 --- a/fs/jffs2/compr.h +++ b/fs/jffs2/compr.h | |||
@@ -49,9 +49,9 @@ struct jffs2_compressor { | |||
49 | char *name; | 49 | char *name; |
50 | char compr; /* JFFS2_COMPR_XXX */ | 50 | char compr; /* JFFS2_COMPR_XXX */ |
51 | int (*compress)(unsigned char *data_in, unsigned char *cpage_out, | 51 | int (*compress)(unsigned char *data_in, unsigned char *cpage_out, |
52 | uint32_t *srclen, uint32_t *destlen, void *model); | 52 | uint32_t *srclen, uint32_t *destlen); |
53 | int (*decompress)(unsigned char *cdata_in, unsigned char *data_out, | 53 | int (*decompress)(unsigned char *cdata_in, unsigned char *data_out, |
54 | uint32_t cdatalen, uint32_t datalen, void *model); | 54 | uint32_t cdatalen, uint32_t datalen); |
55 | int usecount; | 55 | int usecount; |
56 | int disabled; /* if set the compressor won't compress */ | 56 | int disabled; /* if set the compressor won't compress */ |
57 | unsigned char *compr_buf; /* used by size compr. mode */ | 57 | unsigned char *compr_buf; /* used by size compr. mode */ |
diff --git a/fs/jffs2/compr_lzo.c b/fs/jffs2/compr_lzo.c index ed25ae7c98eb..af186ee674d8 100644 --- a/fs/jffs2/compr_lzo.c +++ b/fs/jffs2/compr_lzo.c | |||
@@ -42,7 +42,7 @@ static int __init alloc_workspace(void) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | static int jffs2_lzo_compress(unsigned char *data_in, unsigned char *cpage_out, | 44 | static int jffs2_lzo_compress(unsigned char *data_in, unsigned char *cpage_out, |
45 | uint32_t *sourcelen, uint32_t *dstlen, void *model) | 45 | uint32_t *sourcelen, uint32_t *dstlen) |
46 | { | 46 | { |
47 | size_t compress_size; | 47 | size_t compress_size; |
48 | int ret; | 48 | int ret; |
@@ -67,7 +67,7 @@ static int jffs2_lzo_compress(unsigned char *data_in, unsigned char *cpage_out, | |||
67 | } | 67 | } |
68 | 68 | ||
69 | static int jffs2_lzo_decompress(unsigned char *data_in, unsigned char *cpage_out, | 69 | static int jffs2_lzo_decompress(unsigned char *data_in, unsigned char *cpage_out, |
70 | uint32_t srclen, uint32_t destlen, void *model) | 70 | uint32_t srclen, uint32_t destlen) |
71 | { | 71 | { |
72 | size_t dl = destlen; | 72 | size_t dl = destlen; |
73 | int ret; | 73 | int ret; |
diff --git a/fs/jffs2/compr_rtime.c b/fs/jffs2/compr_rtime.c index 9696ad9ef5f7..16a5047903a6 100644 --- a/fs/jffs2/compr_rtime.c +++ b/fs/jffs2/compr_rtime.c | |||
@@ -31,8 +31,7 @@ | |||
31 | /* _compress returns the compressed size, -1 if bigger */ | 31 | /* _compress returns the compressed size, -1 if bigger */ |
32 | static int jffs2_rtime_compress(unsigned char *data_in, | 32 | static int jffs2_rtime_compress(unsigned char *data_in, |
33 | unsigned char *cpage_out, | 33 | unsigned char *cpage_out, |
34 | uint32_t *sourcelen, uint32_t *dstlen, | 34 | uint32_t *sourcelen, uint32_t *dstlen) |
35 | void *model) | ||
36 | { | 35 | { |
37 | short positions[256]; | 36 | short positions[256]; |
38 | int outpos = 0; | 37 | int outpos = 0; |
@@ -73,8 +72,7 @@ static int jffs2_rtime_compress(unsigned char *data_in, | |||
73 | 72 | ||
74 | static int jffs2_rtime_decompress(unsigned char *data_in, | 73 | static int jffs2_rtime_decompress(unsigned char *data_in, |
75 | unsigned char *cpage_out, | 74 | unsigned char *cpage_out, |
76 | uint32_t srclen, uint32_t destlen, | 75 | uint32_t srclen, uint32_t destlen) |
77 | void *model) | ||
78 | { | 76 | { |
79 | short positions[256]; | 77 | short positions[256]; |
80 | int outpos = 0; | 78 | int outpos = 0; |
diff --git a/fs/jffs2/compr_rubin.c b/fs/jffs2/compr_rubin.c index a12b4f763373..9e7cec808c4c 100644 --- a/fs/jffs2/compr_rubin.c +++ b/fs/jffs2/compr_rubin.c | |||
@@ -298,7 +298,7 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in, | |||
298 | #if 0 | 298 | #if 0 |
299 | /* _compress returns the compressed size, -1 if bigger */ | 299 | /* _compress returns the compressed size, -1 if bigger */ |
300 | int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out, | 300 | int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out, |
301 | uint32_t *sourcelen, uint32_t *dstlen, void *model) | 301 | uint32_t *sourcelen, uint32_t *dstlen) |
302 | { | 302 | { |
303 | return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, | 303 | return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, |
304 | cpage_out, sourcelen, dstlen); | 304 | cpage_out, sourcelen, dstlen); |
@@ -306,8 +306,7 @@ int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out, | |||
306 | #endif | 306 | #endif |
307 | static int jffs2_dynrubin_compress(unsigned char *data_in, | 307 | static int jffs2_dynrubin_compress(unsigned char *data_in, |
308 | unsigned char *cpage_out, | 308 | unsigned char *cpage_out, |
309 | uint32_t *sourcelen, uint32_t *dstlen, | 309 | uint32_t *sourcelen, uint32_t *dstlen) |
310 | void *model) | ||
311 | { | 310 | { |
312 | int bits[8]; | 311 | int bits[8]; |
313 | unsigned char histo[256]; | 312 | unsigned char histo[256]; |
@@ -387,8 +386,7 @@ static void rubin_do_decompress(int bit_divider, int *bits, | |||
387 | 386 | ||
388 | static int jffs2_rubinmips_decompress(unsigned char *data_in, | 387 | static int jffs2_rubinmips_decompress(unsigned char *data_in, |
389 | unsigned char *cpage_out, | 388 | unsigned char *cpage_out, |
390 | uint32_t sourcelen, uint32_t dstlen, | 389 | uint32_t sourcelen, uint32_t dstlen) |
391 | void *model) | ||
392 | { | 390 | { |
393 | rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, | 391 | rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, |
394 | cpage_out, sourcelen, dstlen); | 392 | cpage_out, sourcelen, dstlen); |
@@ -397,8 +395,7 @@ static int jffs2_rubinmips_decompress(unsigned char *data_in, | |||
397 | 395 | ||
398 | static int jffs2_dynrubin_decompress(unsigned char *data_in, | 396 | static int jffs2_dynrubin_decompress(unsigned char *data_in, |
399 | unsigned char *cpage_out, | 397 | unsigned char *cpage_out, |
400 | uint32_t sourcelen, uint32_t dstlen, | 398 | uint32_t sourcelen, uint32_t dstlen) |
401 | void *model) | ||
402 | { | 399 | { |
403 | int bits[8]; | 400 | int bits[8]; |
404 | int c; | 401 | int c; |
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c index 97fc45de6f81..5a001020c542 100644 --- a/fs/jffs2/compr_zlib.c +++ b/fs/jffs2/compr_zlib.c | |||
@@ -40,12 +40,13 @@ static z_stream inf_strm, def_strm; | |||
40 | 40 | ||
41 | static int __init alloc_workspaces(void) | 41 | static int __init alloc_workspaces(void) |
42 | { | 42 | { |
43 | def_strm.workspace = vmalloc(zlib_deflate_workspacesize()); | 43 | def_strm.workspace = vmalloc(zlib_deflate_workspacesize(MAX_WBITS, |
44 | MAX_MEM_LEVEL)); | ||
44 | if (!def_strm.workspace) { | 45 | if (!def_strm.workspace) { |
45 | printk(KERN_WARNING "Failed to allocate %d bytes for deflate workspace\n", zlib_deflate_workspacesize()); | 46 | printk(KERN_WARNING "Failed to allocate %d bytes for deflate workspace\n", zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL)); |
46 | return -ENOMEM; | 47 | return -ENOMEM; |
47 | } | 48 | } |
48 | D1(printk(KERN_DEBUG "Allocated %d bytes for deflate workspace\n", zlib_deflate_workspacesize())); | 49 | D1(printk(KERN_DEBUG "Allocated %d bytes for deflate workspace\n", zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL))); |
49 | inf_strm.workspace = vmalloc(zlib_inflate_workspacesize()); | 50 | inf_strm.workspace = vmalloc(zlib_inflate_workspacesize()); |
50 | if (!inf_strm.workspace) { | 51 | if (!inf_strm.workspace) { |
51 | printk(KERN_WARNING "Failed to allocate %d bytes for inflate workspace\n", zlib_inflate_workspacesize()); | 52 | printk(KERN_WARNING "Failed to allocate %d bytes for inflate workspace\n", zlib_inflate_workspacesize()); |
@@ -68,8 +69,7 @@ static void free_workspaces(void) | |||
68 | 69 | ||
69 | static int jffs2_zlib_compress(unsigned char *data_in, | 70 | static int jffs2_zlib_compress(unsigned char *data_in, |
70 | unsigned char *cpage_out, | 71 | unsigned char *cpage_out, |
71 | uint32_t *sourcelen, uint32_t *dstlen, | 72 | uint32_t *sourcelen, uint32_t *dstlen) |
72 | void *model) | ||
73 | { | 73 | { |
74 | int ret; | 74 | int ret; |
75 | 75 | ||
@@ -136,8 +136,7 @@ static int jffs2_zlib_compress(unsigned char *data_in, | |||
136 | 136 | ||
137 | static int jffs2_zlib_decompress(unsigned char *data_in, | 137 | static int jffs2_zlib_decompress(unsigned char *data_in, |
138 | unsigned char *cpage_out, | 138 | unsigned char *cpage_out, |
139 | uint32_t srclen, uint32_t destlen, | 139 | uint32_t srclen, uint32_t destlen) |
140 | void *model) | ||
141 | { | 140 | { |
142 | int ret; | 141 | int ret; |
143 | int wbits = MAX_WBITS; | 142 | int wbits = MAX_WBITS; |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index ed78a3cf3cb0..4bca6a2e5c07 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -75,7 +75,6 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, | |||
75 | struct nameidata *nd) | 75 | struct nameidata *nd) |
76 | { | 76 | { |
77 | struct jffs2_inode_info *dir_f; | 77 | struct jffs2_inode_info *dir_f; |
78 | struct jffs2_sb_info *c; | ||
79 | struct jffs2_full_dirent *fd = NULL, *fd_list; | 78 | struct jffs2_full_dirent *fd = NULL, *fd_list; |
80 | uint32_t ino = 0; | 79 | uint32_t ino = 0; |
81 | struct inode *inode = NULL; | 80 | struct inode *inode = NULL; |
@@ -86,7 +85,6 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, | |||
86 | return ERR_PTR(-ENAMETOOLONG); | 85 | return ERR_PTR(-ENAMETOOLONG); |
87 | 86 | ||
88 | dir_f = JFFS2_INODE_INFO(dir_i); | 87 | dir_f = JFFS2_INODE_INFO(dir_i); |
89 | c = JFFS2_SB_INFO(dir_i->i_sb); | ||
90 | 88 | ||
91 | mutex_lock(&dir_f->sem); | 89 | mutex_lock(&dir_f->sem); |
92 | 90 | ||
@@ -119,7 +117,6 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, | |||
119 | static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) | 117 | static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) |
120 | { | 118 | { |
121 | struct jffs2_inode_info *f; | 119 | struct jffs2_inode_info *f; |
122 | struct jffs2_sb_info *c; | ||
123 | struct inode *inode = filp->f_path.dentry->d_inode; | 120 | struct inode *inode = filp->f_path.dentry->d_inode; |
124 | struct jffs2_full_dirent *fd; | 121 | struct jffs2_full_dirent *fd; |
125 | unsigned long offset, curofs; | 122 | unsigned long offset, curofs; |
@@ -127,7 +124,6 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
127 | D1(printk(KERN_DEBUG "jffs2_readdir() for dir_i #%lu\n", filp->f_path.dentry->d_inode->i_ino)); | 124 | D1(printk(KERN_DEBUG "jffs2_readdir() for dir_i #%lu\n", filp->f_path.dentry->d_inode->i_ino)); |
128 | 125 | ||
129 | f = JFFS2_INODE_INFO(inode); | 126 | f = JFFS2_INODE_INFO(inode); |
130 | c = JFFS2_SB_INFO(inode->i_sb); | ||
131 | 127 | ||
132 | offset = filp->f_pos; | 128 | offset = filp->f_pos; |
133 | 129 | ||
@@ -215,8 +211,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, | |||
215 | no chance of AB-BA deadlock involving its f->sem). */ | 211 | no chance of AB-BA deadlock involving its f->sem). */ |
216 | mutex_unlock(&f->sem); | 212 | mutex_unlock(&f->sem); |
217 | 213 | ||
218 | ret = jffs2_do_create(c, dir_f, f, ri, | 214 | ret = jffs2_do_create(c, dir_f, f, ri, &dentry->d_name); |
219 | dentry->d_name.name, dentry->d_name.len); | ||
220 | if (ret) | 215 | if (ret) |
221 | goto fail; | 216 | goto fail; |
222 | 217 | ||
@@ -289,7 +284,7 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de | |||
289 | mutex_unlock(&f->sem); | 284 | mutex_unlock(&f->sem); |
290 | d_instantiate(dentry, old_dentry->d_inode); | 285 | d_instantiate(dentry, old_dentry->d_inode); |
291 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); | 286 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); |
292 | atomic_inc(&old_dentry->d_inode->i_count); | 287 | ihold(old_dentry->d_inode); |
293 | } | 288 | } |
294 | return ret; | 289 | return ret; |
295 | } | 290 | } |
@@ -367,7 +362,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
367 | } | 362 | } |
368 | 363 | ||
369 | /* We use f->target field to store the target path. */ | 364 | /* We use f->target field to store the target path. */ |
370 | f->target = kmalloc(targetlen + 1, GFP_KERNEL); | 365 | f->target = kmemdup(target, targetlen + 1, GFP_KERNEL); |
371 | if (!f->target) { | 366 | if (!f->target) { |
372 | printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1); | 367 | printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1); |
373 | mutex_unlock(&f->sem); | 368 | mutex_unlock(&f->sem); |
@@ -376,7 +371,6 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
376 | goto fail; | 371 | goto fail; |
377 | } | 372 | } |
378 | 373 | ||
379 | memcpy(f->target, target, targetlen + 1); | ||
380 | D1(printk(KERN_DEBUG "jffs2_symlink: symlink's target '%s' cached\n", (char *)f->target)); | 374 | D1(printk(KERN_DEBUG "jffs2_symlink: symlink's target '%s' cached\n", (char *)f->target)); |
381 | 375 | ||
382 | /* No data here. Only a metadata node, which will be | 376 | /* No data here. Only a metadata node, which will be |
@@ -387,7 +381,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
387 | 381 | ||
388 | jffs2_complete_reservation(c); | 382 | jffs2_complete_reservation(c); |
389 | 383 | ||
390 | ret = jffs2_init_security(inode, dir_i); | 384 | ret = jffs2_init_security(inode, dir_i, &dentry->d_name); |
391 | if (ret) | 385 | if (ret) |
392 | goto fail; | 386 | goto fail; |
393 | 387 | ||
@@ -531,7 +525,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
531 | 525 | ||
532 | jffs2_complete_reservation(c); | 526 | jffs2_complete_reservation(c); |
533 | 527 | ||
534 | ret = jffs2_init_security(inode, dir_i); | 528 | ret = jffs2_init_security(inode, dir_i, &dentry->d_name); |
535 | if (ret) | 529 | if (ret) |
536 | goto fail; | 530 | goto fail; |
537 | 531 | ||
@@ -704,7 +698,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de | |||
704 | 698 | ||
705 | jffs2_complete_reservation(c); | 699 | jffs2_complete_reservation(c); |
706 | 700 | ||
707 | ret = jffs2_init_security(inode, dir_i); | 701 | ret = jffs2_init_security(inode, dir_i, &dentry->d_name); |
708 | if (ret) | 702 | if (ret) |
709 | goto fail; | 703 | goto fail; |
710 | 704 | ||
@@ -864,7 +858,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
864 | printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret); | 858 | printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret); |
865 | /* Might as well let the VFS know */ | 859 | /* Might as well let the VFS know */ |
866 | d_instantiate(new_dentry, old_dentry->d_inode); | 860 | d_instantiate(new_dentry, old_dentry->d_inode); |
867 | atomic_inc(&old_dentry->d_inode->i_count); | 861 | ihold(old_dentry->d_inode); |
868 | new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now); | 862 | new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now); |
869 | return ret; | 863 | return ret; |
870 | } | 864 | } |
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index abac961f617b..e513f1913c15 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c | |||
@@ -151,7 +151,7 @@ int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | /* Be nice */ | 153 | /* Be nice */ |
154 | yield(); | 154 | cond_resched(); |
155 | mutex_lock(&c->erase_free_sem); | 155 | mutex_lock(&c->erase_free_sem); |
156 | spin_lock(&c->erase_completion_lock); | 156 | spin_lock(&c->erase_completion_lock); |
157 | } | 157 | } |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 6b2964a19850..46ad619b6124 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/vmalloc.h> | 21 | #include <linux/vmalloc.h> |
22 | #include <linux/vfs.h> | 22 | #include <linux/vfs.h> |
23 | #include <linux/crc32.h> | 23 | #include <linux/crc32.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include "nodelist.h" | 24 | #include "nodelist.h" |
26 | 25 | ||
27 | static int jffs2_flash_setup(struct jffs2_sb_info *c); | 26 | static int jffs2_flash_setup(struct jffs2_sb_info *c); |
@@ -358,7 +357,7 @@ error: | |||
358 | return ERR_PTR(ret); | 357 | return ERR_PTR(ret); |
359 | } | 358 | } |
360 | 359 | ||
361 | void jffs2_dirty_inode(struct inode *inode) | 360 | void jffs2_dirty_inode(struct inode *inode, int flags) |
362 | { | 361 | { |
363 | struct iattr iattr; | 362 | struct iattr iattr; |
364 | 363 | ||
@@ -391,7 +390,6 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data) | |||
391 | This also catches the case where it was stopped and this | 390 | This also catches the case where it was stopped and this |
392 | is just a remount to restart it. | 391 | is just a remount to restart it. |
393 | Flush the writebuffer, if neccecary, else we loose it */ | 392 | Flush the writebuffer, if neccecary, else we loose it */ |
394 | lock_kernel(); | ||
395 | if (!(sb->s_flags & MS_RDONLY)) { | 393 | if (!(sb->s_flags & MS_RDONLY)) { |
396 | jffs2_stop_garbage_collect_thread(c); | 394 | jffs2_stop_garbage_collect_thread(c); |
397 | mutex_lock(&c->alloc_sem); | 395 | mutex_lock(&c->alloc_sem); |
@@ -403,8 +401,6 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data) | |||
403 | jffs2_start_garbage_collect_thread(c); | 401 | jffs2_start_garbage_collect_thread(c); |
404 | 402 | ||
405 | *flags |= MS_NOATIME; | 403 | *flags |= MS_NOATIME; |
406 | |||
407 | unlock_kernel(); | ||
408 | return 0; | 404 | return 0; |
409 | } | 405 | } |
410 | 406 | ||
@@ -478,6 +474,25 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i | |||
478 | return inode; | 474 | return inode; |
479 | } | 475 | } |
480 | 476 | ||
477 | static int calculate_inocache_hashsize(uint32_t flash_size) | ||
478 | { | ||
479 | /* | ||
480 | * Pick a inocache hash size based on the size of the medium. | ||
481 | * Count how many megabytes we're dealing with, apply a hashsize twice | ||
482 | * that size, but rounding down to the usual big powers of 2. And keep | ||
483 | * to sensible bounds. | ||
484 | */ | ||
485 | |||
486 | int size_mb = flash_size / 1024 / 1024; | ||
487 | int hashsize = (size_mb * 2) & ~0x3f; | ||
488 | |||
489 | if (hashsize < INOCACHE_HASHSIZE_MIN) | ||
490 | return INOCACHE_HASHSIZE_MIN; | ||
491 | if (hashsize > INOCACHE_HASHSIZE_MAX) | ||
492 | return INOCACHE_HASHSIZE_MAX; | ||
493 | |||
494 | return hashsize; | ||
495 | } | ||
481 | 496 | ||
482 | int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) | 497 | int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) |
483 | { | 498 | { |
@@ -524,7 +539,8 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) | |||
524 | if (ret) | 539 | if (ret) |
525 | return ret; | 540 | return ret; |
526 | 541 | ||
527 | c->inocache_list = kcalloc(INOCACHE_HASHSIZE, sizeof(struct jffs2_inode_cache *), GFP_KERNEL); | 542 | c->inocache_hashsize = calculate_inocache_hashsize(c->flash_size); |
543 | c->inocache_list = kcalloc(c->inocache_hashsize, sizeof(struct jffs2_inode_cache *), GFP_KERNEL); | ||
528 | if (!c->inocache_list) { | 544 | if (!c->inocache_list) { |
529 | ret = -ENOMEM; | 545 | ret = -ENOMEM; |
530 | goto out_wbuf; | 546 | goto out_wbuf; |
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c index 846a79452497..31dce611337c 100644 --- a/fs/jffs2/gc.c +++ b/fs/jffs2/gc.c | |||
@@ -219,13 +219,14 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
219 | if (!list_empty(&c->erase_complete_list) || | 219 | if (!list_empty(&c->erase_complete_list) || |
220 | !list_empty(&c->erase_pending_list)) { | 220 | !list_empty(&c->erase_pending_list)) { |
221 | spin_unlock(&c->erase_completion_lock); | 221 | spin_unlock(&c->erase_completion_lock); |
222 | mutex_unlock(&c->alloc_sem); | ||
222 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() erasing pending blocks\n")); | 223 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() erasing pending blocks\n")); |
223 | if (jffs2_erase_pending_blocks(c, 1)) { | 224 | if (jffs2_erase_pending_blocks(c, 1)) |
224 | mutex_unlock(&c->alloc_sem); | ||
225 | return 0; | 225 | return 0; |
226 | } | 226 | |
227 | D1(printk(KERN_DEBUG "No progress from erasing blocks; doing GC anyway\n")); | 227 | D1(printk(KERN_DEBUG "No progress from erasing blocks; doing GC anyway\n")); |
228 | spin_lock(&c->erase_completion_lock); | 228 | spin_lock(&c->erase_completion_lock); |
229 | mutex_lock(&c->alloc_sem); | ||
229 | } | 230 | } |
230 | 231 | ||
231 | /* First, work out which block we're garbage-collecting */ | 232 | /* First, work out which block we're garbage-collecting */ |
diff --git a/fs/jffs2/jffs2_fs_sb.h b/fs/jffs2/jffs2_fs_sb.h index 6784bc89add1..0bc6a6c80a56 100644 --- a/fs/jffs2/jffs2_fs_sb.h +++ b/fs/jffs2/jffs2_fs_sb.h | |||
@@ -100,6 +100,7 @@ struct jffs2_sb_info { | |||
100 | wait_queue_head_t erase_wait; /* For waiting for erases to complete */ | 100 | wait_queue_head_t erase_wait; /* For waiting for erases to complete */ |
101 | 101 | ||
102 | wait_queue_head_t inocache_wq; | 102 | wait_queue_head_t inocache_wq; |
103 | int inocache_hashsize; | ||
103 | struct jffs2_inode_cache **inocache_list; | 104 | struct jffs2_inode_cache **inocache_list; |
104 | spinlock_t inocache_lock; | 105 | spinlock_t inocache_lock; |
105 | 106 | ||
@@ -143,4 +144,4 @@ struct jffs2_sb_info { | |||
143 | void *os_priv; | 144 | void *os_priv; |
144 | }; | 145 | }; |
145 | 146 | ||
146 | #endif /* _JFFS2_FB_SB */ | 147 | #endif /* _JFFS2_FS_SB */ |
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c index af02bd138469..5e03233c2363 100644 --- a/fs/jffs2/nodelist.c +++ b/fs/jffs2/nodelist.c | |||
@@ -420,7 +420,7 @@ struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t | |||
420 | { | 420 | { |
421 | struct jffs2_inode_cache *ret; | 421 | struct jffs2_inode_cache *ret; |
422 | 422 | ||
423 | ret = c->inocache_list[ino % INOCACHE_HASHSIZE]; | 423 | ret = c->inocache_list[ino % c->inocache_hashsize]; |
424 | while (ret && ret->ino < ino) { | 424 | while (ret && ret->ino < ino) { |
425 | ret = ret->next; | 425 | ret = ret->next; |
426 | } | 426 | } |
@@ -441,7 +441,7 @@ void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new | |||
441 | 441 | ||
442 | dbg_inocache("add %p (ino #%u)\n", new, new->ino); | 442 | dbg_inocache("add %p (ino #%u)\n", new, new->ino); |
443 | 443 | ||
444 | prev = &c->inocache_list[new->ino % INOCACHE_HASHSIZE]; | 444 | prev = &c->inocache_list[new->ino % c->inocache_hashsize]; |
445 | 445 | ||
446 | while ((*prev) && (*prev)->ino < new->ino) { | 446 | while ((*prev) && (*prev)->ino < new->ino) { |
447 | prev = &(*prev)->next; | 447 | prev = &(*prev)->next; |
@@ -462,7 +462,7 @@ void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old) | |||
462 | dbg_inocache("del %p (ino #%u)\n", old, old->ino); | 462 | dbg_inocache("del %p (ino #%u)\n", old, old->ino); |
463 | spin_lock(&c->inocache_lock); | 463 | spin_lock(&c->inocache_lock); |
464 | 464 | ||
465 | prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE]; | 465 | prev = &c->inocache_list[old->ino % c->inocache_hashsize]; |
466 | 466 | ||
467 | while ((*prev) && (*prev)->ino < old->ino) { | 467 | while ((*prev) && (*prev)->ino < old->ino) { |
468 | prev = &(*prev)->next; | 468 | prev = &(*prev)->next; |
@@ -487,7 +487,7 @@ void jffs2_free_ino_caches(struct jffs2_sb_info *c) | |||
487 | int i; | 487 | int i; |
488 | struct jffs2_inode_cache *this, *next; | 488 | struct jffs2_inode_cache *this, *next; |
489 | 489 | ||
490 | for (i=0; i<INOCACHE_HASHSIZE; i++) { | 490 | for (i=0; i < c->inocache_hashsize; i++) { |
491 | this = c->inocache_list[i]; | 491 | this = c->inocache_list[i]; |
492 | while (this) { | 492 | while (this) { |
493 | next = this->next; | 493 | next = this->next; |
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index 523a91691052..e4619b00f7c5 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h | |||
@@ -199,7 +199,8 @@ struct jffs2_inode_cache { | |||
199 | #define RAWNODE_CLASS_XATTR_DATUM 1 | 199 | #define RAWNODE_CLASS_XATTR_DATUM 1 |
200 | #define RAWNODE_CLASS_XATTR_REF 2 | 200 | #define RAWNODE_CLASS_XATTR_REF 2 |
201 | 201 | ||
202 | #define INOCACHE_HASHSIZE 128 | 202 | #define INOCACHE_HASHSIZE_MIN 128 |
203 | #define INOCACHE_HASHSIZE_MAX 1024 | ||
203 | 204 | ||
204 | #define write_ofs(c) ((c)->nextblock->offset + (c)->sector_size - (c)->nextblock->free_size) | 205 | #define write_ofs(c) ((c)->nextblock->offset + (c)->sector_size - (c)->nextblock->free_size) |
205 | 206 | ||
@@ -400,7 +401,7 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
400 | struct jffs2_raw_inode *ri, unsigned char *buf, | 401 | struct jffs2_raw_inode *ri, unsigned char *buf, |
401 | uint32_t offset, uint32_t writelen, uint32_t *retlen); | 402 | uint32_t offset, uint32_t writelen, uint32_t *retlen); |
402 | int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, | 403 | int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, |
403 | struct jffs2_raw_inode *ri, const char *name, int namelen); | 404 | struct jffs2_raw_inode *ri, const struct qstr *qstr); |
404 | int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, const char *name, | 405 | int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, const char *name, |
405 | int namelen, struct jffs2_inode_info *dead_f, uint32_t time); | 406 | int namelen, struct jffs2_inode_info *dead_f, uint32_t time); |
406 | int jffs2_do_link(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino, | 407 | int jffs2_do_link(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino, |
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index 00bae7cc2e48..65c6c43ca482 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
@@ -172,7 +172,7 @@ int jffs2_setattr (struct dentry *, struct iattr *); | |||
172 | int jffs2_do_setattr (struct inode *, struct iattr *); | 172 | int jffs2_do_setattr (struct inode *, struct iattr *); |
173 | struct inode *jffs2_iget(struct super_block *, unsigned long); | 173 | struct inode *jffs2_iget(struct super_block *, unsigned long); |
174 | void jffs2_evict_inode (struct inode *); | 174 | void jffs2_evict_inode (struct inode *); |
175 | void jffs2_dirty_inode(struct inode *inode); | 175 | void jffs2_dirty_inode(struct inode *inode, int flags); |
176 | struct inode *jffs2_new_inode (struct inode *dir_i, int mode, | 176 | struct inode *jffs2_new_inode (struct inode *dir_i, int mode, |
177 | struct jffs2_raw_inode *ri); | 177 | struct jffs2_raw_inode *ri); |
178 | int jffs2_statfs (struct dentry *, struct kstatfs *); | 178 | int jffs2_statfs (struct dentry *, struct kstatfs *); |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index d32ee9412cb9..2ab1a0d91210 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * | 24 | * |
25 | * Returns: 0 if the data CRC is correct; | 25 | * Returns: 0 if the data CRC is correct; |
26 | * 1 - if incorrect; | 26 | * 1 - if incorrect; |
27 | * error code if an error occured. | 27 | * error code if an error occurred. |
28 | */ | 28 | */ |
29 | static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info *tn) | 29 | static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info *tn) |
30 | { | 30 | { |
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 46f870d1cc36..8d8cd3419d02 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include "summary.h" | 20 | #include "summary.h" |
21 | #include "debug.h" | 21 | #include "debug.h" |
22 | 22 | ||
23 | #define DEFAULT_EMPTY_SCAN_SIZE 1024 | 23 | #define DEFAULT_EMPTY_SCAN_SIZE 256 |
24 | 24 | ||
25 | #define noisy_printk(noise, args...) do { \ | 25 | #define noisy_printk(noise, args...) do { \ |
26 | if (*(noise)) { \ | 26 | if (*(noise)) { \ |
@@ -94,7 +94,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
94 | uint32_t buf_size = 0; | 94 | uint32_t buf_size = 0; |
95 | struct jffs2_summary *s = NULL; /* summary info collected by the scan process */ | 95 | struct jffs2_summary *s = NULL; /* summary info collected by the scan process */ |
96 | #ifndef __ECOS | 96 | #ifndef __ECOS |
97 | size_t pointlen; | 97 | size_t pointlen, try_size; |
98 | 98 | ||
99 | if (c->mtd->point) { | 99 | if (c->mtd->point) { |
100 | ret = c->mtd->point(c->mtd, 0, c->mtd->size, &pointlen, | 100 | ret = c->mtd->point(c->mtd, 0, c->mtd->size, &pointlen, |
@@ -113,18 +113,21 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
113 | /* For NAND it's quicker to read a whole eraseblock at a time, | 113 | /* For NAND it's quicker to read a whole eraseblock at a time, |
114 | apparently */ | 114 | apparently */ |
115 | if (jffs2_cleanmarker_oob(c)) | 115 | if (jffs2_cleanmarker_oob(c)) |
116 | buf_size = c->sector_size; | 116 | try_size = c->sector_size; |
117 | else | 117 | else |
118 | buf_size = PAGE_SIZE; | 118 | try_size = PAGE_SIZE; |
119 | 119 | ||
120 | /* Respect kmalloc limitations */ | 120 | D1(printk(KERN_DEBUG "Trying to allocate readbuf of %zu " |
121 | if (buf_size > 128*1024) | 121 | "bytes\n", try_size)); |
122 | buf_size = 128*1024; | ||
123 | 122 | ||
124 | D1(printk(KERN_DEBUG "Allocating readbuf of %d bytes\n", buf_size)); | 123 | flashbuf = mtd_kmalloc_up_to(c->mtd, &try_size); |
125 | flashbuf = kmalloc(buf_size, GFP_KERNEL); | ||
126 | if (!flashbuf) | 124 | if (!flashbuf) |
127 | return -ENOMEM; | 125 | return -ENOMEM; |
126 | |||
127 | D1(printk(KERN_DEBUG "Allocated readbuf of %zu bytes\n", | ||
128 | try_size)); | ||
129 | |||
130 | buf_size = (uint32_t)try_size; | ||
128 | } | 131 | } |
129 | 132 | ||
130 | if (jffs2_sum_active()) { | 133 | if (jffs2_sum_active()) { |
@@ -435,7 +438,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo | |||
435 | unsigned char *buf, uint32_t buf_size, struct jffs2_summary *s) { | 438 | unsigned char *buf, uint32_t buf_size, struct jffs2_summary *s) { |
436 | struct jffs2_unknown_node *node; | 439 | struct jffs2_unknown_node *node; |
437 | struct jffs2_unknown_node crcnode; | 440 | struct jffs2_unknown_node crcnode; |
438 | uint32_t ofs, prevofs; | 441 | uint32_t ofs, prevofs, max_ofs; |
439 | uint32_t hdr_crc, buf_ofs, buf_len; | 442 | uint32_t hdr_crc, buf_ofs, buf_len; |
440 | int err; | 443 | int err; |
441 | int noise = 0; | 444 | int noise = 0; |
@@ -550,12 +553,12 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo | |||
550 | 553 | ||
551 | /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ | 554 | /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ |
552 | ofs = 0; | 555 | ofs = 0; |
553 | 556 | max_ofs = EMPTY_SCAN_SIZE(c->sector_size); | |
554 | /* Scan only 4KiB of 0xFF before declaring it's empty */ | 557 | /* Scan only EMPTY_SCAN_SIZE of 0xFF before declaring it's empty */ |
555 | while(ofs < EMPTY_SCAN_SIZE(c->sector_size) && *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF) | 558 | while(ofs < max_ofs && *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF) |
556 | ofs += 4; | 559 | ofs += 4; |
557 | 560 | ||
558 | if (ofs == EMPTY_SCAN_SIZE(c->sector_size)) { | 561 | if (ofs == max_ofs) { |
559 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER | 562 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER |
560 | if (jffs2_cleanmarker_oob(c)) { | 563 | if (jffs2_cleanmarker_oob(c)) { |
561 | /* scan oob, take care of cleanmarker */ | 564 | /* scan oob, take care of cleanmarker */ |
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c index 239f51216a68..cfeb7164b085 100644 --- a/fs/jffs2/security.c +++ b/fs/jffs2/security.c | |||
@@ -23,14 +23,15 @@ | |||
23 | #include "nodelist.h" | 23 | #include "nodelist.h" |
24 | 24 | ||
25 | /* ---- Initial Security Label Attachment -------------- */ | 25 | /* ---- Initial Security Label Attachment -------------- */ |
26 | int jffs2_init_security(struct inode *inode, struct inode *dir) | 26 | int jffs2_init_security(struct inode *inode, struct inode *dir, |
27 | const struct qstr *qstr) | ||
27 | { | 28 | { |
28 | int rc; | 29 | int rc; |
29 | size_t len; | 30 | size_t len; |
30 | void *value; | 31 | void *value; |
31 | char *name; | 32 | char *name; |
32 | 33 | ||
33 | rc = security_inode_init_security(inode, dir, &name, &value, &len); | 34 | rc = security_inode_init_security(inode, dir, qstr, &name, &value, &len); |
34 | if (rc) { | 35 | if (rc) { |
35 | if (rc == -EOPNOTSUPP) | 36 | if (rc == -EOPNOTSUPP) |
36 | return 0; | 37 | return 0; |
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index 800171dca53b..e537fb0e0184 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -121,7 +121,7 @@ int jffs2_sum_add_inode_mem(struct jffs2_summary *s, struct jffs2_raw_inode *ri, | |||
121 | temp->nodetype = ri->nodetype; | 121 | temp->nodetype = ri->nodetype; |
122 | temp->inode = ri->ino; | 122 | temp->inode = ri->ino; |
123 | temp->version = ri->version; | 123 | temp->version = ri->version; |
124 | temp->offset = cpu_to_je32(ofs); /* relative offset from the begining of the jeb */ | 124 | temp->offset = cpu_to_je32(ofs); /* relative offset from the beginning of the jeb */ |
125 | temp->totlen = ri->totlen; | 125 | temp->totlen = ri->totlen; |
126 | temp->next = NULL; | 126 | temp->next = NULL; |
127 | 127 | ||
@@ -139,7 +139,7 @@ int jffs2_sum_add_dirent_mem(struct jffs2_summary *s, struct jffs2_raw_dirent *r | |||
139 | 139 | ||
140 | temp->nodetype = rd->nodetype; | 140 | temp->nodetype = rd->nodetype; |
141 | temp->totlen = rd->totlen; | 141 | temp->totlen = rd->totlen; |
142 | temp->offset = cpu_to_je32(ofs); /* relative from the begining of the jeb */ | 142 | temp->offset = cpu_to_je32(ofs); /* relative from the beginning of the jeb */ |
143 | temp->pino = rd->pino; | 143 | temp->pino = rd->pino; |
144 | temp->version = rd->version; | 144 | temp->version = rd->version; |
145 | temp->ino = rd->ino; | 145 | temp->ino = rd->ino; |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 662bba099501..853b8e300084 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/smp_lock.h> | ||
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <linux/list.h> | 16 | #include <linux/list.h> |
18 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
@@ -41,11 +40,18 @@ static struct inode *jffs2_alloc_inode(struct super_block *sb) | |||
41 | return &f->vfs_inode; | 40 | return &f->vfs_inode; |
42 | } | 41 | } |
43 | 42 | ||
44 | static void jffs2_destroy_inode(struct inode *inode) | 43 | static void jffs2_i_callback(struct rcu_head *head) |
45 | { | 44 | { |
45 | struct inode *inode = container_of(head, struct inode, i_rcu); | ||
46 | INIT_LIST_HEAD(&inode->i_dentry); | ||
46 | kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode)); | 47 | kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode)); |
47 | } | 48 | } |
48 | 49 | ||
50 | static void jffs2_destroy_inode(struct inode *inode) | ||
51 | { | ||
52 | call_rcu(&inode->i_rcu, jffs2_i_callback); | ||
53 | } | ||
54 | |||
49 | static void jffs2_i_init_once(void *foo) | 55 | static void jffs2_i_init_once(void *foo) |
50 | { | 56 | { |
51 | struct jffs2_inode_info *f = foo; | 57 | struct jffs2_inode_info *f = foo; |
@@ -146,6 +152,7 @@ static const struct super_operations jffs2_super_operations = | |||
146 | static int jffs2_fill_super(struct super_block *sb, void *data, int silent) | 152 | static int jffs2_fill_super(struct super_block *sb, void *data, int silent) |
147 | { | 153 | { |
148 | struct jffs2_sb_info *c; | 154 | struct jffs2_sb_info *c; |
155 | int ret; | ||
149 | 156 | ||
150 | D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():" | 157 | D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():" |
151 | " New superblock for device %d (\"%s\")\n", | 158 | " New superblock for device %d (\"%s\")\n", |
@@ -175,15 +182,15 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent) | |||
175 | #ifdef CONFIG_JFFS2_FS_POSIX_ACL | 182 | #ifdef CONFIG_JFFS2_FS_POSIX_ACL |
176 | sb->s_flags |= MS_POSIXACL; | 183 | sb->s_flags |= MS_POSIXACL; |
177 | #endif | 184 | #endif |
178 | return jffs2_do_fill_super(sb, data, silent); | 185 | ret = jffs2_do_fill_super(sb, data, silent); |
186 | return ret; | ||
179 | } | 187 | } |
180 | 188 | ||
181 | static int jffs2_get_sb(struct file_system_type *fs_type, | 189 | static struct dentry *jffs2_mount(struct file_system_type *fs_type, |
182 | int flags, const char *dev_name, | 190 | int flags, const char *dev_name, |
183 | void *data, struct vfsmount *mnt) | 191 | void *data) |
184 | { | 192 | { |
185 | return get_sb_mtd(fs_type, flags, dev_name, data, jffs2_fill_super, | 193 | return mount_mtd(fs_type, flags, dev_name, data, jffs2_fill_super); |
186 | mnt); | ||
187 | } | 194 | } |
188 | 195 | ||
189 | static void jffs2_put_super (struct super_block *sb) | 196 | static void jffs2_put_super (struct super_block *sb) |
@@ -192,8 +199,6 @@ static void jffs2_put_super (struct super_block *sb) | |||
192 | 199 | ||
193 | D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n")); | 200 | D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n")); |
194 | 201 | ||
195 | lock_kernel(); | ||
196 | |||
197 | if (sb->s_dirt) | 202 | if (sb->s_dirt) |
198 | jffs2_write_super(sb); | 203 | jffs2_write_super(sb); |
199 | 204 | ||
@@ -215,8 +220,6 @@ static void jffs2_put_super (struct super_block *sb) | |||
215 | if (c->mtd->sync) | 220 | if (c->mtd->sync) |
216 | c->mtd->sync(c->mtd); | 221 | c->mtd->sync(c->mtd); |
217 | 222 | ||
218 | unlock_kernel(); | ||
219 | |||
220 | D1(printk(KERN_DEBUG "jffs2_put_super returning\n")); | 223 | D1(printk(KERN_DEBUG "jffs2_put_super returning\n")); |
221 | } | 224 | } |
222 | 225 | ||
@@ -232,7 +235,7 @@ static void jffs2_kill_sb(struct super_block *sb) | |||
232 | static struct file_system_type jffs2_fs_type = { | 235 | static struct file_system_type jffs2_fs_type = { |
233 | .owner = THIS_MODULE, | 236 | .owner = THIS_MODULE, |
234 | .name = "jffs2", | 237 | .name = "jffs2", |
235 | .get_sb = jffs2_get_sb, | 238 | .mount = jffs2_mount, |
236 | .kill_sb = jffs2_kill_sb, | 239 | .kill_sb = jffs2_kill_sb, |
237 | }; | 240 | }; |
238 | 241 | ||
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index 07ee1546b2fa..4515bea0268f 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
@@ -1116,7 +1116,7 @@ int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, | |||
1116 | 1116 | ||
1117 | /* | 1117 | /* |
1118 | * On NAND we try to mark this block bad. If the block was erased more | 1118 | * On NAND we try to mark this block bad. If the block was erased more |
1119 | * than MAX_ERASE_FAILURES we mark it finaly bad. | 1119 | * than MAX_ERASE_FAILURES we mark it finally bad. |
1120 | * Don't care about failures. This block remains on the erase-pending | 1120 | * Don't care about failures. This block remains on the erase-pending |
1121 | * or badblock list as long as nobody manipulates the flash with | 1121 | * or badblock list as long as nobody manipulates the flash with |
1122 | * a bootloader or something like that. | 1122 | * a bootloader or something like that. |
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index c819eb0e982d..30d175b6d290 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
@@ -424,7 +424,9 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
424 | return ret; | 424 | return ret; |
425 | } | 425 | } |
426 | 426 | ||
427 | int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const char *name, int namelen) | 427 | int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, |
428 | struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, | ||
429 | const struct qstr *qstr) | ||
428 | { | 430 | { |
429 | struct jffs2_raw_dirent *rd; | 431 | struct jffs2_raw_dirent *rd; |
430 | struct jffs2_full_dnode *fn; | 432 | struct jffs2_full_dnode *fn; |
@@ -466,15 +468,15 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
466 | mutex_unlock(&f->sem); | 468 | mutex_unlock(&f->sem); |
467 | jffs2_complete_reservation(c); | 469 | jffs2_complete_reservation(c); |
468 | 470 | ||
469 | ret = jffs2_init_security(&f->vfs_inode, &dir_f->vfs_inode); | 471 | ret = jffs2_init_security(&f->vfs_inode, &dir_f->vfs_inode, qstr); |
470 | if (ret) | 472 | if (ret) |
471 | return ret; | 473 | return ret; |
472 | ret = jffs2_init_acl_post(&f->vfs_inode); | 474 | ret = jffs2_init_acl_post(&f->vfs_inode); |
473 | if (ret) | 475 | if (ret) |
474 | return ret; | 476 | return ret; |
475 | 477 | ||
476 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, | 478 | ret = jffs2_reserve_space(c, sizeof(*rd)+qstr->len, &alloclen, |
477 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 479 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(qstr->len)); |
478 | 480 | ||
479 | if (ret) { | 481 | if (ret) { |
480 | /* Eep. */ | 482 | /* Eep. */ |
@@ -493,19 +495,19 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
493 | 495 | ||
494 | rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); | 496 | rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); |
495 | rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); | 497 | rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); |
496 | rd->totlen = cpu_to_je32(sizeof(*rd) + namelen); | 498 | rd->totlen = cpu_to_je32(sizeof(*rd) + qstr->len); |
497 | rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)); | 499 | rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)); |
498 | 500 | ||
499 | rd->pino = cpu_to_je32(dir_f->inocache->ino); | 501 | rd->pino = cpu_to_je32(dir_f->inocache->ino); |
500 | rd->version = cpu_to_je32(++dir_f->highest_version); | 502 | rd->version = cpu_to_je32(++dir_f->highest_version); |
501 | rd->ino = ri->ino; | 503 | rd->ino = ri->ino; |
502 | rd->mctime = ri->ctime; | 504 | rd->mctime = ri->ctime; |
503 | rd->nsize = namelen; | 505 | rd->nsize = qstr->len; |
504 | rd->type = DT_REG; | 506 | rd->type = DT_REG; |
505 | rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); | 507 | rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); |
506 | rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); | 508 | rd->name_crc = cpu_to_je32(crc32(0, qstr->name, qstr->len)); |
507 | 509 | ||
508 | fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_NORMAL); | 510 | fd = jffs2_write_dirent(c, dir_f, rd, qstr->name, qstr->len, ALLOC_NORMAL); |
509 | 511 | ||
510 | jffs2_free_raw_dirent(rd); | 512 | jffs2_free_raw_dirent(rd); |
511 | 513 | ||
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 9b572ca40a49..3e93cdd19005 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c | |||
@@ -31,7 +31,7 @@ | |||
31 | * is used to release xattr name/value pair and detach from c->xattrindex. | 31 | * is used to release xattr name/value pair and detach from c->xattrindex. |
32 | * reclaim_xattr_datum(c) | 32 | * reclaim_xattr_datum(c) |
33 | * is used to reclaim xattr name/value pairs on the xattr name/value pair cache when | 33 | * is used to reclaim xattr name/value pairs on the xattr name/value pair cache when |
34 | * memory usage by cache is over c->xdatum_mem_threshold. Currently, this threshold | 34 | * memory usage by cache is over c->xdatum_mem_threshold. Currently, this threshold |
35 | * is hard coded as 32KiB. | 35 | * is hard coded as 32KiB. |
36 | * do_verify_xattr_datum(c, xd) | 36 | * do_verify_xattr_datum(c, xd) |
37 | * is used to load the xdatum informations without name/value pair from the medium. | 37 | * is used to load the xdatum informations without name/value pair from the medium. |
@@ -151,7 +151,7 @@ static int do_verify_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_dat | |||
151 | JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", | 151 | JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", |
152 | offset, je32_to_cpu(rx.hdr_crc), crc); | 152 | offset, je32_to_cpu(rx.hdr_crc), crc); |
153 | xd->flags |= JFFS2_XFLAGS_INVALID; | 153 | xd->flags |= JFFS2_XFLAGS_INVALID; |
154 | return EIO; | 154 | return -EIO; |
155 | } | 155 | } |
156 | totlen = PAD(sizeof(rx) + rx.name_len + 1 + je16_to_cpu(rx.value_len)); | 156 | totlen = PAD(sizeof(rx) + rx.name_len + 1 + je16_to_cpu(rx.value_len)); |
157 | if (je16_to_cpu(rx.magic) != JFFS2_MAGIC_BITMASK | 157 | if (je16_to_cpu(rx.magic) != JFFS2_MAGIC_BITMASK |
@@ -167,7 +167,7 @@ static int do_verify_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_dat | |||
167 | je32_to_cpu(rx.xid), xd->xid, | 167 | je32_to_cpu(rx.xid), xd->xid, |
168 | je32_to_cpu(rx.version), xd->version); | 168 | je32_to_cpu(rx.version), xd->version); |
169 | xd->flags |= JFFS2_XFLAGS_INVALID; | 169 | xd->flags |= JFFS2_XFLAGS_INVALID; |
170 | return EIO; | 170 | return -EIO; |
171 | } | 171 | } |
172 | xd->xprefix = rx.xprefix; | 172 | xd->xprefix = rx.xprefix; |
173 | xd->name_len = rx.name_len; | 173 | xd->name_len = rx.name_len; |
@@ -230,7 +230,7 @@ static int do_load_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum | |||
230 | ref_offset(xd->node), xd->data_crc, crc); | 230 | ref_offset(xd->node), xd->data_crc, crc); |
231 | kfree(data); | 231 | kfree(data); |
232 | xd->flags |= JFFS2_XFLAGS_INVALID; | 232 | xd->flags |= JFFS2_XFLAGS_INVALID; |
233 | return EIO; | 233 | return -EIO; |
234 | } | 234 | } |
235 | 235 | ||
236 | xd->flags |= JFFS2_XFLAGS_HOT; | 236 | xd->flags |= JFFS2_XFLAGS_HOT; |
@@ -268,7 +268,7 @@ static int load_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x | |||
268 | if (xd->xname) | 268 | if (xd->xname) |
269 | return 0; | 269 | return 0; |
270 | if (xd->flags & JFFS2_XFLAGS_INVALID) | 270 | if (xd->flags & JFFS2_XFLAGS_INVALID) |
271 | return EIO; | 271 | return -EIO; |
272 | if (unlikely(is_xattr_datum_unchecked(c, xd))) | 272 | if (unlikely(is_xattr_datum_unchecked(c, xd))) |
273 | rc = do_verify_xattr_datum(c, xd); | 273 | rc = do_verify_xattr_datum(c, xd); |
274 | if (!rc) | 274 | if (!rc) |
@@ -460,7 +460,7 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref | |||
460 | if (crc != je32_to_cpu(rr.node_crc)) { | 460 | if (crc != je32_to_cpu(rr.node_crc)) { |
461 | JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", | 461 | JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", |
462 | offset, je32_to_cpu(rr.node_crc), crc); | 462 | offset, je32_to_cpu(rr.node_crc), crc); |
463 | return EIO; | 463 | return -EIO; |
464 | } | 464 | } |
465 | if (je16_to_cpu(rr.magic) != JFFS2_MAGIC_BITMASK | 465 | if (je16_to_cpu(rr.magic) != JFFS2_MAGIC_BITMASK |
466 | || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF | 466 | || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF |
@@ -470,7 +470,7 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref | |||
470 | offset, je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK, | 470 | offset, je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK, |
471 | je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF, | 471 | je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF, |
472 | je32_to_cpu(rr.totlen), PAD(sizeof(rr))); | 472 | je32_to_cpu(rr.totlen), PAD(sizeof(rr))); |
473 | return EIO; | 473 | return -EIO; |
474 | } | 474 | } |
475 | ref->ino = je32_to_cpu(rr.ino); | 475 | ref->ino = je32_to_cpu(rr.ino); |
476 | ref->xid = je32_to_cpu(rr.xid); | 476 | ref->xid = je32_to_cpu(rr.xid); |
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h index cf4f5759b42b..7be4beb306f3 100644 --- a/fs/jffs2/xattr.h +++ b/fs/jffs2/xattr.h | |||
@@ -121,10 +121,11 @@ extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t); | |||
121 | #endif /* CONFIG_JFFS2_FS_XATTR */ | 121 | #endif /* CONFIG_JFFS2_FS_XATTR */ |
122 | 122 | ||
123 | #ifdef CONFIG_JFFS2_FS_SECURITY | 123 | #ifdef CONFIG_JFFS2_FS_SECURITY |
124 | extern int jffs2_init_security(struct inode *inode, struct inode *dir); | 124 | extern int jffs2_init_security(struct inode *inode, struct inode *dir, |
125 | const struct qstr *qstr); | ||
125 | extern const struct xattr_handler jffs2_security_xattr_handler; | 126 | extern const struct xattr_handler jffs2_security_xattr_handler; |
126 | #else | 127 | #else |
127 | #define jffs2_init_security(inode,dir) (0) | 128 | #define jffs2_init_security(inode,dir,qstr) (0) |
128 | #endif /* CONFIG_JFFS2_FS_SECURITY */ | 129 | #endif /* CONFIG_JFFS2_FS_SECURITY */ |
129 | 130 | ||
130 | #endif /* _JFFS2_FS_XATTR_H_ */ | 131 | #endif /* _JFFS2_FS_XATTR_H_ */ |