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
71 buf->f_bsize = sbi->cluster_size; in exfat_statfs()
72 buf->f_blocks = sbi->num_clusters - 2; /* clu 0 & 1 */ in exfat_statfs()
73 buf->f_bfree = buf->f_blocks - sbi->used_clusters; in exfat_statfs()
83 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_vol_flags() local
84 struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data; in exfat_set_vol_flags()
87 new_flags |= sbi->vol_flags_persistent; in exfat_set_vol_flags()
90 if (sbi->vol_flags == new_flags) in exfat_set_vol_flags()
93 sbi->vol_flags = new_flags; in exfat_set_vol_flags()
103 set_buffer_uptodate(sbi->boot_bh); in exfat_set_vol_flags()
104 mark_buffer_dirty(sbi->boot_bh); in exfat_set_vol_flags()
106 __sync_dirty_buffer(sbi->boot_bh, REQ_SYNC | REQ_FUA | REQ_PREFLUSH); in exfat_set_vol_flags()
113 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_volume_dirty() local
115 return exfat_set_vol_flags(sb, sbi->vol_flags | VOLUME_DIRTY); in exfat_set_volume_dirty()
120 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_clear_volume_dirty() local
122 return exfat_set_vol_flags(sb, sbi->vol_flags & ~VOLUME_DIRTY); in exfat_clear_volume_dirty()
128 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_show_options() local
129 struct exfat_mount_options *opts = &sbi->options; in exfat_show_options()
143 else if (sbi->nls_io) in exfat_show_options()
144 seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); in exfat_show_options()
167 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_force_shutdown() local
168 struct exfat_mount_options *opts = &sbi->options; in exfat_force_shutdown()
180 set_bit(EXFAT_FLAGS_SHUTDOWN, &sbi->s_exfat_flags); in exfat_force_shutdown()
183 set_bit(EXFAT_FLAGS_SHUTDOWN, &sbi->s_exfat_flags); in exfat_force_shutdown()
284 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_parse_param() local
285 struct exfat_mount_options *opts = &sbi->options; in exfat_parse_param()
314 exfat_free_iocharset(sbi); in exfat_parse_param()
356 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_hash_init() local
359 spin_lock_init(&sbi->inode_hash_lock); in exfat_hash_init()
361 INIT_HLIST_HEAD(&sbi->inode_hashtable[i]); in exfat_hash_init()
367 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_root() local
372 exfat_chain_set(&ei->dir, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_read_root()
374 ei->start_clu = sbi->root_dir; in exfat_read_root()
380 ei->hint_stat.clu = sbi->root_dir; in exfat_read_root()
383 exfat_chain_set(&cdir, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_read_root()
386 i_size_write(inode, num_clu << sbi->cluster_size_bits); in exfat_read_root()
393 inode->i_uid = sbi->options.fs_uid; in exfat_read_root()
394 inode->i_gid = sbi->options.fs_gid; in exfat_read_root()
397 inode->i_mode = exfat_make_mode(sbi, EXFAT_ATTR_SUBDIR, 0777); in exfat_read_root()
401 inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; in exfat_read_root()
402 ei->i_pos = ((loff_t)sbi->root_dir << 32) | 0xffffffff; in exfat_read_root()
412 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_calibrate_blocksize() local
426 brelse(sbi->boot_bh); in exfat_calibrate_blocksize()
427 sbi->boot_bh = NULL; in exfat_calibrate_blocksize()
434 sbi->boot_bh = sb_bread(sb, 0); in exfat_calibrate_blocksize()
435 if (!sbi->boot_bh) { in exfat_calibrate_blocksize()
447 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_boot_sector() local
453 sbi->boot_bh = sb_bread(sb, 0); in exfat_read_boot_sector()
454 if (!sbi->boot_bh) { in exfat_read_boot_sector()
458 p_boot = (struct boot_sector *)sbi->boot_bh->b_data; in exfat_read_boot_sector()
502 sbi->sect_per_clus = 1 << p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
503 sbi->sect_per_clus_bits = p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
504 sbi->cluster_size_bits = p_boot->sect_per_clus_bits + in exfat_read_boot_sector()
506 sbi->cluster_size = 1 << sbi->cluster_size_bits; in exfat_read_boot_sector()
507 sbi->num_FAT_sectors = le32_to_cpu(p_boot->fat_length); in exfat_read_boot_sector()
508 sbi->FAT1_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
509 sbi->FAT2_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
511 sbi->FAT2_start_sector += sbi->num_FAT_sectors; in exfat_read_boot_sector()
512 sbi->data_start_sector = le32_to_cpu(p_boot->clu_offset); in exfat_read_boot_sector()
513 sbi->num_sectors = le64_to_cpu(p_boot->vol_length); in exfat_read_boot_sector()
515 sbi->num_clusters = le32_to_cpu(p_boot->clu_count) + in exfat_read_boot_sector()
518 sbi->root_dir = le32_to_cpu(p_boot->root_cluster); in exfat_read_boot_sector()
519 sbi->dentries_per_clu = 1 << in exfat_read_boot_sector()
520 (sbi->cluster_size_bits - DENTRY_SIZE_BITS); in exfat_read_boot_sector()
522 sbi->vol_flags = le16_to_cpu(p_boot->vol_flags); in exfat_read_boot_sector()
523 sbi->vol_flags_persistent = sbi->vol_flags & (VOLUME_DIRTY | MEDIA_FAILURE); in exfat_read_boot_sector()
524 sbi->clu_srch_ptr = EXFAT_FIRST_CLUSTER; in exfat_read_boot_sector()
527 if ((u64)sbi->num_FAT_sectors << p_boot->sect_size_bits < in exfat_read_boot_sector()
528 (u64)sbi->num_clusters * 4) { in exfat_read_boot_sector()
533 if (sbi->data_start_sector < in exfat_read_boot_sector()
534 (u64)sbi->FAT1_start_sector + in exfat_read_boot_sector()
535 (u64)sbi->num_FAT_sectors * p_boot->num_fats) { in exfat_read_boot_sector()
540 if (sbi->vol_flags & VOLUME_DIRTY) in exfat_read_boot_sector()
542 if (sbi->vol_flags & MEDIA_FAILURE) in exfat_read_boot_sector()
546 sb->s_maxbytes = (u64)(sbi->num_clusters - EXFAT_RESERVED_CLUSTERS) << in exfat_read_boot_sector()
547 sbi->cluster_size_bits; in exfat_read_boot_sector()
604 struct exfat_sb_info *sbi = EXFAT_SB(sb); in __exfat_fill_super() local
630 ret = exfat_count_used_clusters(sb, &sbi->used_clusters); in __exfat_fill_super()
639 exfat_free_bitmap(sbi); in __exfat_fill_super()
641 brelse(sbi->boot_bh); in __exfat_fill_super()
647 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_fill_super() local
648 struct exfat_mount_options *opts = &sbi->options; in exfat_fill_super()
677 if (!strcmp(sbi->options.iocharset, "utf8")) in exfat_fill_super()
680 sbi->nls_io = load_nls(sbi->options.iocharset); in exfat_fill_super()
681 if (!sbi->nls_io) { in exfat_fill_super()
683 sbi->options.iocharset); in exfat_fill_super()
689 if (sbi->options.utf8) in exfat_fill_super()
726 exfat_free_bitmap(sbi); in exfat_fill_super()
727 brelse(sbi->boot_bh); in exfat_fill_super()
738 static void exfat_free_sbi(struct exfat_sb_info *sbi) in exfat_free_sbi() argument
740 exfat_free_iocharset(sbi); in exfat_free_sbi()
741 kfree(sbi); in exfat_free_sbi()
746 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_free() local
748 if (sbi) in exfat_free()
749 exfat_free_sbi(sbi); in exfat_free()
770 struct exfat_sb_info *sbi; in exfat_init_fs_context() local
772 sbi = kzalloc(sizeof(struct exfat_sb_info), GFP_KERNEL); in exfat_init_fs_context()
773 if (!sbi) in exfat_init_fs_context()
776 mutex_init(&sbi->s_lock); in exfat_init_fs_context()
777 mutex_init(&sbi->bitmap_lock); in exfat_init_fs_context()
778 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL, in exfat_init_fs_context()
781 sbi->options.fs_uid = current_uid(); in exfat_init_fs_context()
782 sbi->options.fs_gid = current_gid(); in exfat_init_fs_context()
783 sbi->options.fs_fmask = current->fs->umask; in exfat_init_fs_context()
784 sbi->options.fs_dmask = current->fs->umask; in exfat_init_fs_context()
785 sbi->options.allow_utime = -1; in exfat_init_fs_context()
786 sbi->options.iocharset = exfat_default_iocharset; in exfat_init_fs_context()
787 sbi->options.errors = EXFAT_ERRORS_RO; in exfat_init_fs_context()
789 fc->s_fs_info = sbi; in exfat_init_fs_context()
796 struct exfat_sb_info *sbi = container_of(p, struct exfat_sb_info, rcu); in delayed_free() local
798 unload_nls(sbi->nls_io); in delayed_free()
799 exfat_free_upcase_table(sbi); in delayed_free()
800 exfat_free_sbi(sbi); in delayed_free()
805 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_kill_sb() local
808 if (sbi) in exfat_kill_sb()
809 call_rcu(&sbi->rcu, delayed_free); in exfat_kill_sb()