Lines Matching full:sbi

28 static void exfat_free_iocharset(struct exfat_sb_info *sbi)  in exfat_free_iocharset()  argument
30 if (sbi->options.iocharset != exfat_default_iocharset) in exfat_free_iocharset()
31 kfree(sbi->options.iocharset); in exfat_free_iocharset()
36 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_put_super() local
38 mutex_lock(&sbi->s_lock); in exfat_put_super()
39 exfat_free_bitmap(sbi); in exfat_put_super()
40 brelse(sbi->boot_bh); in exfat_put_super()
41 mutex_unlock(&sbi->s_lock); in exfat_put_super()
46 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_sync_fs() local
56 mutex_lock(&sbi->s_lock); in exfat_sync_fs()
60 mutex_unlock(&sbi->s_lock); in exfat_sync_fs()
67 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_statfs() local
70 if (sbi->used_clusters == EXFAT_CLUSTERS_UNTRACKED) { in exfat_statfs()
71 mutex_lock(&sbi->s_lock); in exfat_statfs()
72 if (exfat_count_used_clusters(sb, &sbi->used_clusters)) { in exfat_statfs()
73 mutex_unlock(&sbi->s_lock); in exfat_statfs()
76 mutex_unlock(&sbi->s_lock); in exfat_statfs()
80 buf->f_bsize = sbi->cluster_size; in exfat_statfs()
81 buf->f_blocks = sbi->num_clusters - 2; /* clu 0 & 1 */ in exfat_statfs()
82 buf->f_bfree = buf->f_blocks - sbi->used_clusters; in exfat_statfs()
92 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_vol_flags() local
93 struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data; in exfat_set_vol_flags()
96 new_flags |= sbi->vol_flags_persistent; in exfat_set_vol_flags()
99 if (sbi->vol_flags == new_flags) in exfat_set_vol_flags()
102 sbi->vol_flags = new_flags; in exfat_set_vol_flags()
112 set_buffer_uptodate(sbi->boot_bh); in exfat_set_vol_flags()
113 mark_buffer_dirty(sbi->boot_bh); in exfat_set_vol_flags()
115 __sync_dirty_buffer(sbi->boot_bh, REQ_SYNC | REQ_FUA | REQ_PREFLUSH); in exfat_set_vol_flags()
122 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_volume_dirty() local
124 return exfat_set_vol_flags(sb, sbi->vol_flags | VOLUME_DIRTY); in exfat_set_volume_dirty()
129 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_clear_volume_dirty() local
131 return exfat_set_vol_flags(sb, sbi->vol_flags & ~VOLUME_DIRTY); in exfat_clear_volume_dirty()
137 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_show_options() local
138 struct exfat_mount_options *opts = &sbi->options; in exfat_show_options()
152 else if (sbi->nls_io) in exfat_show_options()
153 seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); in exfat_show_options()
176 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_force_shutdown() local
177 struct exfat_mount_options *opts = &sbi->options; in exfat_force_shutdown()
189 set_bit(EXFAT_FLAGS_SHUTDOWN, &sbi->s_exfat_flags); in exfat_force_shutdown()
192 set_bit(EXFAT_FLAGS_SHUTDOWN, &sbi->s_exfat_flags); in exfat_force_shutdown()
293 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_parse_param() local
294 struct exfat_mount_options *opts = &sbi->options; in exfat_parse_param()
323 exfat_free_iocharset(sbi); in exfat_parse_param()
365 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_hash_init() local
368 spin_lock_init(&sbi->inode_hash_lock); in exfat_hash_init()
370 INIT_HLIST_HEAD(&sbi->inode_hashtable[i]); in exfat_hash_init()
376 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_root() local
381 exfat_chain_set(&ei->dir, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_read_root()
383 ei->start_clu = sbi->root_dir; in exfat_read_root()
389 ei->hint_stat.clu = sbi->root_dir; in exfat_read_root()
392 exfat_chain_set(&cdir, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_read_root()
395 i_size_write(inode, num_clu << sbi->cluster_size_bits); in exfat_read_root()
402 inode->i_uid = sbi->options.fs_uid; in exfat_read_root()
403 inode->i_gid = sbi->options.fs_gid; in exfat_read_root()
406 inode->i_mode = exfat_make_mode(sbi, EXFAT_ATTR_SUBDIR, 0777); in exfat_read_root()
410 inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; in exfat_read_root()
411 ei->i_pos = ((loff_t)sbi->root_dir << 32) | 0xffffffff; in exfat_read_root()
421 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_calibrate_blocksize() local
435 brelse(sbi->boot_bh); in exfat_calibrate_blocksize()
436 sbi->boot_bh = NULL; in exfat_calibrate_blocksize()
443 sbi->boot_bh = sb_bread(sb, 0); in exfat_calibrate_blocksize()
444 if (!sbi->boot_bh) { in exfat_calibrate_blocksize()
456 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_boot_sector() local
462 sbi->boot_bh = sb_bread(sb, 0); in exfat_read_boot_sector()
463 if (!sbi->boot_bh) { in exfat_read_boot_sector()
467 p_boot = (struct boot_sector *)sbi->boot_bh->b_data; in exfat_read_boot_sector()
511 sbi->sect_per_clus = 1 << p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
512 sbi->sect_per_clus_bits = p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
513 sbi->cluster_size_bits = p_boot->sect_per_clus_bits + in exfat_read_boot_sector()
515 sbi->cluster_size = 1 << sbi->cluster_size_bits; in exfat_read_boot_sector()
516 sbi->num_FAT_sectors = le32_to_cpu(p_boot->fat_length); in exfat_read_boot_sector()
517 sbi->FAT1_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
518 sbi->FAT2_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
520 sbi->FAT2_start_sector += sbi->num_FAT_sectors; in exfat_read_boot_sector()
521 sbi->data_start_sector = le32_to_cpu(p_boot->clu_offset); in exfat_read_boot_sector()
522 sbi->num_sectors = le64_to_cpu(p_boot->vol_length); in exfat_read_boot_sector()
524 sbi->num_clusters = le32_to_cpu(p_boot->clu_count) + in exfat_read_boot_sector()
527 sbi->root_dir = le32_to_cpu(p_boot->root_cluster); in exfat_read_boot_sector()
528 sbi->dentries_per_clu = 1 << in exfat_read_boot_sector()
529 (sbi->cluster_size_bits - DENTRY_SIZE_BITS); in exfat_read_boot_sector()
531 sbi->vol_flags = le16_to_cpu(p_boot->vol_flags); in exfat_read_boot_sector()
532 sbi->vol_flags_persistent = sbi->vol_flags & (VOLUME_DIRTY | MEDIA_FAILURE); in exfat_read_boot_sector()
533 sbi->clu_srch_ptr = EXFAT_FIRST_CLUSTER; in exfat_read_boot_sector()
534 sbi->used_clusters = EXFAT_CLUSTERS_UNTRACKED; in exfat_read_boot_sector()
537 if ((u64)sbi->num_FAT_sectors << p_boot->sect_size_bits < in exfat_read_boot_sector()
538 (u64)sbi->num_clusters * 4) { in exfat_read_boot_sector()
543 if (sbi->data_start_sector < in exfat_read_boot_sector()
544 (u64)sbi->FAT1_start_sector + in exfat_read_boot_sector()
545 (u64)sbi->num_FAT_sectors * p_boot->num_fats) { in exfat_read_boot_sector()
550 if (sbi->vol_flags & VOLUME_DIRTY) in exfat_read_boot_sector()
552 if (sbi->vol_flags & MEDIA_FAILURE) in exfat_read_boot_sector()
556 sb->s_maxbytes = (u64)(sbi->num_clusters - EXFAT_RESERVED_CLUSTERS) << in exfat_read_boot_sector()
557 sbi->cluster_size_bits; in exfat_read_boot_sector()
614 struct exfat_sb_info *sbi = EXFAT_SB(sb); in __exfat_fill_super() local
640 ret = exfat_count_used_clusters(sb, &sbi->used_clusters); in __exfat_fill_super()
649 exfat_free_bitmap(sbi); in __exfat_fill_super()
651 brelse(sbi->boot_bh); in __exfat_fill_super()
657 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_fill_super() local
658 struct exfat_mount_options *opts = &sbi->options; in exfat_fill_super()
687 if (!strcmp(sbi->options.iocharset, "utf8")) in exfat_fill_super()
690 sbi->nls_io = load_nls(sbi->options.iocharset); in exfat_fill_super()
691 if (!sbi->nls_io) { in exfat_fill_super()
693 sbi->options.iocharset); in exfat_fill_super()
699 if (sbi->options.utf8) in exfat_fill_super()
736 exfat_free_bitmap(sbi); in exfat_fill_super()
737 brelse(sbi->boot_bh); in exfat_fill_super()
748 static void exfat_free_sbi(struct exfat_sb_info *sbi) in exfat_free_sbi() argument
750 exfat_free_iocharset(sbi); in exfat_free_sbi()
751 kfree(sbi); in exfat_free_sbi()
756 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_free() local
758 if (sbi) in exfat_free()
759 exfat_free_sbi(sbi); in exfat_free()
780 struct exfat_sb_info *sbi; in exfat_init_fs_context() local
782 sbi = kzalloc(sizeof(struct exfat_sb_info), GFP_KERNEL); in exfat_init_fs_context()
783 if (!sbi) in exfat_init_fs_context()
786 mutex_init(&sbi->s_lock); in exfat_init_fs_context()
787 mutex_init(&sbi->bitmap_lock); in exfat_init_fs_context()
788 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL, in exfat_init_fs_context()
791 sbi->options.fs_uid = current_uid(); in exfat_init_fs_context()
792 sbi->options.fs_gid = current_gid(); in exfat_init_fs_context()
793 sbi->options.fs_fmask = current->fs->umask; in exfat_init_fs_context()
794 sbi->options.fs_dmask = current->fs->umask; in exfat_init_fs_context()
795 sbi->options.allow_utime = -1; in exfat_init_fs_context()
796 sbi->options.iocharset = exfat_default_iocharset; in exfat_init_fs_context()
797 sbi->options.errors = EXFAT_ERRORS_RO; in exfat_init_fs_context()
799 fc->s_fs_info = sbi; in exfat_init_fs_context()
806 struct exfat_sb_info *sbi = container_of(p, struct exfat_sb_info, rcu); in delayed_free() local
808 unload_nls(sbi->nls_io); in delayed_free()
809 exfat_free_upcase_table(sbi); in delayed_free()
810 exfat_free_sbi(sbi); in delayed_free()
815 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_kill_sb() local
818 if (sbi) in exfat_kill_sb()
819 call_rcu(&sbi->rcu, delayed_free); in exfat_kill_sb()