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()
649 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_setup_super() local
659 if (!(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_setup_super()
663 else if ((sbi->s_mount_state & EXT2_ERROR_FS)) in ext2_setup_super()
687 sbi->s_frag_size, in ext2_setup_super()
688 sbi->s_groups_count, in ext2_setup_super()
691 sbi->s_mount_opt); in ext2_setup_super()
698 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_check_descriptors() local
702 for (i = 0; i < sbi->s_groups_count; i++) { in ext2_check_descriptors()
707 if (i == sbi->s_groups_count - 1) in ext2_check_descriptors()
708 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; in ext2_check_descriptors()
732 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 > in ext2_check_descriptors()
807 struct ext2_sb_info *sbi = EXT2_SB(sb); in descriptor_loc() local
811 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); in descriptor_loc()
816 bg = sbi->s_desc_per_block * nr; in descriptor_loc()
827 struct ext2_sb_info * sbi; in ext2_fill_super() local
843 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in ext2_fill_super()
844 if (!sbi) in ext2_fill_super()
847 sbi->s_blockgroup_lock = in ext2_fill_super()
849 if (!sbi->s_blockgroup_lock) { in ext2_fill_super()
850 kfree(sbi); in ext2_fill_super()
853 sb->s_fs_info = sbi; in ext2_fill_super()
854 sbi->s_sb_block = sb_block; in ext2_fill_super()
855 sbi->s_daxdev = dax_dev; in ext2_fill_super()
857 spin_lock_init(&sbi->s_lock); in ext2_fill_super()
893 sbi->s_es = es; in ext2_fill_super()
917 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) in ext2_fill_super()
919 else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_CONTINUE) in ext2_fill_super()
932 sbi->s_mount_opt = opts.s_mount_opt; in ext2_fill_super()
933 sbi->s_resuid = opts.s_resuid; in ext2_fill_super()
934 sbi->s_resgid = opts.s_resgid; in ext2_fill_super()
966 blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); in ext2_fill_super()
972 clear_opt(sbi->s_mount_opt, DAX); in ext2_fill_super()
995 sbi->s_es = es; in ext2_fill_super()
1008 sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; in ext2_fill_super()
1009 sbi->s_first_ino = EXT2_GOOD_OLD_FIRST_INO; in ext2_fill_super()
1011 sbi->s_inode_size = le16_to_cpu(es->s_inode_size); in ext2_fill_super()
1012 sbi->s_first_ino = le32_to_cpu(es->s_first_ino); in ext2_fill_super()
1013 if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || in ext2_fill_super()
1014 !is_power_of_2(sbi->s_inode_size) || in ext2_fill_super()
1015 (sbi->s_inode_size > blocksize)) { in ext2_fill_super()
1018 sbi->s_inode_size); in ext2_fill_super()
1023 sbi->s_frag_size = EXT2_MIN_FRAG_SIZE << in ext2_fill_super()
1025 if (sbi->s_frag_size == 0) in ext2_fill_super()
1027 sbi->s_frags_per_block = sb->s_blocksize / sbi->s_frag_size; in ext2_fill_super()
1029 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); in ext2_fill_super()
1030 sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group); in ext2_fill_super()
1031 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); in ext2_fill_super()
1033 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb); in ext2_fill_super()
1034 if (sbi->s_inodes_per_block == 0 || sbi->s_inodes_per_group == 0) in ext2_fill_super()
1036 sbi->s_itb_per_group = sbi->s_inodes_per_group / in ext2_fill_super()
1037 sbi->s_inodes_per_block; in ext2_fill_super()
1038 sbi->s_desc_per_block = sb->s_blocksize / in ext2_fill_super()
1040 sbi->s_sbh = bh; in ext2_fill_super()
1041 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_fill_super()
1042 sbi->s_addr_per_block_bits = in ext2_fill_super()
1044 sbi->s_desc_per_block_bits = in ext2_fill_super()
1056 if (sb->s_blocksize != sbi->s_frag_size) { in ext2_fill_super()
1060 sbi->s_frag_size, sb->s_blocksize); in ext2_fill_super()
1064 if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1067 sbi->s_blocks_per_group); in ext2_fill_super()
1070 if (sbi->s_frags_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1073 sbi->s_frags_per_group); in ext2_fill_super()
1076 if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1079 sbi->s_inodes_per_group); in ext2_fill_super()
1085 sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - in ext2_fill_super()
1088 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / in ext2_fill_super()
1090 sbi->s_group_desc = kmalloc_array (db_count, in ext2_fill_super()
1093 if (sbi->s_group_desc == NULL) { in ext2_fill_super()
1098 bgl_lock_init(sbi->s_blockgroup_lock); in ext2_fill_super()
1099 sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); in ext2_fill_super()
1100 if (!sbi->s_debts) { in ext2_fill_super()
1107 sbi->s_group_desc[i] = sb_bread(sb, block); in ext2_fill_super()
1108 if (!sbi->s_group_desc[i]) { in ext2_fill_super()
1110 brelse (sbi->s_group_desc[j]); in ext2_fill_super()
1120 sbi->s_gdb_count = db_count; in ext2_fill_super()
1121 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); in ext2_fill_super()
1122 spin_lock_init(&sbi->s_next_gen_lock); in ext2_fill_super()
1125 spin_lock_init(&sbi->s_rsv_window_lock); in ext2_fill_super()
1126 sbi->s_rsv_window_root = RB_ROOT; in ext2_fill_super()
1133 sbi->s_rsv_window_head.rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1134 sbi->s_rsv_window_head.rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1135 sbi->s_rsv_window_head.rsv_alloc_hit = 0; in ext2_fill_super()
1136 sbi->s_rsv_window_head.rsv_goal_size = 0; in ext2_fill_super()
1137 ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); in ext2_fill_super()
1139 err = percpu_counter_init(&sbi->s_freeblocks_counter, in ext2_fill_super()
1142 err = percpu_counter_init(&sbi->s_freeinodes_counter, in ext2_fill_super()
1146 err = percpu_counter_init(&sbi->s_dirs_counter, in ext2_fill_super()
1155 sbi->s_ea_block_cache = ext2_xattr_create_cache(); in ext2_fill_super()
1156 if (!sbi->s_ea_block_cache) { in ext2_fill_super()
1207 ext2_xattr_destroy_cache(sbi->s_ea_block_cache); in ext2_fill_super()
1208 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_fill_super()
1209 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_fill_super()
1210 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_fill_super()
1213 brelse(sbi->s_group_desc[i]); in ext2_fill_super()
1215 kfree(sbi->s_group_desc); in ext2_fill_super()
1216 kfree(sbi->s_debts); in ext2_fill_super()
1221 kfree(sbi->s_blockgroup_lock); in ext2_fill_super()
1222 kfree(sbi); in ext2_fill_super()
1275 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_sync_fs() local
1284 spin_lock(&sbi->s_lock); in ext2_sync_fs()
1289 spin_unlock(&sbi->s_lock); in ext2_sync_fs()
1296 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_freeze() local
1308 spin_lock(&sbi->s_lock); in ext2_freeze()
1309 sbi->s_es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_freeze()
1310 spin_unlock(&sbi->s_lock); in ext2_freeze()
1311 ext2_sync_super(sb, sbi->s_es, 1); in ext2_freeze()
1332 struct ext2_sb_info * sbi = EXT2_SB(sb); in ext2_remount() local
1339 spin_lock(&sbi->s_lock); in ext2_remount()
1340 new_opts.s_mount_opt = sbi->s_mount_opt; in ext2_remount()
1341 new_opts.s_resuid = sbi->s_resuid; in ext2_remount()
1342 new_opts.s_resgid = sbi->s_resgid; in ext2_remount()
1343 spin_unlock(&sbi->s_lock); in ext2_remount()
1348 spin_lock(&sbi->s_lock); in ext2_remount()
1349 es = sbi->s_es; in ext2_remount()
1350 if ((sbi->s_mount_opt ^ new_opts.s_mount_opt) & EXT2_MOUNT_DAX) { in ext2_remount()
1359 !(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_remount()
1366 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_remount()
1368 spin_unlock(&sbi->s_lock); in ext2_remount()
1379 spin_unlock(&sbi->s_lock); in ext2_remount()
1391 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_remount()
1394 spin_unlock(&sbi->s_lock); in ext2_remount()
1401 spin_lock(&sbi->s_lock); in ext2_remount()
1403 sbi->s_mount_opt = new_opts.s_mount_opt; in ext2_remount()
1404 sbi->s_resuid = new_opts.s_resuid; in ext2_remount()
1405 sbi->s_resgid = new_opts.s_resgid; in ext2_remount()
1408 spin_unlock(&sbi->s_lock); in ext2_remount()
1416 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_statfs() local
1417 struct ext2_super_block *es = sbi->s_es; in ext2_statfs()
1420 spin_lock(&sbi->s_lock); in ext2_statfs()
1423 sbi->s_overhead_last = 0; in ext2_statfs()
1424 else if (sbi->s_blocks_last != le32_to_cpu(es->s_blocks_count)) { in ext2_statfs()
1445 for (i = 0; i < sbi->s_groups_count; i++) in ext2_statfs()
1453 overhead += (sbi->s_groups_count * in ext2_statfs()
1454 (2 + sbi->s_itb_per_group)); in ext2_statfs()
1455 sbi->s_overhead_last = overhead; in ext2_statfs()
1457 sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count); in ext2_statfs()
1462 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; in ext2_statfs()
1476 spin_unlock(&sbi->s_lock); in ext2_statfs()