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 kvfree(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, NULL); in ext2_put_super()
175 kfree(sbi); in ext2_put_super()
238 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_show_options() local
239 struct ext2_super_block *es = sbi->s_es; in ext2_show_options()
242 spin_lock(&sbi->s_lock); in ext2_show_options()
245 if (sbi->s_sb_block != 1) in ext2_show_options()
246 seq_printf(seq, ",sb=%lu", sbi->s_sb_block); in ext2_show_options()
253 if (!uid_eq(sbi->s_resuid, make_kuid(&init_user_ns, EXT2_DEF_RESUID)) || in ext2_show_options()
256 from_kuid_munged(&init_user_ns, sbi->s_resuid)); in ext2_show_options()
258 if (!gid_eq(sbi->s_resgid, make_kgid(&init_user_ns, EXT2_DEF_RESGID)) || in ext2_show_options()
261 from_kgid_munged(&init_user_ns, sbi->s_resgid)); in ext2_show_options()
313 spin_unlock(&sbi->s_lock); in ext2_show_options()
636 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_setup_super() local
646 if (!(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_setup_super()
650 else if ((sbi->s_mount_state & EXT2_ERROR_FS)) in ext2_setup_super()
674 sbi->s_groups_count, in ext2_setup_super()
677 sbi->s_mount_opt); in ext2_setup_super()
684 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_check_descriptors() local
688 for (i = 0; i < sbi->s_groups_count; i++) { in ext2_check_descriptors()
712 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 > in ext2_check_descriptors()
791 struct ext2_sb_info *sbi = EXT2_SB(sb); in descriptor_loc() local
794 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); in descriptor_loc()
799 bg = sbi->s_desc_per_block * nr; in descriptor_loc()
807 struct ext2_sb_info * sbi; in ext2_fill_super() local
823 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in ext2_fill_super()
824 if (!sbi) in ext2_fill_super()
827 sbi->s_blockgroup_lock = in ext2_fill_super()
829 if (!sbi->s_blockgroup_lock) { in ext2_fill_super()
830 kfree(sbi); in ext2_fill_super()
833 sb->s_fs_info = sbi; in ext2_fill_super()
834 sbi->s_sb_block = sb_block; in ext2_fill_super()
835 sbi->s_daxdev = fs_dax_get_by_bdev(sb->s_bdev, &sbi->s_dax_part_off, in ext2_fill_super()
838 spin_lock_init(&sbi->s_lock); in ext2_fill_super()
874 sbi->s_es = es; in ext2_fill_super()
898 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) in ext2_fill_super()
900 else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_CONTINUE) in ext2_fill_super()
913 sbi->s_mount_opt = opts.s_mount_opt; in ext2_fill_super()
914 sbi->s_resuid = opts.s_resuid; in ext2_fill_super()
915 sbi->s_resgid = opts.s_resgid; in ext2_fill_super()
954 blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); in ext2_fill_super()
957 if (!sbi->s_daxdev) { in ext2_fill_super()
960 clear_opt(sbi->s_mount_opt, DAX); in ext2_fill_super()
963 clear_opt(sbi->s_mount_opt, DAX); in ext2_fill_super()
986 sbi->s_es = es; in ext2_fill_super()
999 sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; in ext2_fill_super()
1000 sbi->s_first_ino = EXT2_GOOD_OLD_FIRST_INO; in ext2_fill_super()
1002 sbi->s_inode_size = le16_to_cpu(es->s_inode_size); in ext2_fill_super()
1003 sbi->s_first_ino = le32_to_cpu(es->s_first_ino); in ext2_fill_super()
1004 if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || in ext2_fill_super()
1005 !is_power_of_2(sbi->s_inode_size) || in ext2_fill_super()
1006 (sbi->s_inode_size > blocksize)) { in ext2_fill_super()
1009 sbi->s_inode_size); in ext2_fill_super()
1014 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); in ext2_fill_super()
1015 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); in ext2_fill_super()
1017 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb); in ext2_fill_super()
1018 if (sbi->s_inodes_per_block == 0 || sbi->s_inodes_per_group == 0) in ext2_fill_super()
1020 sbi->s_itb_per_group = sbi->s_inodes_per_group / in ext2_fill_super()
1021 sbi->s_inodes_per_block; in ext2_fill_super()
1022 sbi->s_desc_per_block = sb->s_blocksize / in ext2_fill_super()
1024 sbi->s_sbh = bh; in ext2_fill_super()
1025 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_fill_super()
1026 sbi->s_addr_per_block_bits = in ext2_fill_super()
1028 sbi->s_desc_per_block_bits = in ext2_fill_super()
1047 if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1050 sbi->s_blocks_per_group); in ext2_fill_super()
1054 if (sbi->s_blocks_per_group <= sbi->s_itb_per_group + 3) { in ext2_fill_super()
1057 sbi->s_blocks_per_group, sbi->s_inodes_per_group + 3); in ext2_fill_super()
1060 if (sbi->s_inodes_per_group < sbi->s_inodes_per_block || in ext2_fill_super()
1061 sbi->s_inodes_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1064 sbi->s_inodes_per_group); in ext2_fill_super()
1075 sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - in ext2_fill_super()
1078 if ((u64)sbi->s_groups_count * sbi->s_inodes_per_group != in ext2_fill_super()
1082 (u64)sbi->s_groups_count * sbi->s_inodes_per_group); in ext2_fill_super()
1085 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / in ext2_fill_super()
1087 sbi->s_group_desc = kvmalloc_array(db_count, in ext2_fill_super()
1090 if (sbi->s_group_desc == NULL) { in ext2_fill_super()
1095 bgl_lock_init(sbi->s_blockgroup_lock); in ext2_fill_super()
1096 sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); in ext2_fill_super()
1097 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()
1153 sbi->s_ea_block_cache = ext2_xattr_create_cache(); in ext2_fill_super()
1154 if (!sbi->s_ea_block_cache) { in ext2_fill_super()
1205 ext2_xattr_destroy_cache(sbi->s_ea_block_cache); in ext2_fill_super()
1206 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_fill_super()
1207 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_fill_super()
1208 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_fill_super()
1211 brelse(sbi->s_group_desc[i]); in ext2_fill_super()
1213 kvfree(sbi->s_group_desc); in ext2_fill_super()
1214 kfree(sbi->s_debts); in ext2_fill_super()
1218 fs_put_dax(sbi->s_daxdev, NULL); in ext2_fill_super()
1220 kfree(sbi->s_blockgroup_lock); in ext2_fill_super()
1221 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()
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()
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()
1469 spin_unlock(&sbi->s_lock); in ext2_statfs()