hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/jffs2/fs.c
....@@ -17,6 +17,7 @@
1717 #include <linux/sched.h>
1818 #include <linux/cred.h>
1919 #include <linux/fs.h>
20
+#include <linux/fs_context.h>
2021 #include <linux/list.h>
2122 #include <linux/mtd/mtd.h>
2223 #include <linux/pagemap.h>
....@@ -184,7 +185,7 @@
184185 if (ivalid & ATTR_SIZE && inode->i_size > iattr->ia_size) {
185186 truncate_setsize(inode, iattr->ia_size);
186187 inode->i_blocks = (inode->i_size + 511) >> 9;
187
- }
188
+ }
188189
189190 return 0;
190191 }
....@@ -340,6 +341,7 @@
340341 rdev = old_decode_dev(je16_to_cpu(jdev.old_id));
341342 else
342343 rdev = new_decode_dev(je32_to_cpu(jdev.new_id));
344
+ fallthrough;
343345
344346 case S_IFSOCK:
345347 case S_IFIFO:
....@@ -390,7 +392,7 @@
390392 jffs2_do_setattr(inode, &iattr);
391393 }
392394
393
-int jffs2_do_remount_fs(struct super_block *sb, int *flags, char *data)
395
+int jffs2_do_remount_fs(struct super_block *sb, struct fs_context *fc)
394396 {
395397 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
396398
....@@ -408,10 +410,10 @@
408410 mutex_unlock(&c->alloc_sem);
409411 }
410412
411
- if (!(*flags & SB_RDONLY))
413
+ if (!(fc->sb_flags & SB_RDONLY))
412414 jffs2_start_garbage_collect_thread(c);
413415
414
- *flags |= SB_NOATIME;
416
+ fc->sb_flags |= SB_NOATIME;
415417 return 0;
416418 }
417419
....@@ -508,7 +510,7 @@
508510 return hashsize;
509511 }
510512
511
-int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
513
+int jffs2_do_fill_super(struct super_block *sb, struct fs_context *fc)
512514 {
513515 struct jffs2_sb_info *c;
514516 struct inode *root_i;
....@@ -523,11 +525,11 @@
523525
524526 #ifndef CONFIG_JFFS2_FS_WRITEBUFFER
525527 if (c->mtd->type == MTD_NANDFLASH) {
526
- pr_err("Cannot operate on NAND flash unless jffs2 NAND support is compiled in\n");
528
+ errorf(fc, "Cannot operate on NAND flash unless jffs2 NAND support is compiled in");
527529 return -EINVAL;
528530 }
529531 if (c->mtd->type == MTD_DATAFLASH) {
530
- pr_err("Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in\n");
532
+ errorf(fc, "Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in");
531533 return -EINVAL;
532534 }
533535 #endif
....@@ -541,12 +543,12 @@
541543 */
542544 if ((c->sector_size * blocks) != c->flash_size) {
543545 c->flash_size = c->sector_size * blocks;
544
- pr_info("Flash size not aligned to erasesize, reducing to %dKiB\n",
545
- c->flash_size / 1024);
546
+ infof(fc, "Flash size not aligned to erasesize, reducing to %dKiB",
547
+ c->flash_size / 1024);
546548 }
547549
548550 if (c->flash_size < 5*c->sector_size) {
549
- pr_err("Too few erase blocks (%d)\n",
551
+ errorf(fc, "Too few erase blocks (%d)",
550552 c->flash_size / c->sector_size);
551553 return -EINVAL;
552554 }
....@@ -589,6 +591,9 @@
589591 sb->s_blocksize = PAGE_SIZE;
590592 sb->s_blocksize_bits = PAGE_SHIFT;
591593 sb->s_magic = JFFS2_SUPER_MAGIC;
594
+ sb->s_time_min = 0;
595
+ sb->s_time_max = U32_MAX;
596
+
592597 if (!sb_rdonly(sb))
593598 jffs2_start_garbage_collect_thread(c);
594599 return 0;
....@@ -597,8 +602,9 @@
597602 jffs2_free_ino_caches(c);
598603 jffs2_free_raw_node_refs(c);
599604 kvfree(c->blocks);
600
- out_inohash:
601605 jffs2_clear_xattr_subsystem(c);
606
+ jffs2_sum_exit(c);
607
+ out_inohash:
602608 kfree(c->inocache_list);
603609 out_wbuf:
604610 jffs2_flash_cleanup(c);
....@@ -675,33 +681,6 @@
675681 }
676682
677683 return JFFS2_INODE_INFO(inode);
678
-}
679
-
680
-unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
681
- struct jffs2_inode_info *f,
682
- unsigned long offset,
683
- unsigned long *priv)
684
-{
685
- struct inode *inode = OFNI_EDONI_2SFFJ(f);
686
- struct page *pg;
687
-
688
- pg = read_cache_page(inode->i_mapping, offset >> PAGE_SHIFT,
689
- jffs2_do_readpage_unlock, inode);
690
- if (IS_ERR(pg))
691
- return (void *)pg;
692
-
693
- *priv = (unsigned long)pg;
694
- return kmap(pg);
695
-}
696
-
697
-void jffs2_gc_release_page(struct jffs2_sb_info *c,
698
- unsigned char *ptr,
699
- unsigned long *priv)
700
-{
701
- struct page *pg = (void *)*priv;
702
-
703
- kunmap(pg);
704
- put_page(pg);
705684 }
706685
707686 static int jffs2_flash_setup(struct jffs2_sb_info *c) {