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

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

196
197 switch (alg) {
198 case Z_EROFS_COMPRESSION_LZ4:
199 ret = z_erofs_load_lz4_config(sb, dsb, data, size);
200 break;
201 case Z_EROFS_COMPRESSION_LZMA:
202 ret = z_erofs_load_lzma_config(sb, dsb, data, size);
203 break;
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2017-2018 HUAWEI, Inc.
4 * https://www.huawei.com/
5 * Copyright (C) 2021, Alibaba Cloud
6 */
7#include <linux/module.h>
8#include <linux/statfs.h>

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

196
197 switch (alg) {
198 case Z_EROFS_COMPRESSION_LZ4:
199 ret = z_erofs_load_lz4_config(sb, dsb, data, size);
200 break;
201 case Z_EROFS_COMPRESSION_LZMA:
202 ret = z_erofs_load_lzma_config(sb, dsb, data, size);
203 break;
204 case Z_EROFS_COMPRESSION_DEFLATE:
205 ret = z_erofs_load_deflate_config(sb, dsb, data, size);
206 break;
204 default:
205 DBG_BUGON(1);
206 ret = -EFAULT;
207 }
208 kfree(data);
209 if (ret)
210 break;
211 }

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

884/*
885 * could be triggered after deactivate_locked_super()
886 * is called, thus including umount and failed to initialize.
887 */
888static void erofs_kill_sb(struct super_block *sb)
889{
890 struct erofs_sb_info *sbi;
891
207 default:
208 DBG_BUGON(1);
209 ret = -EFAULT;
210 }
211 kfree(data);
212 if (ret)
213 break;
214 }

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

887/*
888 * could be triggered after deactivate_locked_super()
889 * is called, thus including umount and failed to initialize.
890 */
891static void erofs_kill_sb(struct super_block *sb)
892{
893 struct erofs_sb_info *sbi;
894
892 WARN_ON(sb->s_magic != EROFS_SUPER_MAGIC);
893
894 /* pseudo mount for anon inodes */
895 if (sb->s_flags & SB_KERNMOUNT) {
896 kill_anon_super(sb);
897 return;
898 }
899
900 if (erofs_is_fscache_mode(sb))
901 kill_anon_super(sb);

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

961 err = erofs_init_shrinker();
962 if (err)
963 goto shrinker_err;
964
965 err = z_erofs_lzma_init();
966 if (err)
967 goto lzma_err;
968
895 /* pseudo mount for anon inodes */
896 if (sb->s_flags & SB_KERNMOUNT) {
897 kill_anon_super(sb);
898 return;
899 }
900
901 if (erofs_is_fscache_mode(sb))
902 kill_anon_super(sb);

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

962 err = erofs_init_shrinker();
963 if (err)
964 goto shrinker_err;
965
966 err = z_erofs_lzma_init();
967 if (err)
968 goto lzma_err;
969
970 err = z_erofs_deflate_init();
971 if (err)
972 goto deflate_err;
973
969 erofs_pcpubuf_init();
970 err = z_erofs_init_zip_subsystem();
971 if (err)
972 goto zip_err;
973
974 err = erofs_init_sysfs();
975 if (err)
976 goto sysfs_err;

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

981
982 return 0;
983
984fs_err:
985 erofs_exit_sysfs();
986sysfs_err:
987 z_erofs_exit_zip_subsystem();
988zip_err:
974 erofs_pcpubuf_init();
975 err = z_erofs_init_zip_subsystem();
976 if (err)
977 goto zip_err;
978
979 err = erofs_init_sysfs();
980 if (err)
981 goto sysfs_err;

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

986
987 return 0;
988
989fs_err:
990 erofs_exit_sysfs();
991sysfs_err:
992 z_erofs_exit_zip_subsystem();
993zip_err:
994 z_erofs_deflate_exit();
995deflate_err:
989 z_erofs_lzma_exit();
990lzma_err:
991 erofs_exit_shrinker();
992shrinker_err:
993 kmem_cache_destroy(erofs_inode_cachep);
994 return err;
995}
996
997static void __exit erofs_module_exit(void)
998{
999 unregister_filesystem(&erofs_fs_type);
1000
1001 /* Ensure all RCU free inodes / pclusters are safe to be destroyed. */
1002 rcu_barrier();
1003
1004 erofs_exit_sysfs();
1005 z_erofs_exit_zip_subsystem();
996 z_erofs_lzma_exit();
997lzma_err:
998 erofs_exit_shrinker();
999shrinker_err:
1000 kmem_cache_destroy(erofs_inode_cachep);
1001 return err;
1002}
1003
1004static void __exit erofs_module_exit(void)
1005{
1006 unregister_filesystem(&erofs_fs_type);
1007
1008 /* Ensure all RCU free inodes / pclusters are safe to be destroyed. */
1009 rcu_barrier();
1010
1011 erofs_exit_sysfs();
1012 z_erofs_exit_zip_subsystem();
1013 z_erofs_deflate_exit();
1006 z_erofs_lzma_exit();
1007 erofs_exit_shrinker();
1008 kmem_cache_destroy(erofs_inode_cachep);
1009 erofs_pcpubuf_exit();
1010}
1011
1012/* get filesystem statistics */
1013static int erofs_statfs(struct dentry *dentry, struct kstatfs *buf)

--- 74 unchanged lines hidden ---
1014 z_erofs_lzma_exit();
1015 erofs_exit_shrinker();
1016 kmem_cache_destroy(erofs_inode_cachep);
1017 erofs_pcpubuf_exit();
1018}
1019
1020/* get filesystem statistics */
1021static int erofs_statfs(struct dentry *dentry, struct kstatfs *buf)

--- 74 unchanged lines hidden ---