Lines Matching refs:sbi

53 	struct ext2_sb_info *sbi = EXT2_SB(sb);  in ext2_error()  local
54 struct ext2_super_block *es = sbi->s_es; in ext2_error()
57 spin_lock(&sbi->s_lock); in ext2_error()
58 sbi->s_mount_state |= EXT2_ERROR_FS; in ext2_error()
60 spin_unlock(&sbi->s_lock); in ext2_error()
147 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_put_super() local
151 if (sbi->s_ea_block_cache) { in ext2_put_super()
152 ext2_xattr_destroy_cache(sbi->s_ea_block_cache); in ext2_put_super()
153 sbi->s_ea_block_cache = NULL; in ext2_put_super()
156 struct ext2_super_block *es = sbi->s_es; in ext2_put_super()
158 spin_lock(&sbi->s_lock); in ext2_put_super()
159 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_put_super()
160 spin_unlock(&sbi->s_lock); in ext2_put_super()
163 db_count = sbi->s_gdb_count; in ext2_put_super()
165 if (sbi->s_group_desc[i]) in ext2_put_super()
166 brelse (sbi->s_group_desc[i]); in ext2_put_super()
167 kfree(sbi->s_group_desc); in ext2_put_super()
168 kfree(sbi->s_debts); in ext2_put_super()
169 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_put_super()
170 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_put_super()
171 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_put_super()
172 brelse (sbi->s_sbh); in ext2_put_super()
174 kfree(sbi->s_blockgroup_lock); in ext2_put_super()
175 fs_put_dax(sbi->s_daxdev); in ext2_put_super()
176 kfree(sbi); in ext2_put_super()
249 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_show_options() local
250 struct ext2_super_block *es = sbi->s_es; in ext2_show_options()
253 spin_lock(&sbi->s_lock); in ext2_show_options()
256 if (sbi->s_sb_block != 1) in ext2_show_options()
257 seq_printf(seq, ",sb=%lu", sbi->s_sb_block); in ext2_show_options()
264 if (!uid_eq(sbi->s_resuid, make_kuid(&init_user_ns, EXT2_DEF_RESUID)) || in ext2_show_options()
267 from_kuid_munged(&init_user_ns, sbi->s_resuid)); in ext2_show_options()
269 if (!gid_eq(sbi->s_resgid, make_kgid(&init_user_ns, EXT2_DEF_RESGID)) || in ext2_show_options()
272 from_kgid_munged(&init_user_ns, sbi->s_resgid)); in ext2_show_options()
313 if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) in ext2_show_options()
316 if (sbi->s_mount_opt & EXT2_MOUNT_GRPQUOTA) in ext2_show_options()
321 if (sbi->s_mount_opt & EXT2_MOUNT_XIP) in ext2_show_options()
323 if (sbi->s_mount_opt & EXT2_MOUNT_DAX) in ext2_show_options()
330 spin_unlock(&sbi->s_lock); in ext2_show_options()
659 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_setup_super() local
669 if (!(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_setup_super()
673 else if ((sbi->s_mount_state & EXT2_ERROR_FS)) in ext2_setup_super()
697 sbi->s_frag_size, in ext2_setup_super()
698 sbi->s_groups_count, in ext2_setup_super()
701 sbi->s_mount_opt); in ext2_setup_super()
708 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_check_descriptors() local
712 for (i = 0; i < sbi->s_groups_count; i++) { in ext2_check_descriptors()
717 if (i == sbi->s_groups_count - 1) in ext2_check_descriptors()
718 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; in ext2_check_descriptors()
742 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 > in ext2_check_descriptors()
806 struct ext2_sb_info *sbi = EXT2_SB(sb); in descriptor_loc() local
810 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); in descriptor_loc()
815 bg = sbi->s_desc_per_block * nr; in descriptor_loc()
826 struct ext2_sb_info * sbi; in ext2_fill_super() local
842 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in ext2_fill_super()
843 if (!sbi) in ext2_fill_super()
846 sbi->s_blockgroup_lock = in ext2_fill_super()
848 if (!sbi->s_blockgroup_lock) { in ext2_fill_super()
849 kfree(sbi); in ext2_fill_super()
852 sb->s_fs_info = sbi; in ext2_fill_super()
853 sbi->s_sb_block = sb_block; in ext2_fill_super()
854 sbi->s_daxdev = dax_dev; in ext2_fill_super()
856 spin_lock_init(&sbi->s_lock); in ext2_fill_super()
892 sbi->s_es = es; in ext2_fill_super()
915 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) in ext2_fill_super()
917 else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_CONTINUE) in ext2_fill_super()
930 sbi->s_mount_opt = opts.s_mount_opt; in ext2_fill_super()
931 sbi->s_resuid = opts.s_resuid; in ext2_fill_super()
932 sbi->s_resgid = opts.s_resgid; in ext2_fill_super()
965 blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); in ext2_fill_super()
967 if (sbi->s_mount_opt & EXT2_MOUNT_DAX) { in ext2_fill_super()
971 sbi->s_mount_opt &= ~EXT2_MOUNT_DAX; in ext2_fill_super()
994 sbi->s_es = es; in ext2_fill_super()
1005 sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; in ext2_fill_super()
1006 sbi->s_first_ino = EXT2_GOOD_OLD_FIRST_INO; in ext2_fill_super()
1008 sbi->s_inode_size = le16_to_cpu(es->s_inode_size); in ext2_fill_super()
1009 sbi->s_first_ino = le32_to_cpu(es->s_first_ino); in ext2_fill_super()
1010 if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || in ext2_fill_super()
1011 !is_power_of_2(sbi->s_inode_size) || in ext2_fill_super()
1012 (sbi->s_inode_size > blocksize)) { in ext2_fill_super()
1015 sbi->s_inode_size); in ext2_fill_super()
1020 sbi->s_frag_size = EXT2_MIN_FRAG_SIZE << in ext2_fill_super()
1022 if (sbi->s_frag_size == 0) in ext2_fill_super()
1024 sbi->s_frags_per_block = sb->s_blocksize / sbi->s_frag_size; in ext2_fill_super()
1026 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); in ext2_fill_super()
1027 sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group); in ext2_fill_super()
1028 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); in ext2_fill_super()
1032 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb); in ext2_fill_super()
1033 if (sbi->s_inodes_per_block == 0 || sbi->s_inodes_per_group == 0) in ext2_fill_super()
1035 sbi->s_itb_per_group = sbi->s_inodes_per_group / in ext2_fill_super()
1036 sbi->s_inodes_per_block; in ext2_fill_super()
1037 sbi->s_desc_per_block = sb->s_blocksize / in ext2_fill_super()
1039 sbi->s_sbh = bh; in ext2_fill_super()
1040 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_fill_super()
1041 sbi->s_addr_per_block_bits = in ext2_fill_super()
1043 sbi->s_desc_per_block_bits = in ext2_fill_super()
1055 if (sb->s_blocksize != sbi->s_frag_size) { in ext2_fill_super()
1059 sbi->s_frag_size, sb->s_blocksize); in ext2_fill_super()
1063 if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1066 sbi->s_blocks_per_group); in ext2_fill_super()
1069 if (sbi->s_frags_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1072 sbi->s_frags_per_group); in ext2_fill_super()
1075 if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1078 sbi->s_inodes_per_group); in ext2_fill_super()
1084 sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - in ext2_fill_super()
1087 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / in ext2_fill_super()
1089 sbi->s_group_desc = kmalloc_array (db_count, in ext2_fill_super()
1092 if (sbi->s_group_desc == NULL) { in ext2_fill_super()
1096 bgl_lock_init(sbi->s_blockgroup_lock); in ext2_fill_super()
1097 sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); in ext2_fill_super()
1098 if (!sbi->s_debts) { in ext2_fill_super()
1104 sbi->s_group_desc[i] = sb_bread(sb, block); in ext2_fill_super()
1105 if (!sbi->s_group_desc[i]) { in ext2_fill_super()
1107 brelse (sbi->s_group_desc[j]); in ext2_fill_super()
1117 sbi->s_gdb_count = db_count; in ext2_fill_super()
1118 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); in ext2_fill_super()
1119 spin_lock_init(&sbi->s_next_gen_lock); in ext2_fill_super()
1122 spin_lock_init(&sbi->s_rsv_window_lock); in ext2_fill_super()
1123 sbi->s_rsv_window_root = RB_ROOT; in ext2_fill_super()
1130 sbi->s_rsv_window_head.rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1131 sbi->s_rsv_window_head.rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1132 sbi->s_rsv_window_head.rsv_alloc_hit = 0; in ext2_fill_super()
1133 sbi->s_rsv_window_head.rsv_goal_size = 0; in ext2_fill_super()
1134 ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); in ext2_fill_super()
1136 err = percpu_counter_init(&sbi->s_freeblocks_counter, in ext2_fill_super()
1139 err = percpu_counter_init(&sbi->s_freeinodes_counter, in ext2_fill_super()
1143 err = percpu_counter_init(&sbi->s_dirs_counter, in ext2_fill_super()
1152 sbi->s_ea_block_cache = ext2_xattr_create_cache(); in ext2_fill_super()
1153 if (!sbi->s_ea_block_cache) { in ext2_fill_super()
1203 if (sbi->s_ea_block_cache) in ext2_fill_super()
1204 ext2_xattr_destroy_cache(sbi->s_ea_block_cache); in ext2_fill_super()
1205 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_fill_super()
1206 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_fill_super()
1207 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_fill_super()
1210 brelse(sbi->s_group_desc[i]); in ext2_fill_super()
1212 kfree(sbi->s_group_desc); in ext2_fill_super()
1213 kfree(sbi->s_debts); in ext2_fill_super()
1218 kfree(sbi->s_blockgroup_lock); in ext2_fill_super()
1219 kfree(sbi); in ext2_fill_super()
1272 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_sync_fs() local
1281 spin_lock(&sbi->s_lock); in ext2_sync_fs()
1286 spin_unlock(&sbi->s_lock); in ext2_sync_fs()
1293 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_freeze() local
1305 spin_lock(&sbi->s_lock); in ext2_freeze()
1306 sbi->s_es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_freeze()
1307 spin_unlock(&sbi->s_lock); in ext2_freeze()
1308 ext2_sync_super(sb, sbi->s_es, 1); in ext2_freeze()
1329 struct ext2_sb_info * sbi = EXT2_SB(sb); in ext2_remount() local
1336 spin_lock(&sbi->s_lock); in ext2_remount()
1337 new_opts.s_mount_opt = sbi->s_mount_opt; in ext2_remount()
1338 new_opts.s_resuid = sbi->s_resuid; in ext2_remount()
1339 new_opts.s_resgid = sbi->s_resgid; in ext2_remount()
1340 spin_unlock(&sbi->s_lock); in ext2_remount()
1345 spin_lock(&sbi->s_lock); in ext2_remount()
1346 es = sbi->s_es; in ext2_remount()
1347 if ((sbi->s_mount_opt ^ new_opts.s_mount_opt) & EXT2_MOUNT_DAX) { in ext2_remount()
1356 !(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_remount()
1363 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_remount()
1365 spin_unlock(&sbi->s_lock); in ext2_remount()
1376 spin_unlock(&sbi->s_lock); in ext2_remount()
1388 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_remount()
1391 spin_unlock(&sbi->s_lock); in ext2_remount()
1398 spin_lock(&sbi->s_lock); in ext2_remount()
1400 sbi->s_mount_opt = new_opts.s_mount_opt; in ext2_remount()
1401 sbi->s_resuid = new_opts.s_resuid; in ext2_remount()
1402 sbi->s_resgid = new_opts.s_resgid; in ext2_remount()
1404 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? SB_POSIXACL : 0); in ext2_remount()
1405 spin_unlock(&sbi->s_lock); in ext2_remount()
1413 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_statfs() local
1414 struct ext2_super_block *es = sbi->s_es; in ext2_statfs()
1417 spin_lock(&sbi->s_lock); in ext2_statfs()
1420 sbi->s_overhead_last = 0; in ext2_statfs()
1421 else if (sbi->s_blocks_last != le32_to_cpu(es->s_blocks_count)) { in ext2_statfs()
1442 for (i = 0; i < sbi->s_groups_count; i++) in ext2_statfs()
1450 overhead += (sbi->s_groups_count * in ext2_statfs()
1451 (2 + sbi->s_itb_per_group)); in ext2_statfs()
1452 sbi->s_overhead_last = overhead; in ext2_statfs()
1454 sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count); in ext2_statfs()
1459 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; in ext2_statfs()
1473 spin_unlock(&sbi->s_lock); in ext2_statfs()