1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
6 #include <linux/fs_context.h>
7 #include <linux/fs_parser.h>
8 #include <linux/module.h>
9 #include <linux/init.h>
10 #include <linux/time.h>
11 #include <linux/mount.h>
12 #include <linux/cred.h>
13 #include <linux/statfs.h>
14 #include <linux/seq_file.h>
15 #include <linux/blkdev.h>
16 #include <linux/fs_struct.h>
17 #include <linux/iversion.h>
18 #include <linux/nls.h>
19 #include <linux/buffer_head.h>
20 #include <linux/magic.h>
22 #include "exfat_raw.h"
25 static char exfat_default_iocharset[] = CONFIG_EXFAT_DEFAULT_IOCHARSET;
26 static struct kmem_cache *exfat_inode_cachep;
28 static void exfat_free_iocharset(struct exfat_sb_info *sbi)
30 if (sbi->options.iocharset != exfat_default_iocharset)
31 kfree(sbi->options.iocharset);
34 static void exfat_put_super(struct super_block *sb)
36 struct exfat_sb_info *sbi = EXFAT_SB(sb);
38 mutex_lock(&sbi->s_lock);
39 exfat_free_bitmap(sbi);
41 mutex_unlock(&sbi->s_lock);
43 unload_nls(sbi->nls_io);
44 exfat_free_upcase_table(sbi);
47 static int exfat_sync_fs(struct super_block *sb, int wait)
49 struct exfat_sb_info *sbi = EXFAT_SB(sb);
55 /* If there are some dirty buffers in the bdev inode */
56 mutex_lock(&sbi->s_lock);
57 sync_blockdev(sb->s_bdev);
58 if (exfat_clear_volume_dirty(sb))
60 mutex_unlock(&sbi->s_lock);
64 static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
66 struct super_block *sb = dentry->d_sb;
67 struct exfat_sb_info *sbi = EXFAT_SB(sb);
68 unsigned long long id = huge_encode_dev(sb->s_bdev->bd_dev);
70 if (sbi->used_clusters == EXFAT_CLUSTERS_UNTRACKED) {
71 mutex_lock(&sbi->s_lock);
72 if (exfat_count_used_clusters(sb, &sbi->used_clusters)) {
73 mutex_unlock(&sbi->s_lock);
76 mutex_unlock(&sbi->s_lock);
79 buf->f_type = sb->s_magic;
80 buf->f_bsize = sbi->cluster_size;
81 buf->f_blocks = sbi->num_clusters - 2; /* clu 0 & 1 */
82 buf->f_bfree = buf->f_blocks - sbi->used_clusters;
83 buf->f_bavail = buf->f_bfree;
84 buf->f_fsid = u64_to_fsid(id);
85 /* Unicode utf16 255 characters */
86 buf->f_namelen = EXFAT_MAX_FILE_LEN * NLS_MAX_CHARSET_SIZE;
90 static int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flags)
92 struct exfat_sb_info *sbi = EXFAT_SB(sb);
93 struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data;
95 /* retain persistent-flags */
96 new_flags |= sbi->vol_flags_persistent;
98 /* flags are not changed */
99 if (sbi->vol_flags == new_flags)
102 sbi->vol_flags = new_flags;
104 /* skip updating volume dirty flag,
105 * if this volume has been mounted with read-only
110 p_boot->vol_flags = cpu_to_le16(new_flags);
112 set_buffer_uptodate(sbi->boot_bh);
113 mark_buffer_dirty(sbi->boot_bh);
115 __sync_dirty_buffer(sbi->boot_bh, REQ_SYNC | REQ_FUA | REQ_PREFLUSH);
120 int exfat_set_volume_dirty(struct super_block *sb)
122 struct exfat_sb_info *sbi = EXFAT_SB(sb);
124 return exfat_set_vol_flags(sb, sbi->vol_flags | VOLUME_DIRTY);
127 int exfat_clear_volume_dirty(struct super_block *sb)
129 struct exfat_sb_info *sbi = EXFAT_SB(sb);
131 return exfat_set_vol_flags(sb, sbi->vol_flags & ~VOLUME_DIRTY);
134 static int exfat_show_options(struct seq_file *m, struct dentry *root)
136 struct super_block *sb = root->d_sb;
137 struct exfat_sb_info *sbi = EXFAT_SB(sb);
138 struct exfat_mount_options *opts = &sbi->options;
140 /* Show partition info */
141 if (!uid_eq(opts->fs_uid, GLOBAL_ROOT_UID))
142 seq_printf(m, ",uid=%u",
143 from_kuid_munged(&init_user_ns, opts->fs_uid));
144 if (!gid_eq(opts->fs_gid, GLOBAL_ROOT_GID))
145 seq_printf(m, ",gid=%u",
146 from_kgid_munged(&init_user_ns, opts->fs_gid));
147 seq_printf(m, ",fmask=%04o,dmask=%04o", opts->fs_fmask, opts->fs_dmask);
148 if (opts->allow_utime)
149 seq_printf(m, ",allow_utime=%04o", opts->allow_utime);
151 seq_puts(m, ",iocharset=utf8");
152 else if (sbi->nls_io)
153 seq_printf(m, ",iocharset=%s", sbi->nls_io->charset);
154 if (opts->errors == EXFAT_ERRORS_CONT)
155 seq_puts(m, ",errors=continue");
156 else if (opts->errors == EXFAT_ERRORS_PANIC)
157 seq_puts(m, ",errors=panic");
159 seq_puts(m, ",errors=remount-ro");
161 seq_puts(m, ",discard");
162 if (opts->keep_last_dots)
163 seq_puts(m, ",keep_last_dots");
165 seq_puts(m, ",sys_tz");
166 else if (opts->time_offset)
167 seq_printf(m, ",time_offset=%d", opts->time_offset);
168 if (opts->zero_size_dir)
169 seq_puts(m, ",zero_size_dir");
173 static struct inode *exfat_alloc_inode(struct super_block *sb)
175 struct exfat_inode_info *ei;
177 ei = alloc_inode_sb(sb, exfat_inode_cachep, GFP_NOFS);
181 init_rwsem(&ei->truncate_lock);
182 return &ei->vfs_inode;
185 static void exfat_free_inode(struct inode *inode)
187 kmem_cache_free(exfat_inode_cachep, EXFAT_I(inode));
190 static const struct super_operations exfat_sops = {
191 .alloc_inode = exfat_alloc_inode,
192 .free_inode = exfat_free_inode,
193 .write_inode = exfat_write_inode,
194 .evict_inode = exfat_evict_inode,
195 .put_super = exfat_put_super,
196 .sync_fs = exfat_sync_fs,
197 .statfs = exfat_statfs,
198 .show_options = exfat_show_options,
216 /* Deprecated options */
223 static const struct constant_table exfat_param_enums[] = {
224 { "continue", EXFAT_ERRORS_CONT },
225 { "panic", EXFAT_ERRORS_PANIC },
226 { "remount-ro", EXFAT_ERRORS_RO },
230 static const struct fs_parameter_spec exfat_parameters[] = {
231 fsparam_u32("uid", Opt_uid),
232 fsparam_u32("gid", Opt_gid),
233 fsparam_u32oct("umask", Opt_umask),
234 fsparam_u32oct("dmask", Opt_dmask),
235 fsparam_u32oct("fmask", Opt_fmask),
236 fsparam_u32oct("allow_utime", Opt_allow_utime),
237 fsparam_string("iocharset", Opt_charset),
238 fsparam_enum("errors", Opt_errors, exfat_param_enums),
239 fsparam_flag("discard", Opt_discard),
240 fsparam_flag("keep_last_dots", Opt_keep_last_dots),
241 fsparam_flag("sys_tz", Opt_sys_tz),
242 fsparam_s32("time_offset", Opt_time_offset),
243 fsparam_flag("zero_size_dir", Opt_zero_size_dir),
244 __fsparam(NULL, "utf8", Opt_utf8, fs_param_deprecated,
246 __fsparam(NULL, "debug", Opt_debug, fs_param_deprecated,
248 __fsparam(fs_param_is_u32, "namecase", Opt_namecase,
249 fs_param_deprecated, NULL),
250 __fsparam(fs_param_is_u32, "codepage", Opt_codepage,
251 fs_param_deprecated, NULL),
255 static int exfat_parse_param(struct fs_context *fc, struct fs_parameter *param)
257 struct exfat_sb_info *sbi = fc->s_fs_info;
258 struct exfat_mount_options *opts = &sbi->options;
259 struct fs_parse_result result;
262 opt = fs_parse(fc, exfat_parameters, param, &result);
268 opts->fs_uid = make_kuid(current_user_ns(), result.uint_32);
271 opts->fs_gid = make_kgid(current_user_ns(), result.uint_32);
274 opts->fs_fmask = result.uint_32;
275 opts->fs_dmask = result.uint_32;
278 opts->fs_dmask = result.uint_32;
281 opts->fs_fmask = result.uint_32;
283 case Opt_allow_utime:
284 opts->allow_utime = result.uint_32 & 0022;
287 exfat_free_iocharset(sbi);
288 opts->iocharset = param->string;
289 param->string = NULL;
292 opts->errors = result.uint_32;
297 case Opt_keep_last_dots:
298 opts->keep_last_dots = 1;
303 case Opt_time_offset:
305 * Make the limit 24 just in case someone invents something
308 if (result.int_32 < -24 * 60 || result.int_32 > 24 * 60)
310 opts->time_offset = result.int_32;
312 case Opt_zero_size_dir:
313 opts->zero_size_dir = true;
327 static void exfat_hash_init(struct super_block *sb)
329 struct exfat_sb_info *sbi = EXFAT_SB(sb);
332 spin_lock_init(&sbi->inode_hash_lock);
333 for (i = 0; i < EXFAT_HASH_SIZE; i++)
334 INIT_HLIST_HEAD(&sbi->inode_hashtable[i]);
337 static int exfat_read_root(struct inode *inode)
339 struct super_block *sb = inode->i_sb;
340 struct exfat_sb_info *sbi = EXFAT_SB(sb);
341 struct exfat_inode_info *ei = EXFAT_I(inode);
342 struct exfat_chain cdir;
343 int num_subdirs, num_clu = 0;
345 exfat_chain_set(&ei->dir, sbi->root_dir, 0, ALLOC_FAT_CHAIN);
347 ei->start_clu = sbi->root_dir;
348 ei->flags = ALLOC_FAT_CHAIN;
351 ei->hint_bmap.off = EXFAT_EOF_CLUSTER;
352 ei->hint_stat.eidx = 0;
353 ei->hint_stat.clu = sbi->root_dir;
354 ei->hint_femp.eidx = EXFAT_HINT_NONE;
356 exfat_chain_set(&cdir, sbi->root_dir, 0, ALLOC_FAT_CHAIN);
357 if (exfat_count_num_clusters(sb, &cdir, &num_clu))
359 i_size_write(inode, num_clu << sbi->cluster_size_bits);
361 num_subdirs = exfat_count_dir_entries(sb, &cdir);
364 set_nlink(inode, num_subdirs + EXFAT_MIN_SUBDIR);
366 inode->i_uid = sbi->options.fs_uid;
367 inode->i_gid = sbi->options.fs_gid;
368 inode_inc_iversion(inode);
369 inode->i_generation = 0;
370 inode->i_mode = exfat_make_mode(sbi, EXFAT_ATTR_SUBDIR, 0777);
371 inode->i_op = &exfat_dir_inode_operations;
372 inode->i_fop = &exfat_dir_operations;
374 inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9;
375 ei->i_pos = ((loff_t)sbi->root_dir << 32) | 0xffffffff;
376 ei->i_size_aligned = i_size_read(inode);
377 ei->i_size_ondisk = i_size_read(inode);
379 exfat_save_attr(inode, EXFAT_ATTR_SUBDIR);
380 ei->i_crtime = simple_inode_init_ts(inode);
381 exfat_truncate_inode_atime(inode);
385 static int exfat_calibrate_blocksize(struct super_block *sb, int logical_sect)
387 struct exfat_sb_info *sbi = EXFAT_SB(sb);
389 if (!is_power_of_2(logical_sect)) {
390 exfat_err(sb, "bogus logical sector size %u", logical_sect);
394 if (logical_sect < sb->s_blocksize) {
395 exfat_err(sb, "logical sector size too small for device (logical sector size = %u)",
400 if (logical_sect > sb->s_blocksize) {
401 brelse(sbi->boot_bh);
404 if (!sb_set_blocksize(sb, logical_sect)) {
405 exfat_err(sb, "unable to set blocksize %u",
409 sbi->boot_bh = sb_bread(sb, 0);
411 exfat_err(sb, "unable to read boot sector (logical sector size = %lu)",
419 static int exfat_read_boot_sector(struct super_block *sb)
421 struct boot_sector *p_boot;
422 struct exfat_sb_info *sbi = EXFAT_SB(sb);
424 /* set block size to read super block */
425 sb_min_blocksize(sb, 512);
427 /* read boot sector */
428 sbi->boot_bh = sb_bread(sb, 0);
430 exfat_err(sb, "unable to read boot sector");
433 p_boot = (struct boot_sector *)sbi->boot_bh->b_data;
435 /* check the validity of BOOT */
436 if (le16_to_cpu((p_boot->signature)) != BOOT_SIGNATURE) {
437 exfat_err(sb, "invalid boot record signature");
441 if (memcmp(p_boot->fs_name, STR_EXFAT, BOOTSEC_FS_NAME_LEN)) {
442 exfat_err(sb, "invalid fs_name"); /* fs_name may unprintable */
447 * must_be_zero field must be filled with zero to prevent mounting
450 if (memchr_inv(p_boot->must_be_zero, 0, sizeof(p_boot->must_be_zero)))
453 if (p_boot->num_fats != 1 && p_boot->num_fats != 2) {
454 exfat_err(sb, "bogus number of FAT structure");
459 * sect_size_bits could be at least 9 and at most 12.
461 if (p_boot->sect_size_bits < EXFAT_MIN_SECT_SIZE_BITS ||
462 p_boot->sect_size_bits > EXFAT_MAX_SECT_SIZE_BITS) {
463 exfat_err(sb, "bogus sector size bits : %u",
464 p_boot->sect_size_bits);
469 * sect_per_clus_bits could be at least 0 and at most 25 - sect_size_bits.
471 if (p_boot->sect_per_clus_bits > EXFAT_MAX_SECT_PER_CLUS_BITS(p_boot)) {
472 exfat_err(sb, "bogus sectors bits per cluster : %u",
473 p_boot->sect_per_clus_bits);
477 sbi->sect_per_clus = 1 << p_boot->sect_per_clus_bits;
478 sbi->sect_per_clus_bits = p_boot->sect_per_clus_bits;
479 sbi->cluster_size_bits = p_boot->sect_per_clus_bits +
480 p_boot->sect_size_bits;
481 sbi->cluster_size = 1 << sbi->cluster_size_bits;
482 sbi->num_FAT_sectors = le32_to_cpu(p_boot->fat_length);
483 sbi->FAT1_start_sector = le32_to_cpu(p_boot->fat_offset);
484 sbi->FAT2_start_sector = le32_to_cpu(p_boot->fat_offset);
485 if (p_boot->num_fats == 2)
486 sbi->FAT2_start_sector += sbi->num_FAT_sectors;
487 sbi->data_start_sector = le32_to_cpu(p_boot->clu_offset);
488 sbi->num_sectors = le64_to_cpu(p_boot->vol_length);
489 /* because the cluster index starts with 2 */
490 sbi->num_clusters = le32_to_cpu(p_boot->clu_count) +
491 EXFAT_RESERVED_CLUSTERS;
493 sbi->root_dir = le32_to_cpu(p_boot->root_cluster);
494 sbi->dentries_per_clu = 1 <<
495 (sbi->cluster_size_bits - DENTRY_SIZE_BITS);
497 sbi->vol_flags = le16_to_cpu(p_boot->vol_flags);
498 sbi->vol_flags_persistent = sbi->vol_flags & (VOLUME_DIRTY | MEDIA_FAILURE);
499 sbi->clu_srch_ptr = EXFAT_FIRST_CLUSTER;
500 sbi->used_clusters = EXFAT_CLUSTERS_UNTRACKED;
502 /* check consistencies */
503 if ((u64)sbi->num_FAT_sectors << p_boot->sect_size_bits <
504 (u64)sbi->num_clusters * 4) {
505 exfat_err(sb, "bogus fat length");
509 if (sbi->data_start_sector <
510 (u64)sbi->FAT1_start_sector +
511 (u64)sbi->num_FAT_sectors * p_boot->num_fats) {
512 exfat_err(sb, "bogus data start sector");
516 if (sbi->vol_flags & VOLUME_DIRTY)
517 exfat_warn(sb, "Volume was not properly unmounted. Some data may be corrupt. Please run fsck.");
518 if (sbi->vol_flags & MEDIA_FAILURE)
519 exfat_warn(sb, "Medium has reported failures. Some data may be lost.");
521 /* exFAT file size is limited by a disk volume size */
522 sb->s_maxbytes = (u64)(sbi->num_clusters - EXFAT_RESERVED_CLUSTERS) <<
523 sbi->cluster_size_bits;
525 /* check logical sector size */
526 if (exfat_calibrate_blocksize(sb, 1 << p_boot->sect_size_bits))
532 static int exfat_verify_boot_region(struct super_block *sb)
534 struct buffer_head *bh = NULL;
536 __le32 *p_sig, *p_chksum;
539 /* read boot sector sub-regions */
540 for (sn = 0; sn < 11; sn++) {
541 bh = sb_bread(sb, sn);
545 if (sn != 0 && sn <= 8) {
546 /* extended boot sector sub-regions */
547 p_sig = (__le32 *)&bh->b_data[sb->s_blocksize - 4];
548 if (le32_to_cpu(*p_sig) != EXBOOT_SIGNATURE)
549 exfat_warn(sb, "Invalid exboot-signature(sector = %d): 0x%08x",
550 sn, le32_to_cpu(*p_sig));
553 chksum = exfat_calc_chksum32(bh->b_data, sb->s_blocksize,
554 chksum, sn ? CS_DEFAULT : CS_BOOT_SECTOR);
558 /* boot checksum sub-regions */
559 bh = sb_bread(sb, sn);
563 for (i = 0; i < sb->s_blocksize; i += sizeof(u32)) {
564 p_chksum = (__le32 *)&bh->b_data[i];
565 if (le32_to_cpu(*p_chksum) != chksum) {
566 exfat_err(sb, "Invalid boot checksum (boot checksum : 0x%08x, checksum : 0x%08x)",
567 le32_to_cpu(*p_chksum), chksum);
576 /* mount the file system volume */
577 static int __exfat_fill_super(struct super_block *sb)
580 struct exfat_sb_info *sbi = EXFAT_SB(sb);
582 ret = exfat_read_boot_sector(sb);
584 exfat_err(sb, "failed to read boot sector");
588 ret = exfat_verify_boot_region(sb);
590 exfat_err(sb, "invalid boot region");
594 ret = exfat_create_upcase_table(sb);
596 exfat_err(sb, "failed to load upcase table");
600 ret = exfat_load_bitmap(sb);
602 exfat_err(sb, "failed to load alloc-bitmap");
603 goto free_upcase_table;
606 ret = exfat_count_used_clusters(sb, &sbi->used_clusters);
608 exfat_err(sb, "failed to scan clusters");
609 goto free_alloc_bitmap;
615 exfat_free_bitmap(sbi);
617 exfat_free_upcase_table(sbi);
619 brelse(sbi->boot_bh);
623 static int exfat_fill_super(struct super_block *sb, struct fs_context *fc)
625 struct exfat_sb_info *sbi = sb->s_fs_info;
626 struct exfat_mount_options *opts = &sbi->options;
627 struct inode *root_inode;
630 if (opts->allow_utime == (unsigned short)-1)
631 opts->allow_utime = ~opts->fs_dmask & 0022;
633 if (opts->discard && !bdev_max_discard_sectors(sb->s_bdev)) {
634 exfat_warn(sb, "mounting with \"discard\" option, but the device does not support discard");
638 sb->s_flags |= SB_NODIRATIME;
639 sb->s_magic = EXFAT_SUPER_MAGIC;
640 sb->s_op = &exfat_sops;
642 sb->s_time_gran = 10 * NSEC_PER_MSEC;
643 sb->s_time_min = EXFAT_MIN_TIMESTAMP_SECS;
644 sb->s_time_max = EXFAT_MAX_TIMESTAMP_SECS;
646 err = __exfat_fill_super(sb);
648 exfat_err(sb, "failed to recognize exfat type");
652 /* set up enough so that it can read an inode */
655 if (!strcmp(sbi->options.iocharset, "utf8"))
658 sbi->nls_io = load_nls(sbi->options.iocharset);
660 exfat_err(sb, "IO charset %s not found",
661 sbi->options.iocharset);
667 if (sbi->options.utf8)
668 sb->s_d_op = &exfat_utf8_dentry_ops;
670 sb->s_d_op = &exfat_dentry_ops;
672 root_inode = new_inode(sb);
674 exfat_err(sb, "failed to allocate root inode");
679 root_inode->i_ino = EXFAT_ROOT_INO;
680 inode_set_iversion(root_inode, 1);
681 err = exfat_read_root(root_inode);
683 exfat_err(sb, "failed to initialize root inode");
687 exfat_hash_inode(root_inode, EXFAT_I(root_inode)->i_pos);
688 insert_inode_hash(root_inode);
690 sb->s_root = d_make_root(root_inode);
692 exfat_err(sb, "failed to get the root dentry");
704 exfat_free_upcase_table(sbi);
705 exfat_free_bitmap(sbi);
706 brelse(sbi->boot_bh);
709 unload_nls(sbi->nls_io);
713 static int exfat_get_tree(struct fs_context *fc)
715 return get_tree_bdev(fc, exfat_fill_super);
718 static void exfat_free_sbi(struct exfat_sb_info *sbi)
720 exfat_free_iocharset(sbi);
724 static void exfat_free(struct fs_context *fc)
726 struct exfat_sb_info *sbi = fc->s_fs_info;
732 static int exfat_reconfigure(struct fs_context *fc)
734 fc->sb_flags |= SB_NODIRATIME;
736 /* volume flag will be updated in exfat_sync_fs */
737 sync_filesystem(fc->root->d_sb);
741 static const struct fs_context_operations exfat_context_ops = {
742 .parse_param = exfat_parse_param,
743 .get_tree = exfat_get_tree,
745 .reconfigure = exfat_reconfigure,
748 static int exfat_init_fs_context(struct fs_context *fc)
750 struct exfat_sb_info *sbi;
752 sbi = kzalloc(sizeof(struct exfat_sb_info), GFP_KERNEL);
756 mutex_init(&sbi->s_lock);
757 mutex_init(&sbi->bitmap_lock);
758 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL,
759 DEFAULT_RATELIMIT_BURST);
761 sbi->options.fs_uid = current_uid();
762 sbi->options.fs_gid = current_gid();
763 sbi->options.fs_fmask = current->fs->umask;
764 sbi->options.fs_dmask = current->fs->umask;
765 sbi->options.allow_utime = -1;
766 sbi->options.iocharset = exfat_default_iocharset;
767 sbi->options.errors = EXFAT_ERRORS_RO;
770 fc->ops = &exfat_context_ops;
774 static void exfat_kill_sb(struct super_block *sb)
776 struct exfat_sb_info *sbi = sb->s_fs_info;
778 kill_block_super(sb);
783 static struct file_system_type exfat_fs_type = {
784 .owner = THIS_MODULE,
786 .init_fs_context = exfat_init_fs_context,
787 .parameters = exfat_parameters,
788 .kill_sb = exfat_kill_sb,
789 .fs_flags = FS_REQUIRES_DEV,
792 static void exfat_inode_init_once(void *foo)
794 struct exfat_inode_info *ei = (struct exfat_inode_info *)foo;
796 spin_lock_init(&ei->cache_lru_lock);
798 ei->cache_valid_id = EXFAT_CACHE_VALID + 1;
799 INIT_LIST_HEAD(&ei->cache_lru);
800 INIT_HLIST_NODE(&ei->i_hash_fat);
801 inode_init_once(&ei->vfs_inode);
804 static int __init init_exfat_fs(void)
808 err = exfat_cache_init();
812 exfat_inode_cachep = kmem_cache_create("exfat_inode_cache",
813 sizeof(struct exfat_inode_info),
814 0, SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD,
815 exfat_inode_init_once);
816 if (!exfat_inode_cachep) {
821 err = register_filesystem(&exfat_fs_type);
828 kmem_cache_destroy(exfat_inode_cachep);
830 exfat_cache_shutdown();
834 static void __exit exit_exfat_fs(void)
837 * Make sure all delayed rcu free inodes are flushed before we
841 kmem_cache_destroy(exfat_inode_cachep);
842 unregister_filesystem(&exfat_fs_type);
843 exfat_cache_shutdown();
846 module_init(init_exfat_fs);
847 module_exit(exit_exfat_fs);
849 MODULE_ALIAS_FS("exfat");
850 MODULE_LICENSE("GPL");
851 MODULE_DESCRIPTION("exFAT filesystem support");
852 MODULE_AUTHOR("Samsung Electronics Co., Ltd.");