Lines Matching refs:sbi
27 static void exfat_free_iocharset(struct exfat_sb_info *sbi) in exfat_free_iocharset() argument
29 if (sbi->options.iocharset != exfat_default_iocharset) in exfat_free_iocharset()
30 kfree(sbi->options.iocharset); in exfat_free_iocharset()
35 struct exfat_sb_info *sbi = container_of(p, struct exfat_sb_info, rcu); in exfat_delayed_free() local
37 unload_nls(sbi->nls_io); in exfat_delayed_free()
38 exfat_free_iocharset(sbi); in exfat_delayed_free()
39 exfat_free_upcase_table(sbi); in exfat_delayed_free()
40 kfree(sbi); in exfat_delayed_free()
45 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_put_super() local
47 mutex_lock(&sbi->s_lock); in exfat_put_super()
48 exfat_free_bitmap(sbi); in exfat_put_super()
49 brelse(sbi->boot_bh); in exfat_put_super()
50 mutex_unlock(&sbi->s_lock); in exfat_put_super()
52 call_rcu(&sbi->rcu, exfat_delayed_free); in exfat_put_super()
57 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_sync_fs() local
64 mutex_lock(&sbi->s_lock); in exfat_sync_fs()
68 mutex_unlock(&sbi->s_lock); in exfat_sync_fs()
75 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_statfs() local
78 if (sbi->used_clusters == EXFAT_CLUSTERS_UNTRACKED) { in exfat_statfs()
79 mutex_lock(&sbi->s_lock); in exfat_statfs()
80 if (exfat_count_used_clusters(sb, &sbi->used_clusters)) { in exfat_statfs()
81 mutex_unlock(&sbi->s_lock); in exfat_statfs()
84 mutex_unlock(&sbi->s_lock); in exfat_statfs()
88 buf->f_bsize = sbi->cluster_size; in exfat_statfs()
89 buf->f_blocks = sbi->num_clusters - 2; /* clu 0 & 1 */ in exfat_statfs()
90 buf->f_bfree = buf->f_blocks - sbi->used_clusters; in exfat_statfs()
100 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_vol_flags() local
101 struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data; in exfat_set_vol_flags()
105 new_flags |= sbi->vol_flags_persistent; in exfat_set_vol_flags()
108 if (sbi->vol_flags == new_flags) in exfat_set_vol_flags()
111 sbi->vol_flags = new_flags; in exfat_set_vol_flags()
121 if ((new_flags & VOLUME_DIRTY) && !buffer_dirty(sbi->boot_bh)) in exfat_set_vol_flags()
126 set_buffer_uptodate(sbi->boot_bh); in exfat_set_vol_flags()
127 mark_buffer_dirty(sbi->boot_bh); in exfat_set_vol_flags()
130 sync_dirty_buffer(sbi->boot_bh); in exfat_set_vol_flags()
136 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_volume_dirty() local
138 return exfat_set_vol_flags(sb, sbi->vol_flags | VOLUME_DIRTY); in exfat_set_volume_dirty()
143 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_clear_volume_dirty() local
145 return exfat_set_vol_flags(sb, sbi->vol_flags & ~VOLUME_DIRTY); in exfat_clear_volume_dirty()
151 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_show_options() local
152 struct exfat_mount_options *opts = &sbi->options; in exfat_show_options()
166 else if (sbi->nls_io) in exfat_show_options()
167 seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); in exfat_show_options()
259 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_parse_param() local
260 struct exfat_mount_options *opts = &sbi->options; in exfat_parse_param()
289 exfat_free_iocharset(sbi); in exfat_parse_param()
322 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_hash_init() local
325 spin_lock_init(&sbi->inode_hash_lock); in exfat_hash_init()
327 INIT_HLIST_HEAD(&sbi->inode_hashtable[i]); in exfat_hash_init()
333 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_root() local
338 exfat_chain_set(&ei->dir, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_read_root()
340 ei->start_clu = sbi->root_dir; in exfat_read_root()
346 ei->hint_stat.clu = sbi->root_dir; in exfat_read_root()
349 exfat_chain_set(&cdir, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_read_root()
352 i_size_write(inode, num_clu << sbi->cluster_size_bits); in exfat_read_root()
359 inode->i_uid = sbi->options.fs_uid; in exfat_read_root()
360 inode->i_gid = sbi->options.fs_gid; in exfat_read_root()
363 inode->i_mode = exfat_make_mode(sbi, ATTR_SUBDIR, 0777); in exfat_read_root()
367 inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> in exfat_read_root()
369 ei->i_pos = ((loff_t)sbi->root_dir << 32) | 0xffffffff; in exfat_read_root()
382 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_calibrate_blocksize() local
396 brelse(sbi->boot_bh); in exfat_calibrate_blocksize()
397 sbi->boot_bh = NULL; in exfat_calibrate_blocksize()
404 sbi->boot_bh = sb_bread(sb, 0); in exfat_calibrate_blocksize()
405 if (!sbi->boot_bh) { in exfat_calibrate_blocksize()
417 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_boot_sector() local
423 sbi->boot_bh = sb_bread(sb, 0); in exfat_read_boot_sector()
424 if (!sbi->boot_bh) { in exfat_read_boot_sector()
428 p_boot = (struct boot_sector *)sbi->boot_bh->b_data; in exfat_read_boot_sector()
472 sbi->sect_per_clus = 1 << p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
473 sbi->sect_per_clus_bits = p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
474 sbi->cluster_size_bits = p_boot->sect_per_clus_bits + in exfat_read_boot_sector()
476 sbi->cluster_size = 1 << sbi->cluster_size_bits; in exfat_read_boot_sector()
477 sbi->num_FAT_sectors = le32_to_cpu(p_boot->fat_length); in exfat_read_boot_sector()
478 sbi->FAT1_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
479 sbi->FAT2_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
481 sbi->FAT2_start_sector += sbi->num_FAT_sectors; in exfat_read_boot_sector()
482 sbi->data_start_sector = le32_to_cpu(p_boot->clu_offset); in exfat_read_boot_sector()
483 sbi->num_sectors = le64_to_cpu(p_boot->vol_length); in exfat_read_boot_sector()
485 sbi->num_clusters = le32_to_cpu(p_boot->clu_count) + in exfat_read_boot_sector()
488 sbi->root_dir = le32_to_cpu(p_boot->root_cluster); in exfat_read_boot_sector()
489 sbi->dentries_per_clu = 1 << in exfat_read_boot_sector()
490 (sbi->cluster_size_bits - DENTRY_SIZE_BITS); in exfat_read_boot_sector()
492 sbi->vol_flags = le16_to_cpu(p_boot->vol_flags); in exfat_read_boot_sector()
493 sbi->vol_flags_persistent = sbi->vol_flags & (VOLUME_DIRTY | MEDIA_FAILURE); in exfat_read_boot_sector()
494 sbi->clu_srch_ptr = EXFAT_FIRST_CLUSTER; in exfat_read_boot_sector()
495 sbi->used_clusters = EXFAT_CLUSTERS_UNTRACKED; in exfat_read_boot_sector()
498 if ((u64)sbi->num_FAT_sectors << p_boot->sect_size_bits < in exfat_read_boot_sector()
499 (u64)sbi->num_clusters * 4) { in exfat_read_boot_sector()
504 if (sbi->data_start_sector < in exfat_read_boot_sector()
505 (u64)sbi->FAT1_start_sector + in exfat_read_boot_sector()
506 (u64)sbi->num_FAT_sectors * p_boot->num_fats) { in exfat_read_boot_sector()
511 if (sbi->vol_flags & VOLUME_DIRTY) in exfat_read_boot_sector()
513 if (sbi->vol_flags & MEDIA_FAILURE) in exfat_read_boot_sector()
517 sb->s_maxbytes = (u64)(sbi->num_clusters - EXFAT_RESERVED_CLUSTERS) << in exfat_read_boot_sector()
518 sbi->cluster_size_bits; in exfat_read_boot_sector()
575 struct exfat_sb_info *sbi = EXFAT_SB(sb); in __exfat_fill_super() local
601 ret = exfat_count_used_clusters(sb, &sbi->used_clusters); in __exfat_fill_super()
610 exfat_free_bitmap(sbi); in __exfat_fill_super()
612 exfat_free_upcase_table(sbi); in __exfat_fill_super()
614 brelse(sbi->boot_bh); in __exfat_fill_super()
620 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_fill_super() local
621 struct exfat_mount_options *opts = &sbi->options; in exfat_fill_super()
654 if (!strcmp(sbi->options.iocharset, "utf8")) in exfat_fill_super()
657 sbi->nls_io = load_nls(sbi->options.iocharset); in exfat_fill_super()
658 if (!sbi->nls_io) { in exfat_fill_super()
660 sbi->options.iocharset); in exfat_fill_super()
666 if (sbi->options.utf8) in exfat_fill_super()
703 exfat_free_upcase_table(sbi); in exfat_fill_super()
704 exfat_free_bitmap(sbi); in exfat_fill_super()
705 brelse(sbi->boot_bh); in exfat_fill_super()
708 unload_nls(sbi->nls_io); in exfat_fill_super()
709 exfat_free_iocharset(sbi); in exfat_fill_super()
711 kfree(sbi); in exfat_fill_super()
722 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_free() local
724 if (sbi) { in exfat_free()
725 exfat_free_iocharset(sbi); in exfat_free()
726 kfree(sbi); in exfat_free()
748 struct exfat_sb_info *sbi; in exfat_init_fs_context() local
750 sbi = kzalloc(sizeof(struct exfat_sb_info), GFP_KERNEL); in exfat_init_fs_context()
751 if (!sbi) in exfat_init_fs_context()
754 mutex_init(&sbi->s_lock); in exfat_init_fs_context()
755 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL, in exfat_init_fs_context()
758 sbi->options.fs_uid = current_uid(); in exfat_init_fs_context()
759 sbi->options.fs_gid = current_gid(); in exfat_init_fs_context()
760 sbi->options.fs_fmask = current->fs->umask; in exfat_init_fs_context()
761 sbi->options.fs_dmask = current->fs->umask; in exfat_init_fs_context()
762 sbi->options.allow_utime = -1; in exfat_init_fs_context()
763 sbi->options.iocharset = exfat_default_iocharset; in exfat_init_fs_context()
764 sbi->options.errors = EXFAT_ERRORS_RO; in exfat_init_fs_context()
766 fc->s_fs_info = sbi; in exfat_init_fs_context()