Lines Matching full: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()
128 * This must be called with sbi->s_lock held.
175 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_put_super() local
179 ext2_xattr_destroy_cache(sbi->s_ea_block_cache); in ext2_put_super()
180 sbi->s_ea_block_cache = NULL; in ext2_put_super()
183 struct ext2_super_block *es = sbi->s_es; in ext2_put_super()
185 spin_lock(&sbi->s_lock); in ext2_put_super()
186 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_put_super()
187 spin_unlock(&sbi->s_lock); in ext2_put_super()
190 db_count = sbi->s_gdb_count; in ext2_put_super()
192 brelse(sbi->s_group_desc[i]); in ext2_put_super()
193 kvfree(sbi->s_group_desc); in ext2_put_super()
194 kfree(sbi->s_debts); in ext2_put_super()
195 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_put_super()
196 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_put_super()
197 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_put_super()
198 brelse (sbi->s_sbh); in ext2_put_super()
200 kfree(sbi->s_blockgroup_lock); in ext2_put_super()
201 fs_put_dax(sbi->s_daxdev, NULL); in ext2_put_super()
202 kfree(sbi); in ext2_put_super()
265 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_show_options() local
266 struct ext2_super_block *es = sbi->s_es; in ext2_show_options()
269 spin_lock(&sbi->s_lock); in ext2_show_options()
272 if (sbi->s_sb_block != 1) in ext2_show_options()
273 seq_printf(seq, ",sb=%lu", sbi->s_sb_block); in ext2_show_options()
280 if (!uid_eq(sbi->s_resuid, make_kuid(&init_user_ns, EXT2_DEF_RESUID)) || in ext2_show_options()
283 from_kuid_munged(&init_user_ns, sbi->s_resuid)); in ext2_show_options()
285 if (!gid_eq(sbi->s_resgid, make_kgid(&init_user_ns, EXT2_DEF_RESGID)) || in ext2_show_options()
288 from_kgid_munged(&init_user_ns, sbi->s_resgid)); in ext2_show_options()
340 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_groups_count, in ext2_setup_super()
690 sbi->s_mount_opt); in ext2_setup_super()
697 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_check_descriptors() local
701 for (i = 0; i < sbi->s_groups_count; i++) { in ext2_check_descriptors()
725 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 > in ext2_check_descriptors()
804 struct ext2_sb_info *sbi = EXT2_SB(sb); in descriptor_loc() local
807 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); in descriptor_loc()
812 bg = sbi->s_desc_per_block * nr; in descriptor_loc()
821 static void ext2_set_options(struct fs_context *fc, struct ext2_sb_info *sbi) in ext2_set_options() argument
824 struct ext2_super_block *es = sbi->s_es; in ext2_set_options()
827 /* Copy parsed mount options to sbi */ in ext2_set_options()
828 sbi->s_mount_opt = ctx->vals_s_mount_opt; in ext2_set_options()
833 set_opt(sbi->s_mount_opt, DEBUG); in ext2_set_options()
837 set_opt(sbi->s_mount_opt, GRPID); in ext2_set_options()
841 set_opt(sbi->s_mount_opt, NO_UID32); in ext2_set_options()
846 set_opt(sbi->s_mount_opt, XATTR_USER); in ext2_set_options()
851 set_opt(sbi->s_mount_opt, POSIX_ACL); in ext2_set_options()
855 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) in ext2_set_options()
856 set_opt(sbi->s_mount_opt, ERRORS_PANIC); in ext2_set_options()
857 else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_CONTINUE) in ext2_set_options()
858 set_opt(sbi->s_mount_opt, ERRORS_CONT); in ext2_set_options()
860 set_opt(sbi->s_mount_opt, ERRORS_RO); in ext2_set_options()
864 sbi->s_resuid = ctx->s_resuid; in ext2_set_options()
866 sbi->s_resuid = make_kuid(&init_user_ns, in ext2_set_options()
870 sbi->s_resgid = ctx->s_resgid; in ext2_set_options()
872 sbi->s_resgid = make_kgid(&init_user_ns, in ext2_set_options()
881 struct ext2_sb_info * sbi; in ext2_fill_super() local
895 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in ext2_fill_super()
896 if (!sbi) in ext2_fill_super()
899 sbi->s_blockgroup_lock = in ext2_fill_super()
901 if (!sbi->s_blockgroup_lock) { in ext2_fill_super()
902 kfree(sbi); in ext2_fill_super()
905 sb->s_fs_info = sbi; in ext2_fill_super()
906 sbi->s_sb_block = sb_block; in ext2_fill_super()
907 sbi->s_daxdev = fs_dax_get_by_bdev(sb->s_bdev, &sbi->s_dax_part_off, in ext2_fill_super()
910 spin_lock_init(&sbi->s_lock); in ext2_fill_super()
946 sbi->s_es = es; in ext2_fill_super()
952 ext2_set_options(fc, sbi); in ext2_fill_super()
991 blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); in ext2_fill_super()
994 if (!sbi->s_daxdev) { in ext2_fill_super()
997 clear_opt(sbi->s_mount_opt, DAX); in ext2_fill_super()
1000 clear_opt(sbi->s_mount_opt, DAX); in ext2_fill_super()
1023 sbi->s_es = es; in ext2_fill_super()
1036 sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; in ext2_fill_super()
1037 sbi->s_first_ino = EXT2_GOOD_OLD_FIRST_INO; in ext2_fill_super()
1039 sbi->s_inode_size = le16_to_cpu(es->s_inode_size); in ext2_fill_super()
1040 sbi->s_first_ino = le32_to_cpu(es->s_first_ino); in ext2_fill_super()
1041 if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || in ext2_fill_super()
1042 !is_power_of_2(sbi->s_inode_size) || in ext2_fill_super()
1043 (sbi->s_inode_size > blocksize)) { in ext2_fill_super()
1046 sbi->s_inode_size); in ext2_fill_super()
1051 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); in ext2_fill_super()
1052 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); in ext2_fill_super()
1054 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb); in ext2_fill_super()
1055 if (sbi->s_inodes_per_block == 0 || sbi->s_inodes_per_group == 0) in ext2_fill_super()
1057 sbi->s_itb_per_group = sbi->s_inodes_per_group / in ext2_fill_super()
1058 sbi->s_inodes_per_block; in ext2_fill_super()
1059 sbi->s_desc_per_block = sb->s_blocksize / in ext2_fill_super()
1061 sbi->s_sbh = bh; in ext2_fill_super()
1062 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_fill_super()
1063 sbi->s_addr_per_block_bits = in ext2_fill_super()
1065 sbi->s_desc_per_block_bits = in ext2_fill_super()
1084 if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1087 sbi->s_blocks_per_group); in ext2_fill_super()
1091 if (sbi->s_blocks_per_group <= sbi->s_itb_per_group + 3) { in ext2_fill_super()
1094 sbi->s_blocks_per_group, sbi->s_inodes_per_group + 3); in ext2_fill_super()
1097 if (sbi->s_inodes_per_group < sbi->s_inodes_per_block || in ext2_fill_super()
1098 sbi->s_inodes_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1101 sbi->s_inodes_per_group); in ext2_fill_super()
1112 sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - in ext2_fill_super()
1115 if ((u64)sbi->s_groups_count * sbi->s_inodes_per_group != in ext2_fill_super()
1119 (u64)sbi->s_groups_count * sbi->s_inodes_per_group); in ext2_fill_super()
1122 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / in ext2_fill_super()
1124 sbi->s_group_desc = kvmalloc_array(db_count, in ext2_fill_super()
1127 if (sbi->s_group_desc == NULL) { in ext2_fill_super()
1132 bgl_lock_init(sbi->s_blockgroup_lock); in ext2_fill_super()
1133 sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); in ext2_fill_super()
1134 if (!sbi->s_debts) { in ext2_fill_super()
1141 sbi->s_group_desc[i] = sb_bread(sb, block); in ext2_fill_super()
1142 if (!sbi->s_group_desc[i]) { in ext2_fill_super()
1144 brelse (sbi->s_group_desc[j]); in ext2_fill_super()
1154 sbi->s_gdb_count = db_count; in ext2_fill_super()
1155 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); in ext2_fill_super()
1156 spin_lock_init(&sbi->s_next_gen_lock); in ext2_fill_super()
1159 spin_lock_init(&sbi->s_rsv_window_lock); in ext2_fill_super()
1160 sbi->s_rsv_window_root = RB_ROOT; in ext2_fill_super()
1167 sbi->s_rsv_window_head.rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1168 sbi->s_rsv_window_head.rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1169 sbi->s_rsv_window_head.rsv_alloc_hit = 0; in ext2_fill_super()
1170 sbi->s_rsv_window_head.rsv_goal_size = 0; in ext2_fill_super()
1171 ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); in ext2_fill_super()
1173 err = percpu_counter_init(&sbi->s_freeblocks_counter, in ext2_fill_super()
1176 err = percpu_counter_init(&sbi->s_freeinodes_counter, in ext2_fill_super()
1180 err = percpu_counter_init(&sbi->s_dirs_counter, in ext2_fill_super()
1190 sbi->s_ea_block_cache = ext2_xattr_create_cache(); in ext2_fill_super()
1191 if (!sbi->s_ea_block_cache) { in ext2_fill_super()
1242 ext2_xattr_destroy_cache(sbi->s_ea_block_cache); in ext2_fill_super()
1243 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_fill_super()
1244 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_fill_super()
1245 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_fill_super()
1248 brelse(sbi->s_group_desc[i]); in ext2_fill_super()
1250 kvfree(sbi->s_group_desc); in ext2_fill_super()
1251 kfree(sbi->s_debts); in ext2_fill_super()
1255 fs_put_dax(sbi->s_daxdev, NULL); in ext2_fill_super()
1257 kfree(sbi->s_blockgroup_lock); in ext2_fill_super()
1258 kfree(sbi); in ext2_fill_super()
1309 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_sync_fs() local
1318 spin_lock(&sbi->s_lock); in ext2_sync_fs()
1323 spin_unlock(&sbi->s_lock); in ext2_sync_fs()
1330 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_freeze() local
1342 spin_lock(&sbi->s_lock); in ext2_freeze()
1343 sbi->s_es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_freeze()
1344 spin_unlock(&sbi->s_lock); in ext2_freeze()
1345 ext2_sync_super(sb, sbi->s_es, 1); in ext2_freeze()
1368 struct ext2_sb_info * sbi = EXT2_SB(sb); in ext2_reconfigure() local
1380 spin_lock(&sbi->s_lock); in ext2_reconfigure()
1381 es = sbi->s_es; in ext2_reconfigure()
1382 if ((sbi->s_mount_opt ^ new_opts.s_mount_opt) & EXT2_MOUNT_DAX) { in ext2_reconfigure()
1391 !(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_reconfigure()
1398 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_reconfigure()
1400 spin_unlock(&sbi->s_lock); in ext2_reconfigure()
1411 spin_unlock(&sbi->s_lock); in ext2_reconfigure()
1423 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_reconfigure()
1426 spin_unlock(&sbi->s_lock); in ext2_reconfigure()
1433 spin_lock(&sbi->s_lock); in ext2_reconfigure()
1435 sbi->s_mount_opt = new_opts.s_mount_opt; in ext2_reconfigure()
1436 sbi->s_resuid = new_opts.s_resuid; in ext2_reconfigure()
1437 sbi->s_resgid = new_opts.s_resgid; in ext2_reconfigure()
1440 spin_unlock(&sbi->s_lock); in ext2_reconfigure()
1448 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_statfs() local
1449 struct ext2_super_block *es = sbi->s_es; in ext2_statfs()
1451 spin_lock(&sbi->s_lock); in ext2_statfs()
1454 sbi->s_overhead_last = 0; in ext2_statfs()
1455 else if (sbi->s_blocks_last != le32_to_cpu(es->s_blocks_count)) { in ext2_statfs()
1476 for (i = 0; i < sbi->s_groups_count; i++) in ext2_statfs()
1484 overhead += (sbi->s_groups_count * in ext2_statfs()
1485 (2 + sbi->s_itb_per_group)); in ext2_statfs()
1486 sbi->s_overhead_last = overhead; in ext2_statfs()
1488 sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count); in ext2_statfs()
1493 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; in ext2_statfs()
1504 spin_unlock(&sbi->s_lock); in ext2_statfs()
1678 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_init_fs_context() local
1680 spin_lock(&sbi->s_lock); in ext2_init_fs_context()
1681 ctx->vals_s_mount_opt = sbi->s_mount_opt; in ext2_init_fs_context()
1683 ctx->s_resuid = sbi->s_resuid; in ext2_init_fs_context()
1684 ctx->s_resgid = sbi->s_resgid; in ext2_init_fs_context()
1685 spin_unlock(&sbi->s_lock); in ext2_init_fs_context()