diff options
Diffstat (limited to 'fs/jffs2/fs.c')
-rw-r--r-- | fs/jffs2/fs.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index b0b96d7272d8..543420665c5b 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -40,7 +40,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
40 | int ret; | 40 | int ret; |
41 | D1(printk(KERN_DEBUG "jffs2_setattr(): ino #%lu\n", inode->i_ino)); | 41 | D1(printk(KERN_DEBUG "jffs2_setattr(): ino #%lu\n", inode->i_ino)); |
42 | ret = inode_change_ok(inode, iattr); | 42 | ret = inode_change_ok(inode, iattr); |
43 | if (ret) | 43 | if (ret) |
44 | return ret; | 44 | return ret; |
45 | 45 | ||
46 | /* Special cases - we don't want more than one data node | 46 | /* Special cases - we don't want more than one data node |
@@ -73,7 +73,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
73 | kfree(mdata); | 73 | kfree(mdata); |
74 | return -ENOMEM; | 74 | return -ENOMEM; |
75 | } | 75 | } |
76 | 76 | ||
77 | ret = jffs2_reserve_space(c, sizeof(*ri) + mdatalen, &phys_ofs, &alloclen, | 77 | ret = jffs2_reserve_space(c, sizeof(*ri) + mdatalen, &phys_ofs, &alloclen, |
78 | ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); | 78 | ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); |
79 | if (ret) { | 79 | if (ret) { |
@@ -84,7 +84,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
84 | } | 84 | } |
85 | down(&f->sem); | 85 | down(&f->sem); |
86 | ivalid = iattr->ia_valid; | 86 | ivalid = iattr->ia_valid; |
87 | 87 | ||
88 | ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); | 88 | ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); |
89 | ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); | 89 | ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); |
90 | ri->totlen = cpu_to_je32(sizeof(*ri) + mdatalen); | 90 | ri->totlen = cpu_to_je32(sizeof(*ri) + mdatalen); |
@@ -100,7 +100,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
100 | if (iattr->ia_mode & S_ISGID && | 100 | if (iattr->ia_mode & S_ISGID && |
101 | !in_group_p(je16_to_cpu(ri->gid)) && !capable(CAP_FSETID)) | 101 | !in_group_p(je16_to_cpu(ri->gid)) && !capable(CAP_FSETID)) |
102 | ri->mode = cpu_to_jemode(iattr->ia_mode & ~S_ISGID); | 102 | ri->mode = cpu_to_jemode(iattr->ia_mode & ~S_ISGID); |
103 | else | 103 | else |
104 | ri->mode = cpu_to_jemode(iattr->ia_mode); | 104 | ri->mode = cpu_to_jemode(iattr->ia_mode); |
105 | else | 105 | else |
106 | ri->mode = cpu_to_jemode(inode->i_mode); | 106 | ri->mode = cpu_to_jemode(inode->i_mode); |
@@ -129,7 +129,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
129 | new_metadata = jffs2_write_dnode(c, f, ri, mdata, mdatalen, phys_ofs, ALLOC_NORMAL); | 129 | new_metadata = jffs2_write_dnode(c, f, ri, mdata, mdatalen, phys_ofs, ALLOC_NORMAL); |
130 | if (S_ISLNK(inode->i_mode)) | 130 | if (S_ISLNK(inode->i_mode)) |
131 | kfree(mdata); | 131 | kfree(mdata); |
132 | 132 | ||
133 | if (IS_ERR(new_metadata)) { | 133 | if (IS_ERR(new_metadata)) { |
134 | jffs2_complete_reservation(c); | 134 | jffs2_complete_reservation(c); |
135 | jffs2_free_raw_inode(ri); | 135 | jffs2_free_raw_inode(ri); |
@@ -167,7 +167,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
167 | jffs2_complete_reservation(c); | 167 | jffs2_complete_reservation(c); |
168 | 168 | ||
169 | /* We have to do the vmtruncate() without f->sem held, since | 169 | /* We have to do the vmtruncate() without f->sem held, since |
170 | some pages may be locked and waiting for it in readpage(). | 170 | some pages may be locked and waiting for it in readpage(). |
171 | We are protected from a simultaneous write() extending i_size | 171 | We are protected from a simultaneous write() extending i_size |
172 | back past iattr->ia_size, because do_truncate() holds the | 172 | back past iattr->ia_size, because do_truncate() holds the |
173 | generic inode semaphore. */ | 173 | generic inode semaphore. */ |
@@ -210,12 +210,12 @@ int jffs2_statfs(struct super_block *sb, struct kstatfs *buf) | |||
210 | 210 | ||
211 | void jffs2_clear_inode (struct inode *inode) | 211 | void jffs2_clear_inode (struct inode *inode) |
212 | { | 212 | { |
213 | /* We can forget about this inode for now - drop all | 213 | /* We can forget about this inode for now - drop all |
214 | * the nodelists associated with it, etc. | 214 | * the nodelists associated with it, etc. |
215 | */ | 215 | */ |
216 | struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); | 216 | struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
217 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | 217 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
218 | 218 | ||
219 | D1(printk(KERN_DEBUG "jffs2_clear_inode(): ino #%lu mode %o\n", inode->i_ino, inode->i_mode)); | 219 | D1(printk(KERN_DEBUG "jffs2_clear_inode(): ino #%lu mode %o\n", inode->i_ino, inode->i_mode)); |
220 | 220 | ||
221 | jffs2_do_clear_inode(c, f); | 221 | jffs2_do_clear_inode(c, f); |
@@ -234,7 +234,7 @@ void jffs2_read_inode (struct inode *inode) | |||
234 | c = JFFS2_SB_INFO(inode->i_sb); | 234 | c = JFFS2_SB_INFO(inode->i_sb); |
235 | 235 | ||
236 | jffs2_init_inode_info(f); | 236 | jffs2_init_inode_info(f); |
237 | 237 | ||
238 | ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); | 238 | ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); |
239 | 239 | ||
240 | if (ret) { | 240 | if (ret) { |
@@ -254,14 +254,14 @@ void jffs2_read_inode (struct inode *inode) | |||
254 | 254 | ||
255 | inode->i_blksize = PAGE_SIZE; | 255 | inode->i_blksize = PAGE_SIZE; |
256 | inode->i_blocks = (inode->i_size + 511) >> 9; | 256 | inode->i_blocks = (inode->i_size + 511) >> 9; |
257 | 257 | ||
258 | switch (inode->i_mode & S_IFMT) { | 258 | switch (inode->i_mode & S_IFMT) { |
259 | jint16_t rdev; | 259 | jint16_t rdev; |
260 | 260 | ||
261 | case S_IFLNK: | 261 | case S_IFLNK: |
262 | inode->i_op = &jffs2_symlink_inode_operations; | 262 | inode->i_op = &jffs2_symlink_inode_operations; |
263 | break; | 263 | break; |
264 | 264 | ||
265 | case S_IFDIR: | 265 | case S_IFDIR: |
266 | { | 266 | { |
267 | struct jffs2_full_dirent *fd; | 267 | struct jffs2_full_dirent *fd; |
@@ -298,7 +298,7 @@ void jffs2_read_inode (struct inode *inode) | |||
298 | jffs2_do_clear_inode(c, f); | 298 | jffs2_do_clear_inode(c, f); |
299 | make_bad_inode(inode); | 299 | make_bad_inode(inode); |
300 | return; | 300 | return; |
301 | } | 301 | } |
302 | 302 | ||
303 | case S_IFSOCK: | 303 | case S_IFSOCK: |
304 | case S_IFIFO: | 304 | case S_IFIFO: |
@@ -354,11 +354,11 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data) | |||
354 | down(&c->alloc_sem); | 354 | down(&c->alloc_sem); |
355 | jffs2_flush_wbuf_pad(c); | 355 | jffs2_flush_wbuf_pad(c); |
356 | up(&c->alloc_sem); | 356 | up(&c->alloc_sem); |
357 | } | 357 | } |
358 | 358 | ||
359 | if (!(*flags & MS_RDONLY)) | 359 | if (!(*flags & MS_RDONLY)) |
360 | jffs2_start_garbage_collect_thread(c); | 360 | jffs2_start_garbage_collect_thread(c); |
361 | 361 | ||
362 | *flags |= MS_NOATIME; | 362 | *flags |= MS_NOATIME; |
363 | 363 | ||
364 | return 0; | 364 | return 0; |
@@ -392,9 +392,9 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i | |||
392 | D1(printk(KERN_DEBUG "jffs2_new_inode(): dir_i %ld, mode 0x%x\n", dir_i->i_ino, mode)); | 392 | D1(printk(KERN_DEBUG "jffs2_new_inode(): dir_i %ld, mode 0x%x\n", dir_i->i_ino, mode)); |
393 | 393 | ||
394 | c = JFFS2_SB_INFO(sb); | 394 | c = JFFS2_SB_INFO(sb); |
395 | 395 | ||
396 | inode = new_inode(sb); | 396 | inode = new_inode(sb); |
397 | 397 | ||
398 | if (!inode) | 398 | if (!inode) |
399 | return ERR_PTR(-ENOMEM); | 399 | return ERR_PTR(-ENOMEM); |
400 | 400 | ||
@@ -458,14 +458,14 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) | |||
458 | #endif | 458 | #endif |
459 | 459 | ||
460 | c->flash_size = c->mtd->size; | 460 | c->flash_size = c->mtd->size; |
461 | c->sector_size = c->mtd->erasesize; | 461 | c->sector_size = c->mtd->erasesize; |
462 | blocks = c->flash_size / c->sector_size; | 462 | blocks = c->flash_size / c->sector_size; |
463 | 463 | ||
464 | /* | 464 | /* |
465 | * Size alignment check | 465 | * Size alignment check |
466 | */ | 466 | */ |
467 | if ((c->sector_size * blocks) != c->flash_size) { | 467 | if ((c->sector_size * blocks) != c->flash_size) { |
468 | c->flash_size = c->sector_size * blocks; | 468 | c->flash_size = c->sector_size * blocks; |
469 | printk(KERN_INFO "jffs2: Flash size not aligned to erasesize, reducing to %dKiB\n", | 469 | printk(KERN_INFO "jffs2: Flash size not aligned to erasesize, reducing to %dKiB\n", |
470 | c->flash_size / 1024); | 470 | c->flash_size / 1024); |
471 | } | 471 | } |
@@ -543,16 +543,16 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, | |||
543 | struct jffs2_inode_cache *ic; | 543 | struct jffs2_inode_cache *ic; |
544 | if (!nlink) { | 544 | if (!nlink) { |
545 | /* The inode has zero nlink but its nodes weren't yet marked | 545 | /* The inode has zero nlink but its nodes weren't yet marked |
546 | obsolete. This has to be because we're still waiting for | 546 | obsolete. This has to be because we're still waiting for |
547 | the final (close() and) iput() to happen. | 547 | the final (close() and) iput() to happen. |
548 | 548 | ||
549 | There's a possibility that the final iput() could have | 549 | There's a possibility that the final iput() could have |
550 | happened while we were contemplating. In order to ensure | 550 | happened while we were contemplating. In order to ensure |
551 | that we don't cause a new read_inode() (which would fail) | 551 | that we don't cause a new read_inode() (which would fail) |
552 | for the inode in question, we use ilookup() in this case | 552 | for the inode in question, we use ilookup() in this case |
553 | instead of iget(). | 553 | instead of iget(). |
554 | 554 | ||
555 | The nlink can't _become_ zero at this point because we're | 555 | The nlink can't _become_ zero at this point because we're |
556 | holding the alloc_sem, and jffs2_do_unlink() would also | 556 | holding the alloc_sem, and jffs2_do_unlink() would also |
557 | need that while decrementing nlink on any inode. | 557 | need that while decrementing nlink on any inode. |
558 | */ | 558 | */ |
@@ -599,19 +599,19 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, | |||
599 | return JFFS2_INODE_INFO(inode); | 599 | return JFFS2_INODE_INFO(inode); |
600 | } | 600 | } |
601 | 601 | ||
602 | unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, | 602 | unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, |
603 | struct jffs2_inode_info *f, | 603 | struct jffs2_inode_info *f, |
604 | unsigned long offset, | 604 | unsigned long offset, |
605 | unsigned long *priv) | 605 | unsigned long *priv) |
606 | { | 606 | { |
607 | struct inode *inode = OFNI_EDONI_2SFFJ(f); | 607 | struct inode *inode = OFNI_EDONI_2SFFJ(f); |
608 | struct page *pg; | 608 | struct page *pg; |
609 | 609 | ||
610 | pg = read_cache_page(inode->i_mapping, offset >> PAGE_CACHE_SHIFT, | 610 | pg = read_cache_page(inode->i_mapping, offset >> PAGE_CACHE_SHIFT, |
611 | (void *)jffs2_do_readpage_unlock, inode); | 611 | (void *)jffs2_do_readpage_unlock, inode); |
612 | if (IS_ERR(pg)) | 612 | if (IS_ERR(pg)) |
613 | return (void *)pg; | 613 | return (void *)pg; |
614 | 614 | ||
615 | *priv = (unsigned long)pg; | 615 | *priv = (unsigned long)pg; |
616 | return kmap(pg); | 616 | return kmap(pg); |
617 | } | 617 | } |
@@ -628,7 +628,7 @@ void jffs2_gc_release_page(struct jffs2_sb_info *c, | |||
628 | 628 | ||
629 | static int jffs2_flash_setup(struct jffs2_sb_info *c) { | 629 | static int jffs2_flash_setup(struct jffs2_sb_info *c) { |
630 | int ret = 0; | 630 | int ret = 0; |
631 | 631 | ||
632 | if (jffs2_cleanmarker_oob(c)) { | 632 | if (jffs2_cleanmarker_oob(c)) { |
633 | /* NAND flash... do setup accordingly */ | 633 | /* NAND flash... do setup accordingly */ |
634 | ret = jffs2_nand_flash_setup(c); | 634 | ret = jffs2_nand_flash_setup(c); |
@@ -642,7 +642,7 @@ static int jffs2_flash_setup(struct jffs2_sb_info *c) { | |||
642 | if (ret) | 642 | if (ret) |
643 | return ret; | 643 | return ret; |
644 | } | 644 | } |
645 | 645 | ||
646 | /* and Dataflash */ | 646 | /* and Dataflash */ |
647 | if (jffs2_dataflash(c)) { | 647 | if (jffs2_dataflash(c)) { |
648 | ret = jffs2_dataflash_setup(c); | 648 | ret = jffs2_dataflash_setup(c); |
@@ -670,7 +670,7 @@ void jffs2_flash_cleanup(struct jffs2_sb_info *c) { | |||
670 | if (jffs2_nor_ecc(c)) { | 670 | if (jffs2_nor_ecc(c)) { |
671 | jffs2_nor_ecc_flash_cleanup(c); | 671 | jffs2_nor_ecc_flash_cleanup(c); |
672 | } | 672 | } |
673 | 673 | ||
674 | /* and DataFlash */ | 674 | /* and DataFlash */ |
675 | if (jffs2_dataflash(c)) { | 675 | if (jffs2_dataflash(c)) { |
676 | jffs2_dataflash_cleanup(c); | 676 | jffs2_dataflash_cleanup(c); |