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 = container_of(p, struct exfat_sb_info, rcu); in exfat_delayed_free() local
38 unload_nls(sbi->nls_io); in exfat_delayed_free()
39 exfat_free_iocharset(sbi); in exfat_delayed_free()
40 exfat_free_upcase_table(sbi); in exfat_delayed_free()
41 kfree(sbi); in exfat_delayed_free()
46 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_put_super() local
48 mutex_lock(&sbi->s_lock); in exfat_put_super()
49 exfat_free_bitmap(sbi); in exfat_put_super()
50 brelse(sbi->boot_bh); in exfat_put_super()
51 mutex_unlock(&sbi->s_lock); in exfat_put_super()
53 call_rcu(&sbi->rcu, exfat_delayed_free); in exfat_put_super()
58 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_sync_fs() local
65 mutex_lock(&sbi->s_lock); in exfat_sync_fs()
69 mutex_unlock(&sbi->s_lock); in exfat_sync_fs()
76 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_statfs() local
79 if (sbi->used_clusters == EXFAT_CLUSTERS_UNTRACKED) { in exfat_statfs()
80 mutex_lock(&sbi->s_lock); in exfat_statfs()
81 if (exfat_count_used_clusters(sb, &sbi->used_clusters)) { in exfat_statfs()
82 mutex_unlock(&sbi->s_lock); in exfat_statfs()
85 mutex_unlock(&sbi->s_lock); in exfat_statfs()
89 buf->f_bsize = sbi->cluster_size; in exfat_statfs()
90 buf->f_blocks = sbi->num_clusters - 2; /* clu 0 & 1 */ in exfat_statfs()
91 buf->f_bfree = buf->f_blocks - sbi->used_clusters; in exfat_statfs()
101 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_vol_flags() local
102 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 set_buffer_uptodate(sbi->boot_bh); in exfat_set_vol_flags()
122 mark_buffer_dirty(sbi->boot_bh); in exfat_set_vol_flags()
124 __sync_dirty_buffer(sbi->boot_bh, REQ_SYNC | REQ_FUA | REQ_PREFLUSH); in exfat_set_vol_flags()
131 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_volume_dirty() local
133 return exfat_set_vol_flags(sb, sbi->vol_flags | VOLUME_DIRTY); in exfat_set_volume_dirty()
138 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_clear_volume_dirty() local
140 return exfat_set_vol_flags(sb, sbi->vol_flags & ~VOLUME_DIRTY); in exfat_clear_volume_dirty()
146 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_show_options() local
147 struct exfat_mount_options *opts = &sbi->options; in exfat_show_options()
161 else if (sbi->nls_io) in exfat_show_options()
162 seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); in exfat_show_options()
262 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_parse_param() local
263 struct exfat_mount_options *opts = &sbi->options; in exfat_parse_param()
292 exfat_free_iocharset(sbi); in exfat_parse_param()
331 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_hash_init() local
334 spin_lock_init(&sbi->inode_hash_lock); in exfat_hash_init()
336 INIT_HLIST_HEAD(&sbi->inode_hashtable[i]); in exfat_hash_init()
342 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_root() local
347 exfat_chain_set(&ei->dir, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_read_root()
349 ei->start_clu = sbi->root_dir; in exfat_read_root()
355 ei->hint_stat.clu = sbi->root_dir; in exfat_read_root()
358 exfat_chain_set(&cdir, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_read_root()
361 i_size_write(inode, num_clu << sbi->cluster_size_bits); in exfat_read_root()
368 inode->i_uid = sbi->options.fs_uid; in exfat_read_root()
369 inode->i_gid = sbi->options.fs_gid; in exfat_read_root()
372 inode->i_mode = exfat_make_mode(sbi, ATTR_SUBDIR, 0777); in exfat_read_root()
376 inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; in exfat_read_root()
377 ei->i_pos = ((loff_t)sbi->root_dir << 32) | 0xffffffff; in exfat_read_root()
390 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_calibrate_blocksize() local
404 brelse(sbi->boot_bh); in exfat_calibrate_blocksize()
405 sbi->boot_bh = NULL; in exfat_calibrate_blocksize()
412 sbi->boot_bh = sb_bread(sb, 0); in exfat_calibrate_blocksize()
413 if (!sbi->boot_bh) { in exfat_calibrate_blocksize()
425 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_boot_sector() local
431 sbi->boot_bh = sb_bread(sb, 0); in exfat_read_boot_sector()
432 if (!sbi->boot_bh) { in exfat_read_boot_sector()
436 p_boot = (struct boot_sector *)sbi->boot_bh->b_data; in exfat_read_boot_sector()
480 sbi->sect_per_clus = 1 << p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
481 sbi->sect_per_clus_bits = p_boot->sect_per_clus_bits; in exfat_read_boot_sector()
482 sbi->cluster_size_bits = p_boot->sect_per_clus_bits + in exfat_read_boot_sector()
484 sbi->cluster_size = 1 << sbi->cluster_size_bits; in exfat_read_boot_sector()
485 sbi->num_FAT_sectors = le32_to_cpu(p_boot->fat_length); in exfat_read_boot_sector()
486 sbi->FAT1_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
487 sbi->FAT2_start_sector = le32_to_cpu(p_boot->fat_offset); in exfat_read_boot_sector()
489 sbi->FAT2_start_sector += sbi->num_FAT_sectors; in exfat_read_boot_sector()
490 sbi->data_start_sector = le32_to_cpu(p_boot->clu_offset); in exfat_read_boot_sector()
491 sbi->num_sectors = le64_to_cpu(p_boot->vol_length); in exfat_read_boot_sector()
493 sbi->num_clusters = le32_to_cpu(p_boot->clu_count) + in exfat_read_boot_sector()
496 sbi->root_dir = le32_to_cpu(p_boot->root_cluster); in exfat_read_boot_sector()
497 sbi->dentries_per_clu = 1 << in exfat_read_boot_sector()
498 (sbi->cluster_size_bits - DENTRY_SIZE_BITS); in exfat_read_boot_sector()
500 sbi->vol_flags = le16_to_cpu(p_boot->vol_flags); in exfat_read_boot_sector()
501 sbi->vol_flags_persistent = sbi->vol_flags & (VOLUME_DIRTY | MEDIA_FAILURE); in exfat_read_boot_sector()
502 sbi->clu_srch_ptr = EXFAT_FIRST_CLUSTER; in exfat_read_boot_sector()
503 sbi->used_clusters = EXFAT_CLUSTERS_UNTRACKED; in exfat_read_boot_sector()
506 if ((u64)sbi->num_FAT_sectors << p_boot->sect_size_bits < in exfat_read_boot_sector()
507 (u64)sbi->num_clusters * 4) { in exfat_read_boot_sector()
512 if (sbi->data_start_sector < in exfat_read_boot_sector()
513 (u64)sbi->FAT1_start_sector + in exfat_read_boot_sector()
514 (u64)sbi->num_FAT_sectors * p_boot->num_fats) { in exfat_read_boot_sector()
519 if (sbi->vol_flags & VOLUME_DIRTY) in exfat_read_boot_sector()
521 if (sbi->vol_flags & MEDIA_FAILURE) in exfat_read_boot_sector()
525 sb->s_maxbytes = (u64)(sbi->num_clusters - EXFAT_RESERVED_CLUSTERS) << in exfat_read_boot_sector()
526 sbi->cluster_size_bits; in exfat_read_boot_sector()
583 struct exfat_sb_info *sbi = EXFAT_SB(sb); in __exfat_fill_super() local
609 ret = exfat_count_used_clusters(sb, &sbi->used_clusters); in __exfat_fill_super()
618 exfat_free_bitmap(sbi); in __exfat_fill_super()
620 exfat_free_upcase_table(sbi); in __exfat_fill_super()
622 brelse(sbi->boot_bh); in __exfat_fill_super()
628 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_fill_super() local
629 struct exfat_mount_options *opts = &sbi->options; in exfat_fill_super()
658 if (!strcmp(sbi->options.iocharset, "utf8")) in exfat_fill_super()
661 sbi->nls_io = load_nls(sbi->options.iocharset); in exfat_fill_super()
662 if (!sbi->nls_io) { in exfat_fill_super()
664 sbi->options.iocharset); in exfat_fill_super()
670 if (sbi->options.utf8) in exfat_fill_super()
707 exfat_free_upcase_table(sbi); in exfat_fill_super()
708 exfat_free_bitmap(sbi); in exfat_fill_super()
709 brelse(sbi->boot_bh); in exfat_fill_super()
712 unload_nls(sbi->nls_io); in exfat_fill_super()
713 exfat_free_iocharset(sbi); in exfat_fill_super()
715 kfree(sbi); in exfat_fill_super()
726 struct exfat_sb_info *sbi = fc->s_fs_info; in exfat_free() local
728 if (sbi) { in exfat_free()
729 exfat_free_iocharset(sbi); in exfat_free()
730 kfree(sbi); in exfat_free()
752 struct exfat_sb_info *sbi; in exfat_init_fs_context() local
754 sbi = kzalloc(sizeof(struct exfat_sb_info), GFP_KERNEL); in exfat_init_fs_context()
755 if (!sbi) in exfat_init_fs_context()
758 mutex_init(&sbi->s_lock); in exfat_init_fs_context()
759 mutex_init(&sbi->bitmap_lock); in exfat_init_fs_context()
760 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL, in exfat_init_fs_context()
763 sbi->options.fs_uid = current_uid(); in exfat_init_fs_context()
764 sbi->options.fs_gid = current_gid(); in exfat_init_fs_context()
765 sbi->options.fs_fmask = current->fs->umask; in exfat_init_fs_context()
766 sbi->options.fs_dmask = current->fs->umask; in exfat_init_fs_context()
767 sbi->options.allow_utime = -1; in exfat_init_fs_context()
768 sbi->options.iocharset = exfat_default_iocharset; in exfat_init_fs_context()
769 sbi->options.errors = EXFAT_ERRORS_RO; in exfat_init_fs_context()
771 fc->s_fs_info = sbi; in exfat_init_fs_context()