Lines Matching refs:sbi

54 	struct ext2_sb_info *sbi = EXT2_SB(sb);  in ext2_error()  local
55 struct ext2_super_block *es = sbi->s_es; in ext2_error()
58 spin_lock(&sbi->s_lock); in ext2_error()
59 sbi->s_mount_state |= EXT2_ERROR_FS; in ext2_error()
61 spin_unlock(&sbi->s_lock); in ext2_error()
148 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_put_super() local
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 brelse(sbi->s_group_desc[i]); in ext2_put_super()
166 kfree(sbi->s_group_desc); in ext2_put_super()
167 kfree(sbi->s_debts); in ext2_put_super()
168 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_put_super()
169 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_put_super()
170 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_put_super()
171 brelse (sbi->s_sbh); in ext2_put_super()
173 kfree(sbi->s_blockgroup_lock); in ext2_put_super()
174 fs_put_dax(sbi->s_daxdev); in ext2_put_super()
175 kfree(sbi); in ext2_put_super()
242 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_show_options() local
243 struct ext2_super_block *es = sbi->s_es; in ext2_show_options()
246 spin_lock(&sbi->s_lock); in ext2_show_options()
249 if (sbi->s_sb_block != 1) in ext2_show_options()
250 seq_printf(seq, ",sb=%lu", sbi->s_sb_block); in ext2_show_options()
257 if (!uid_eq(sbi->s_resuid, make_kuid(&init_user_ns, EXT2_DEF_RESUID)) || in ext2_show_options()
260 from_kuid_munged(&init_user_ns, sbi->s_resuid)); in ext2_show_options()
262 if (!gid_eq(sbi->s_resgid, make_kgid(&init_user_ns, EXT2_DEF_RESGID)) || in ext2_show_options()
265 from_kgid_munged(&init_user_ns, sbi->s_resgid)); in ext2_show_options()
320 spin_unlock(&sbi->s_lock); in ext2_show_options()
641 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_setup_super() local
651 if (!(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_setup_super()
655 else if ((sbi->s_mount_state & EXT2_ERROR_FS)) in ext2_setup_super()
679 sbi->s_frag_size, in ext2_setup_super()
680 sbi->s_groups_count, in ext2_setup_super()
683 sbi->s_mount_opt); in ext2_setup_super()
690 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_check_descriptors() local
694 for (i = 0; i < sbi->s_groups_count; i++) { in ext2_check_descriptors()
718 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 > in ext2_check_descriptors()
797 struct ext2_sb_info *sbi = EXT2_SB(sb); in descriptor_loc() local
800 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); in descriptor_loc()
805 bg = sbi->s_desc_per_block * nr; in descriptor_loc()
814 struct ext2_sb_info * sbi; in ext2_fill_super() local
830 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in ext2_fill_super()
831 if (!sbi) in ext2_fill_super()
834 sbi->s_blockgroup_lock = in ext2_fill_super()
836 if (!sbi->s_blockgroup_lock) { in ext2_fill_super()
837 kfree(sbi); in ext2_fill_super()
840 sb->s_fs_info = sbi; in ext2_fill_super()
841 sbi->s_sb_block = sb_block; in ext2_fill_super()
842 sbi->s_daxdev = dax_dev; in ext2_fill_super()
844 spin_lock_init(&sbi->s_lock); in ext2_fill_super()
880 sbi->s_es = es; in ext2_fill_super()
904 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) in ext2_fill_super()
906 else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_CONTINUE) in ext2_fill_super()
919 sbi->s_mount_opt = opts.s_mount_opt; in ext2_fill_super()
920 sbi->s_resuid = opts.s_resuid; in ext2_fill_super()
921 sbi->s_resgid = opts.s_resgid; in ext2_fill_super()
953 blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); in ext2_fill_super()
959 clear_opt(sbi->s_mount_opt, DAX); in ext2_fill_super()
982 sbi->s_es = es; in ext2_fill_super()
995 sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; in ext2_fill_super()
996 sbi->s_first_ino = EXT2_GOOD_OLD_FIRST_INO; in ext2_fill_super()
998 sbi->s_inode_size = le16_to_cpu(es->s_inode_size); in ext2_fill_super()
999 sbi->s_first_ino = le32_to_cpu(es->s_first_ino); in ext2_fill_super()
1000 if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || in ext2_fill_super()
1001 !is_power_of_2(sbi->s_inode_size) || in ext2_fill_super()
1002 (sbi->s_inode_size > blocksize)) { in ext2_fill_super()
1005 sbi->s_inode_size); in ext2_fill_super()
1010 sbi->s_frag_size = EXT2_MIN_FRAG_SIZE << in ext2_fill_super()
1012 if (sbi->s_frag_size == 0) in ext2_fill_super()
1014 sbi->s_frags_per_block = sb->s_blocksize / sbi->s_frag_size; in ext2_fill_super()
1016 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); in ext2_fill_super()
1017 sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group); in ext2_fill_super()
1018 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); in ext2_fill_super()
1020 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb); in ext2_fill_super()
1021 if (sbi->s_inodes_per_block == 0 || sbi->s_inodes_per_group == 0) in ext2_fill_super()
1023 sbi->s_itb_per_group = sbi->s_inodes_per_group / in ext2_fill_super()
1024 sbi->s_inodes_per_block; in ext2_fill_super()
1025 sbi->s_desc_per_block = sb->s_blocksize / in ext2_fill_super()
1027 sbi->s_sbh = bh; in ext2_fill_super()
1028 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_fill_super()
1029 sbi->s_addr_per_block_bits = in ext2_fill_super()
1031 sbi->s_desc_per_block_bits = in ext2_fill_super()
1043 if (sb->s_blocksize != sbi->s_frag_size) { in ext2_fill_super()
1047 sbi->s_frag_size, sb->s_blocksize); in ext2_fill_super()
1051 if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1054 sbi->s_blocks_per_group); in ext2_fill_super()
1057 if (sbi->s_frags_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1060 sbi->s_frags_per_group); in ext2_fill_super()
1063 if (sbi->s_inodes_per_group < sbi->s_inodes_per_block || in ext2_fill_super()
1064 sbi->s_inodes_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1067 sbi->s_inodes_per_group); in ext2_fill_super()
1073 sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - in ext2_fill_super()
1076 if ((u64)sbi->s_groups_count * sbi->s_inodes_per_group != in ext2_fill_super()
1080 (u64)sbi->s_groups_count * sbi->s_inodes_per_group); in ext2_fill_super()
1083 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / in ext2_fill_super()
1085 sbi->s_group_desc = kmalloc_array (db_count, in ext2_fill_super()
1088 if (sbi->s_group_desc == NULL) { in ext2_fill_super()
1093 bgl_lock_init(sbi->s_blockgroup_lock); in ext2_fill_super()
1094 sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); in ext2_fill_super()
1095 if (!sbi->s_debts) { in ext2_fill_super()
1102 sbi->s_group_desc[i] = sb_bread(sb, block); in ext2_fill_super()
1103 if (!sbi->s_group_desc[i]) { in ext2_fill_super()
1105 brelse (sbi->s_group_desc[j]); in ext2_fill_super()
1115 sbi->s_gdb_count = db_count; in ext2_fill_super()
1116 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); in ext2_fill_super()
1117 spin_lock_init(&sbi->s_next_gen_lock); in ext2_fill_super()
1120 spin_lock_init(&sbi->s_rsv_window_lock); in ext2_fill_super()
1121 sbi->s_rsv_window_root = RB_ROOT; in ext2_fill_super()
1128 sbi->s_rsv_window_head.rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1129 sbi->s_rsv_window_head.rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1130 sbi->s_rsv_window_head.rsv_alloc_hit = 0; in ext2_fill_super()
1131 sbi->s_rsv_window_head.rsv_goal_size = 0; in ext2_fill_super()
1132 ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); in ext2_fill_super()
1134 err = percpu_counter_init(&sbi->s_freeblocks_counter, in ext2_fill_super()
1137 err = percpu_counter_init(&sbi->s_freeinodes_counter, in ext2_fill_super()
1141 err = percpu_counter_init(&sbi->s_dirs_counter, in ext2_fill_super()
1151 sbi->s_ea_block_cache = ext2_xattr_create_cache(); in ext2_fill_super()
1152 if (!sbi->s_ea_block_cache) { in ext2_fill_super()
1203 ext2_xattr_destroy_cache(sbi->s_ea_block_cache); in ext2_fill_super()
1204 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_fill_super()
1205 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_fill_super()
1206 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_fill_super()
1209 brelse(sbi->s_group_desc[i]); in ext2_fill_super()
1211 kfree(sbi->s_group_desc); in ext2_fill_super()
1212 kfree(sbi->s_debts); in ext2_fill_super()
1217 kfree(sbi->s_blockgroup_lock); in ext2_fill_super()
1218 kfree(sbi); in ext2_fill_super()
1271 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_sync_fs() local
1280 spin_lock(&sbi->s_lock); in ext2_sync_fs()
1285 spin_unlock(&sbi->s_lock); in ext2_sync_fs()
1292 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_freeze() local
1304 spin_lock(&sbi->s_lock); in ext2_freeze()
1305 sbi->s_es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_freeze()
1306 spin_unlock(&sbi->s_lock); in ext2_freeze()
1307 ext2_sync_super(sb, sbi->s_es, 1); in ext2_freeze()
1328 struct ext2_sb_info * sbi = EXT2_SB(sb); in ext2_remount() local
1335 spin_lock(&sbi->s_lock); in ext2_remount()
1336 new_opts.s_mount_opt = sbi->s_mount_opt; in ext2_remount()
1337 new_opts.s_resuid = sbi->s_resuid; in ext2_remount()
1338 new_opts.s_resgid = sbi->s_resgid; in ext2_remount()
1339 spin_unlock(&sbi->s_lock); in ext2_remount()
1344 spin_lock(&sbi->s_lock); in ext2_remount()
1345 es = sbi->s_es; in ext2_remount()
1346 if ((sbi->s_mount_opt ^ new_opts.s_mount_opt) & EXT2_MOUNT_DAX) { in ext2_remount()
1355 !(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_remount()
1362 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_remount()
1364 spin_unlock(&sbi->s_lock); in ext2_remount()
1375 spin_unlock(&sbi->s_lock); in ext2_remount()
1387 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_remount()
1390 spin_unlock(&sbi->s_lock); in ext2_remount()
1397 spin_lock(&sbi->s_lock); in ext2_remount()
1399 sbi->s_mount_opt = new_opts.s_mount_opt; in ext2_remount()
1400 sbi->s_resuid = new_opts.s_resuid; in ext2_remount()
1401 sbi->s_resgid = new_opts.s_resgid; in ext2_remount()
1404 spin_unlock(&sbi->s_lock); in ext2_remount()
1412 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_statfs() local
1413 struct ext2_super_block *es = sbi->s_es; in ext2_statfs()
1416 spin_lock(&sbi->s_lock); in ext2_statfs()
1419 sbi->s_overhead_last = 0; in ext2_statfs()
1420 else if (sbi->s_blocks_last != le32_to_cpu(es->s_blocks_count)) { in ext2_statfs()
1441 for (i = 0; i < sbi->s_groups_count; i++) in ext2_statfs()
1449 overhead += (sbi->s_groups_count * in ext2_statfs()
1450 (2 + sbi->s_itb_per_group)); in ext2_statfs()
1451 sbi->s_overhead_last = overhead; in ext2_statfs()
1453 sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count); in ext2_statfs()
1458 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; in ext2_statfs()
1471 spin_unlock(&sbi->s_lock); in ext2_statfs()