super.c (d93618da6b6d453c6a9684a3460ffd51b9b4ef2e) | super.c (39bfcb8138f6dc3375f23b1e62ccfc7c0d83295d) |
---|---|
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/buffer_head.h> --- 565 unchanged lines hidden (view full) --- 574 kfree(dif->path); 575 kfree(dif); 576 return ret; 577 } 578 ++ctx->devs->extra_devices; 579 break; 580 case Opt_fsid: 581#ifdef CONFIG_EROFS_FS_ONDEMAND | 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/buffer_head.h> --- 565 unchanged lines hidden (view full) --- 574 kfree(dif->path); 575 kfree(dif); 576 return ret; 577 } 578 ++ctx->devs->extra_devices; 579 break; 580 case Opt_fsid: 581#ifdef CONFIG_EROFS_FS_ONDEMAND |
582 kfree(ctx->opt.fsid); 583 ctx->opt.fsid = kstrdup(param->string, GFP_KERNEL); 584 if (!ctx->opt.fsid) | 582 kfree(ctx->fsid); 583 ctx->fsid = kstrdup(param->string, GFP_KERNEL); 584 if (!ctx->fsid) |
585 return -ENOMEM; 586#else 587 errorfc(fc, "fsid option not supported"); 588#endif 589 break; 590 case Opt_domain_id: 591#ifdef CONFIG_EROFS_FS_ONDEMAND | 585 return -ENOMEM; 586#else 587 errorfc(fc, "fsid option not supported"); 588#endif 589 break; 590 case Opt_domain_id: 591#ifdef CONFIG_EROFS_FS_ONDEMAND |
592 kfree(ctx->opt.domain_id); 593 ctx->opt.domain_id = kstrdup(param->string, GFP_KERNEL); 594 if (!ctx->opt.domain_id) | 592 kfree(ctx->domain_id); 593 ctx->domain_id = kstrdup(param->string, GFP_KERNEL); 594 if (!ctx->domain_id) |
595 return -ENOMEM; 596#else 597 errorfc(fc, "domain_id option not supported"); 598#endif 599 break; 600 default: 601 return -ENOPARAM; 602 } --- 120 unchanged lines hidden (view full) --- 723 sb->s_op = &erofs_sops; 724 725 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 726 if (!sbi) 727 return -ENOMEM; 728 729 sb->s_fs_info = sbi; 730 sbi->opt = ctx->opt; | 595 return -ENOMEM; 596#else 597 errorfc(fc, "domain_id option not supported"); 598#endif 599 break; 600 default: 601 return -ENOPARAM; 602 } --- 120 unchanged lines hidden (view full) --- 723 sb->s_op = &erofs_sops; 724 725 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 726 if (!sbi) 727 return -ENOMEM; 728 729 sb->s_fs_info = sbi; 730 sbi->opt = ctx->opt; |
731 ctx->opt.fsid = NULL; 732 ctx->opt.domain_id = NULL; | |
733 sbi->devs = ctx->devs; 734 ctx->devs = NULL; | 731 sbi->devs = ctx->devs; 732 ctx->devs = NULL; |
733 sbi->fsid = ctx->fsid; 734 ctx->fsid = NULL; 735 sbi->domain_id = ctx->domain_id; 736 ctx->domain_id = NULL; |
|
735 736 if (erofs_is_fscache_mode(sb)) { 737 sb->s_blocksize = EROFS_BLKSIZ; 738 sb->s_blocksize_bits = LOG_BLOCK_SIZE; 739 740 err = erofs_fscache_register_fs(sb); 741 if (err) 742 return err; --- 72 unchanged lines hidden (view full) --- 815{ 816 return get_tree_nodev(fc, erofs_fc_fill_pseudo_super); 817} 818 819static int erofs_fc_get_tree(struct fs_context *fc) 820{ 821 struct erofs_fs_context *ctx = fc->fs_private; 822 | 737 738 if (erofs_is_fscache_mode(sb)) { 739 sb->s_blocksize = EROFS_BLKSIZ; 740 sb->s_blocksize_bits = LOG_BLOCK_SIZE; 741 742 err = erofs_fscache_register_fs(sb); 743 if (err) 744 return err; --- 72 unchanged lines hidden (view full) --- 817{ 818 return get_tree_nodev(fc, erofs_fc_fill_pseudo_super); 819} 820 821static int erofs_fc_get_tree(struct fs_context *fc) 822{ 823 struct erofs_fs_context *ctx = fc->fs_private; 824 |
823 if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && ctx->opt.fsid) | 825 if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && ctx->fsid) |
824 return get_tree_nodev(fc, erofs_fc_fill_super); 825 826 return get_tree_bdev(fc, erofs_fc_fill_super); 827} 828 829static int erofs_fc_reconfigure(struct fs_context *fc) 830{ 831 struct super_block *sb = fc->root->d_sb; 832 struct erofs_sb_info *sbi = EROFS_SB(sb); 833 struct erofs_fs_context *ctx = fc->fs_private; 834 835 DBG_BUGON(!sb_rdonly(sb)); 836 | 826 return get_tree_nodev(fc, erofs_fc_fill_super); 827 828 return get_tree_bdev(fc, erofs_fc_fill_super); 829} 830 831static int erofs_fc_reconfigure(struct fs_context *fc) 832{ 833 struct super_block *sb = fc->root->d_sb; 834 struct erofs_sb_info *sbi = EROFS_SB(sb); 835 struct erofs_fs_context *ctx = fc->fs_private; 836 837 DBG_BUGON(!sb_rdonly(sb)); 838 |
839 if (ctx->fsid || ctx->domain_id) 840 erofs_info(sb, "ignoring reconfiguration for fsid|domain_id."); 841 |
|
837 if (test_opt(&ctx->opt, POSIX_ACL)) 838 fc->sb_flags |= SB_POSIXACL; 839 else 840 fc->sb_flags &= ~SB_POSIXACL; 841 842 sbi->opt = ctx->opt; 843 844 fc->sb_flags |= SB_RDONLY; --- 23 unchanged lines hidden (view full) --- 868 kfree(devs); 869} 870 871static void erofs_fc_free(struct fs_context *fc) 872{ 873 struct erofs_fs_context *ctx = fc->fs_private; 874 875 erofs_free_dev_context(ctx->devs); | 842 if (test_opt(&ctx->opt, POSIX_ACL)) 843 fc->sb_flags |= SB_POSIXACL; 844 else 845 fc->sb_flags &= ~SB_POSIXACL; 846 847 sbi->opt = ctx->opt; 848 849 fc->sb_flags |= SB_RDONLY; --- 23 unchanged lines hidden (view full) --- 873 kfree(devs); 874} 875 876static void erofs_fc_free(struct fs_context *fc) 877{ 878 struct erofs_fs_context *ctx = fc->fs_private; 879 880 erofs_free_dev_context(ctx->devs); |
876 kfree(ctx->opt.fsid); 877 kfree(ctx->opt.domain_id); | 881 kfree(ctx->fsid); 882 kfree(ctx->domain_id); |
878 kfree(ctx); 879} 880 881static const struct fs_context_operations erofs_context_ops = { 882 .parse_param = erofs_fc_parse_param, 883 .get_tree = erofs_fc_get_tree, 884 .reconfigure = erofs_fc_reconfigure, 885 .free = erofs_fc_free, --- 53 unchanged lines hidden (view full) --- 939 940 sbi = EROFS_SB(sb); 941 if (!sbi) 942 return; 943 944 erofs_free_dev_context(sbi->devs); 945 fs_put_dax(sbi->dax_dev, NULL); 946 erofs_fscache_unregister_fs(sb); | 883 kfree(ctx); 884} 885 886static const struct fs_context_operations erofs_context_ops = { 887 .parse_param = erofs_fc_parse_param, 888 .get_tree = erofs_fc_get_tree, 889 .reconfigure = erofs_fc_reconfigure, 890 .free = erofs_fc_free, --- 53 unchanged lines hidden (view full) --- 944 945 sbi = EROFS_SB(sb); 946 if (!sbi) 947 return; 948 949 erofs_free_dev_context(sbi->devs); 950 fs_put_dax(sbi->dax_dev, NULL); 951 erofs_fscache_unregister_fs(sb); |
947 kfree(sbi->opt.fsid); 948 kfree(sbi->opt.domain_id); | 952 kfree(sbi->fsid); 953 kfree(sbi->domain_id); |
949 kfree(sbi); 950 sb->s_fs_info = NULL; 951} 952 953/* called when ->s_root is non-NULL */ 954static void erofs_put_super(struct super_block *sb) 955{ 956 struct erofs_sb_info *const sbi = EROFS_SB(sb); --- 136 unchanged lines hidden (view full) --- 1093 else if (opt->cache_strategy == EROFS_ZIP_CACHE_READAROUND) 1094 seq_puts(seq, ",cache_strategy=readaround"); 1095#endif 1096 if (test_opt(opt, DAX_ALWAYS)) 1097 seq_puts(seq, ",dax=always"); 1098 if (test_opt(opt, DAX_NEVER)) 1099 seq_puts(seq, ",dax=never"); 1100#ifdef CONFIG_EROFS_FS_ONDEMAND | 954 kfree(sbi); 955 sb->s_fs_info = NULL; 956} 957 958/* called when ->s_root is non-NULL */ 959static void erofs_put_super(struct super_block *sb) 960{ 961 struct erofs_sb_info *const sbi = EROFS_SB(sb); --- 136 unchanged lines hidden (view full) --- 1098 else if (opt->cache_strategy == EROFS_ZIP_CACHE_READAROUND) 1099 seq_puts(seq, ",cache_strategy=readaround"); 1100#endif 1101 if (test_opt(opt, DAX_ALWAYS)) 1102 seq_puts(seq, ",dax=always"); 1103 if (test_opt(opt, DAX_NEVER)) 1104 seq_puts(seq, ",dax=never"); 1105#ifdef CONFIG_EROFS_FS_ONDEMAND |
1101 if (opt->fsid) 1102 seq_printf(seq, ",fsid=%s", opt->fsid); 1103 if (opt->domain_id) 1104 seq_printf(seq, ",domain_id=%s", opt->domain_id); | 1106 if (sbi->fsid) 1107 seq_printf(seq, ",fsid=%s", sbi->fsid); 1108 if (sbi->domain_id) 1109 seq_printf(seq, ",domain_id=%s", sbi->domain_id); |
1105#endif 1106 return 0; 1107} 1108 1109const struct super_operations erofs_sops = { 1110 .put_super = erofs_put_super, 1111 .alloc_inode = erofs_alloc_inode, 1112 .free_inode = erofs_free_inode, 1113 .statfs = erofs_statfs, 1114 .show_options = erofs_show_options, 1115}; 1116 1117module_init(erofs_module_init); 1118module_exit(erofs_module_exit); 1119 1120MODULE_DESCRIPTION("Enhanced ROM File System"); 1121MODULE_AUTHOR("Gao Xiang, Chao Yu, Miao Xie, CONSUMER BG, HUAWEI Inc."); 1122MODULE_LICENSE("GPL"); | 1110#endif 1111 return 0; 1112} 1113 1114const struct super_operations erofs_sops = { 1115 .put_super = erofs_put_super, 1116 .alloc_inode = erofs_alloc_inode, 1117 .free_inode = erofs_free_inode, 1118 .statfs = erofs_statfs, 1119 .show_options = erofs_show_options, 1120}; 1121 1122module_init(erofs_module_init); 1123module_exit(erofs_module_exit); 1124 1125MODULE_DESCRIPTION("Enhanced ROM File System"); 1126MODULE_AUTHOR("Gao Xiang, Chao Yu, Miao Xie, CONSUMER BG, HUAWEI Inc."); 1127MODULE_LICENSE("GPL"); |