super.c (1758047057dbe329be712a31b79db7151b5871f8) super.c (ab92184ff8f12979f3d3dd5ed601ed85770d81ba)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2017-2018 HUAWEI, Inc.
4 * https://www.huawei.com/
5 */
6#include <linux/module.h>
7#include <linux/buffer_head.h>
8#include <linux/statfs.h>

--- 397 unchanged lines hidden (view full) ---

406 ret = erofs_load_compr_cfgs(sb, dsb);
407 else
408 ret = z_erofs_load_lz4_config(sb, dsb, NULL, 0);
409 if (ret < 0)
410 goto out;
411
412 /* handle multiple devices */
413 ret = erofs_init_devices(sb, dsb);
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2017-2018 HUAWEI, Inc.
4 * https://www.huawei.com/
5 */
6#include <linux/module.h>
7#include <linux/buffer_head.h>
8#include <linux/statfs.h>

--- 397 unchanged lines hidden (view full) ---

406 ret = erofs_load_compr_cfgs(sb, dsb);
407 else
408 ret = z_erofs_load_lz4_config(sb, dsb, NULL, 0);
409 if (ret < 0)
410 goto out;
411
412 /* handle multiple devices */
413 ret = erofs_init_devices(sb, dsb);
414
415 if (erofs_sb_has_ztailpacking(sbi))
416 erofs_info(sb, "EXPERIMENTAL compressed inline data feature in use. Use at your own risk!");
414out:
415 kunmap(page);
416 put_page(page);
417 return ret;
418}
419
420/* set up default EROFS parameters */
421static void erofs_default_options(struct erofs_fs_context *ctx)
422{
423#ifdef CONFIG_EROFS_FS_ZIP
424 ctx->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND;
425 ctx->opt.max_sync_decompress_pages = 3;
417out:
418 kunmap(page);
419 put_page(page);
420 return ret;
421}
422
423/* set up default EROFS parameters */
424static void erofs_default_options(struct erofs_fs_context *ctx)
425{
426#ifdef CONFIG_EROFS_FS_ZIP
427 ctx->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND;
428 ctx->opt.max_sync_decompress_pages = 3;
426 ctx->opt.readahead_sync_decompress = false;
429 ctx->opt.sync_decompress = EROFS_SYNC_DECOMPRESS_AUTO;
427#endif
428#ifdef CONFIG_EROFS_FS_XATTR
429 set_opt(&ctx->opt, XATTR_USER);
430#endif
431#ifdef CONFIG_EROFS_FS_POSIX_ACL
432 set_opt(&ctx->opt, POSIX_ACL);
433#endif
434}

--- 255 unchanged lines hidden (view full) ---

690 return -ENOMEM;
691
692 erofs_shrinker_register(sb);
693 /* sb->s_umount is already locked, SB_ACTIVE and SB_BORN are not set */
694 err = erofs_init_managed_cache(sb);
695 if (err)
696 return err;
697
430#endif
431#ifdef CONFIG_EROFS_FS_XATTR
432 set_opt(&ctx->opt, XATTR_USER);
433#endif
434#ifdef CONFIG_EROFS_FS_POSIX_ACL
435 set_opt(&ctx->opt, POSIX_ACL);
436#endif
437}

--- 255 unchanged lines hidden (view full) ---

693 return -ENOMEM;
694
695 erofs_shrinker_register(sb);
696 /* sb->s_umount is already locked, SB_ACTIVE and SB_BORN are not set */
697 err = erofs_init_managed_cache(sb);
698 if (err)
699 return err;
700
701 err = erofs_register_sysfs(sb);
702 if (err)
703 return err;
704
698 erofs_info(sb, "mounted with root inode @ nid %llu.", ROOT_NID(sbi));
699 return 0;
700}
701
702static int erofs_fc_get_tree(struct fs_context *fc)
703{
704 return get_tree_bdev(fc, erofs_fc_fill_super);
705}

--- 97 unchanged lines hidden (view full) ---

803
804/* called when ->s_root is non-NULL */
805static void erofs_put_super(struct super_block *sb)
806{
807 struct erofs_sb_info *const sbi = EROFS_SB(sb);
808
809 DBG_BUGON(!sbi);
810
705 erofs_info(sb, "mounted with root inode @ nid %llu.", ROOT_NID(sbi));
706 return 0;
707}
708
709static int erofs_fc_get_tree(struct fs_context *fc)
710{
711 return get_tree_bdev(fc, erofs_fc_fill_super);
712}

--- 97 unchanged lines hidden (view full) ---

810
811/* called when ->s_root is non-NULL */
812static void erofs_put_super(struct super_block *sb)
813{
814 struct erofs_sb_info *const sbi = EROFS_SB(sb);
815
816 DBG_BUGON(!sbi);
817
818 erofs_unregister_sysfs(sb);
811 erofs_shrinker_unregister(sb);
812#ifdef CONFIG_EROFS_FS_ZIP
813 iput(sbi->managed_cache);
814 sbi->managed_cache = NULL;
815#endif
816}
817
818static struct file_system_type erofs_fs_type = {

--- 28 unchanged lines hidden (view full) ---

847 if (err)
848 goto lzma_err;
849
850 erofs_pcpubuf_init();
851 err = z_erofs_init_zip_subsystem();
852 if (err)
853 goto zip_err;
854
819 erofs_shrinker_unregister(sb);
820#ifdef CONFIG_EROFS_FS_ZIP
821 iput(sbi->managed_cache);
822 sbi->managed_cache = NULL;
823#endif
824}
825
826static struct file_system_type erofs_fs_type = {

--- 28 unchanged lines hidden (view full) ---

855 if (err)
856 goto lzma_err;
857
858 erofs_pcpubuf_init();
859 err = z_erofs_init_zip_subsystem();
860 if (err)
861 goto zip_err;
862
863 err = erofs_init_sysfs();
864 if (err)
865 goto sysfs_err;
866
855 err = register_filesystem(&erofs_fs_type);
856 if (err)
857 goto fs_err;
858
859 return 0;
860
861fs_err:
867 err = register_filesystem(&erofs_fs_type);
868 if (err)
869 goto fs_err;
870
871 return 0;
872
873fs_err:
874 erofs_exit_sysfs();
875sysfs_err:
862 z_erofs_exit_zip_subsystem();
863zip_err:
864 z_erofs_lzma_exit();
865lzma_err:
866 erofs_exit_shrinker();
867shrinker_err:
868 kmem_cache_destroy(erofs_inode_cachep);
869icache_err:
870 return err;
871}
872
873static void __exit erofs_module_exit(void)
874{
875 unregister_filesystem(&erofs_fs_type);
876
877 /* Ensure all RCU free inodes / pclusters are safe to be destroyed. */
878 rcu_barrier();
879
876 z_erofs_exit_zip_subsystem();
877zip_err:
878 z_erofs_lzma_exit();
879lzma_err:
880 erofs_exit_shrinker();
881shrinker_err:
882 kmem_cache_destroy(erofs_inode_cachep);
883icache_err:
884 return err;
885}
886
887static void __exit erofs_module_exit(void)
888{
889 unregister_filesystem(&erofs_fs_type);
890
891 /* Ensure all RCU free inodes / pclusters are safe to be destroyed. */
892 rcu_barrier();
893
894 erofs_exit_sysfs();
880 z_erofs_exit_zip_subsystem();
881 z_erofs_lzma_exit();
882 erofs_exit_shrinker();
883 kmem_cache_destroy(erofs_inode_cachep);
884 erofs_pcpubuf_exit();
885}
886
887/* get filesystem statistics */

--- 66 unchanged lines hidden ---
895 z_erofs_exit_zip_subsystem();
896 z_erofs_lzma_exit();
897 erofs_exit_shrinker();
898 kmem_cache_destroy(erofs_inode_cachep);
899 erofs_pcpubuf_exit();
900}
901
902/* get filesystem statistics */

--- 66 unchanged lines hidden ---