Lines Matching refs: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()
43 unload_nls(sbi->nls_io); in exfat_put_super()
44 exfat_free_upcase_table(sbi); in exfat_put_super()
49 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()
253 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_parse_param() local
254 struct exfat_mount_options *opts = &sbi->options; in exfat_parse_param()
283 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) >> 9; in exfat_read_root()
368 ei->i_pos = ((loff_t)sbi->root_dir << 32) | 0xffffffff; in exfat_read_root()
380 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_calibrate_blocksize() local
394 brelse(sbi->boot_bh); in exfat_calibrate_blocksize()
395 sbi->boot_bh = NULL; in exfat_calibrate_blocksize()
402 sbi->boot_bh = sb_bread(sb, 0); in exfat_calibrate_blocksize()
403 if (!sbi->boot_bh) { in exfat_calibrate_blocksize()
415 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_boot_sector() local
421 sbi->boot_bh = sb_bread(sb, 0); in exfat_read_boot_sector()
422 if (!sbi->boot_bh) { in exfat_read_boot_sector()
426 p_boot = (struct boot_sector *)sbi->boot_bh->b_data; in exfat_read_boot_sector()
470 sbi->sect_per_clus = 1 << p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
471 sbi->sect_per_clus_bits = p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
472 sbi->cluster_size_bits = p_boot->sect_per_clus_bits + in exfat_read_boot_sector()
474 sbi->cluster_size = 1 << sbi->cluster_size_bits; in exfat_read_boot_sector()
475 sbi->num_FAT_sectors = le32_to_cpu(p_boot->fat_length); in exfat_read_boot_sector()
476 sbi->FAT1_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
477 sbi->FAT2_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
479 sbi->FAT2_start_sector += sbi->num_FAT_sectors; in exfat_read_boot_sector()
480 sbi->data_start_sector = le32_to_cpu(p_boot->clu_offset); in exfat_read_boot_sector()
481 sbi->num_sectors = le64_to_cpu(p_boot->vol_length); in exfat_read_boot_sector()
483 sbi->num_clusters = le32_to_cpu(p_boot->clu_count) + in exfat_read_boot_sector()
486 sbi->root_dir = le32_to_cpu(p_boot->root_cluster); in exfat_read_boot_sector()
487 sbi->dentries_per_clu = 1 << in exfat_read_boot_sector()
488 (sbi->cluster_size_bits - DENTRY_SIZE_BITS); in exfat_read_boot_sector()
490 sbi->vol_flags = le16_to_cpu(p_boot->vol_flags); in exfat_read_boot_sector()
491 sbi->vol_flags_persistent = sbi->vol_flags & (VOLUME_DIRTY | MEDIA_FAILURE); in exfat_read_boot_sector()
492 sbi->clu_srch_ptr = EXFAT_FIRST_CLUSTER; in exfat_read_boot_sector()
493 sbi->used_clusters = EXFAT_CLUSTERS_UNTRACKED; in exfat_read_boot_sector()
496 if ((u64)sbi->num_FAT_sectors << p_boot->sect_size_bits < in exfat_read_boot_sector()
497 (u64)sbi->num_clusters * 4) { in exfat_read_boot_sector()
502 if (sbi->data_start_sector < in exfat_read_boot_sector()
503 (u64)sbi->FAT1_start_sector + in exfat_read_boot_sector()
504 (u64)sbi->num_FAT_sectors * p_boot->num_fats) { in exfat_read_boot_sector()
509 if (sbi->vol_flags & VOLUME_DIRTY) in exfat_read_boot_sector()
511 if (sbi->vol_flags & MEDIA_FAILURE) in exfat_read_boot_sector()
515 sb->s_maxbytes = (u64)(sbi->num_clusters - EXFAT_RESERVED_CLUSTERS) << in exfat_read_boot_sector()
516 sbi->cluster_size_bits; in exfat_read_boot_sector()
573 struct exfat_sb_info *sbi = EXFAT_SB(sb); in __exfat_fill_super() local
599 ret = exfat_count_used_clusters(sb, &sbi->used_clusters); in __exfat_fill_super()
608 exfat_free_bitmap(sbi); in __exfat_fill_super()
610 exfat_free_upcase_table(sbi); in __exfat_fill_super()
612 brelse(sbi->boot_bh); in __exfat_fill_super()
618 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_fill_super() local
619 struct exfat_mount_options *opts = &sbi->options; in exfat_fill_super()
648 if (!strcmp(sbi->options.iocharset, "utf8")) in exfat_fill_super()
651 sbi->nls_io = load_nls(sbi->options.iocharset); in exfat_fill_super()
652 if (!sbi->nls_io) { in exfat_fill_super()
654 sbi->options.iocharset); in exfat_fill_super()
660 if (sbi->options.utf8) in exfat_fill_super()
697 exfat_free_upcase_table(sbi); in exfat_fill_super()
698 exfat_free_bitmap(sbi); in exfat_fill_super()
699 brelse(sbi->boot_bh); in exfat_fill_super()
702 unload_nls(sbi->nls_io); in exfat_fill_super()
711 static void exfat_free_sbi(struct exfat_sb_info *sbi) in exfat_free_sbi() argument
713 exfat_free_iocharset(sbi); in exfat_free_sbi()
714 kfree(sbi); in exfat_free_sbi()
719 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_free() local
721 if (sbi) in exfat_free()
722 exfat_free_sbi(sbi); in exfat_free()
743 struct exfat_sb_info *sbi; in exfat_init_fs_context() local
745 sbi = kzalloc(sizeof(struct exfat_sb_info), GFP_KERNEL); in exfat_init_fs_context()
746 if (!sbi) in exfat_init_fs_context()
749 mutex_init(&sbi->s_lock); in exfat_init_fs_context()
750 mutex_init(&sbi->bitmap_lock); in exfat_init_fs_context()
751 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL, in exfat_init_fs_context()
754 sbi->options.fs_uid = current_uid(); in exfat_init_fs_context()
755 sbi->options.fs_gid = current_gid(); in exfat_init_fs_context()
756 sbi->options.fs_fmask = current->fs->umask; in exfat_init_fs_context()
757 sbi->options.fs_dmask = current->fs->umask; in exfat_init_fs_context()
758 sbi->options.allow_utime = -1; in exfat_init_fs_context()
759 sbi->options.iocharset = exfat_default_iocharset; in exfat_init_fs_context()
760 sbi->options.errors = EXFAT_ERRORS_RO; in exfat_init_fs_context()
762 fc->s_fs_info = sbi; in exfat_init_fs_context()
769 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_kill_sb() local
772 if (sbi) in exfat_kill_sb()
773 exfat_free_sbi(sbi); in exfat_kill_sb()