Lines Matching refs:sbi

52 	struct ext2_sb_info *sbi = EXT2_SB(sb);  in ext2_error()  local
53 struct ext2_super_block *es = sbi->s_es; in ext2_error()
56 spin_lock(&sbi->s_lock); in ext2_error()
57 sbi->s_mount_state |= EXT2_ERROR_FS; in ext2_error()
59 spin_unlock(&sbi->s_lock); in ext2_error()
130 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_put_super() local
136 struct ext2_super_block *es = sbi->s_es; in ext2_put_super()
138 spin_lock(&sbi->s_lock); in ext2_put_super()
139 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_put_super()
140 spin_unlock(&sbi->s_lock); in ext2_put_super()
143 db_count = sbi->s_gdb_count; in ext2_put_super()
145 if (sbi->s_group_desc[i]) in ext2_put_super()
146 brelse (sbi->s_group_desc[i]); in ext2_put_super()
147 kfree(sbi->s_group_desc); in ext2_put_super()
148 kfree(sbi->s_debts); in ext2_put_super()
149 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_put_super()
150 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_put_super()
151 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_put_super()
152 brelse (sbi->s_sbh); in ext2_put_super()
154 kfree(sbi->s_blockgroup_lock); in ext2_put_super()
155 kfree(sbi); in ext2_put_super()
226 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_show_options() local
227 struct ext2_super_block *es = sbi->s_es; in ext2_show_options()
230 spin_lock(&sbi->s_lock); in ext2_show_options()
233 if (sbi->s_sb_block != 1) in ext2_show_options()
234 seq_printf(seq, ",sb=%lu", sbi->s_sb_block); in ext2_show_options()
241 if (!uid_eq(sbi->s_resuid, make_kuid(&init_user_ns, EXT2_DEF_RESUID)) || in ext2_show_options()
244 from_kuid_munged(&init_user_ns, sbi->s_resuid)); in ext2_show_options()
246 if (!gid_eq(sbi->s_resgid, make_kgid(&init_user_ns, EXT2_DEF_RESGID)) || in ext2_show_options()
249 from_kgid_munged(&init_user_ns, sbi->s_resgid)); in ext2_show_options()
290 if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) in ext2_show_options()
293 if (sbi->s_mount_opt & EXT2_MOUNT_GRPQUOTA) in ext2_show_options()
298 if (sbi->s_mount_opt & EXT2_MOUNT_XIP) in ext2_show_options()
300 if (sbi->s_mount_opt & EXT2_MOUNT_DAX) in ext2_show_options()
307 spin_unlock(&sbi->s_lock); in ext2_show_options()
452 struct ext2_sb_info *sbi = EXT2_SB(sb); in parse_options() local
469 clear_opt (sbi->s_mount_opt, MINIX_DF); in parse_options()
472 set_opt (sbi->s_mount_opt, MINIX_DF); in parse_options()
475 set_opt (sbi->s_mount_opt, GRPID); in parse_options()
478 clear_opt (sbi->s_mount_opt, GRPID); in parse_options()
489 sbi->s_resuid = uid; in parse_options()
499 sbi->s_resgid = gid; in parse_options()
506 clear_opt (sbi->s_mount_opt, ERRORS_CONT); in parse_options()
507 clear_opt (sbi->s_mount_opt, ERRORS_RO); in parse_options()
508 set_opt (sbi->s_mount_opt, ERRORS_PANIC); in parse_options()
511 clear_opt (sbi->s_mount_opt, ERRORS_CONT); in parse_options()
512 clear_opt (sbi->s_mount_opt, ERRORS_PANIC); in parse_options()
513 set_opt (sbi->s_mount_opt, ERRORS_RO); in parse_options()
516 clear_opt (sbi->s_mount_opt, ERRORS_RO); in parse_options()
517 clear_opt (sbi->s_mount_opt, ERRORS_PANIC); in parse_options()
518 set_opt (sbi->s_mount_opt, ERRORS_CONT); in parse_options()
521 set_opt (sbi->s_mount_opt, NO_UID32); in parse_options()
524 clear_opt (sbi->s_mount_opt, CHECK); in parse_options()
527 set_opt (sbi->s_mount_opt, DEBUG); in parse_options()
530 set_opt (sbi->s_mount_opt, OLDALLOC); in parse_options()
533 clear_opt (sbi->s_mount_opt, OLDALLOC); in parse_options()
536 set_opt (sbi->s_mount_opt, NOBH); in parse_options()
540 set_opt (sbi->s_mount_opt, XATTR_USER); in parse_options()
543 clear_opt (sbi->s_mount_opt, XATTR_USER); in parse_options()
554 set_opt(sbi->s_mount_opt, POSIX_ACL); in parse_options()
557 clear_opt(sbi->s_mount_opt, POSIX_ACL); in parse_options()
568 set_opt(sbi->s_mount_opt, XIP); in parse_options()
574 set_opt(sbi->s_mount_opt, DAX); in parse_options()
583 set_opt(sbi->s_mount_opt, USRQUOTA); in parse_options()
587 set_opt(sbi->s_mount_opt, GRPQUOTA); in parse_options()
599 set_opt(sbi->s_mount_opt, RESERVATION); in parse_options()
603 clear_opt(sbi->s_mount_opt, RESERVATION); in parse_options()
620 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_setup_super() local
630 if (!(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_setup_super()
634 else if ((sbi->s_mount_state & EXT2_ERROR_FS)) in ext2_setup_super()
657 sbi->s_frag_size, in ext2_setup_super()
658 sbi->s_groups_count, in ext2_setup_super()
661 sbi->s_mount_opt); in ext2_setup_super()
668 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_check_descriptors() local
672 for (i = 0; i < sbi->s_groups_count; i++) { in ext2_check_descriptors()
677 if (i == sbi->s_groups_count - 1) in ext2_check_descriptors()
678 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; in ext2_check_descriptors()
702 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 > in ext2_check_descriptors()
766 struct ext2_sb_info *sbi = EXT2_SB(sb); in descriptor_loc() local
770 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); in descriptor_loc()
775 bg = sbi->s_desc_per_block * nr; in descriptor_loc()
785 struct ext2_sb_info * sbi; in ext2_fill_super() local
801 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in ext2_fill_super()
802 if (!sbi) in ext2_fill_super()
805 sbi->s_blockgroup_lock = in ext2_fill_super()
807 if (!sbi->s_blockgroup_lock) { in ext2_fill_super()
808 kfree(sbi); in ext2_fill_super()
811 sb->s_fs_info = sbi; in ext2_fill_super()
812 sbi->s_sb_block = sb_block; in ext2_fill_super()
814 spin_lock_init(&sbi->s_lock); in ext2_fill_super()
849 sbi->s_es = es; in ext2_fill_super()
858 set_opt(sbi->s_mount_opt, DEBUG); in ext2_fill_super()
860 set_opt(sbi->s_mount_opt, GRPID); in ext2_fill_super()
862 set_opt(sbi->s_mount_opt, NO_UID32); in ext2_fill_super()
865 set_opt(sbi->s_mount_opt, XATTR_USER); in ext2_fill_super()
869 set_opt(sbi->s_mount_opt, POSIX_ACL); in ext2_fill_super()
872 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) in ext2_fill_super()
873 set_opt(sbi->s_mount_opt, ERRORS_PANIC); in ext2_fill_super()
874 else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_CONTINUE) in ext2_fill_super()
875 set_opt(sbi->s_mount_opt, ERRORS_CONT); in ext2_fill_super()
877 set_opt(sbi->s_mount_opt, ERRORS_RO); in ext2_fill_super()
879 sbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid)); in ext2_fill_super()
880 sbi->s_resgid = make_kgid(&init_user_ns, le16_to_cpu(es->s_def_resgid)); in ext2_fill_super()
882 set_opt(sbi->s_mount_opt, RESERVATION); in ext2_fill_super()
919 blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); in ext2_fill_super()
921 if (sbi->s_mount_opt & EXT2_MOUNT_DAX) { in ext2_fill_super()
953 sbi->s_es = es; in ext2_fill_super()
964 sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; in ext2_fill_super()
965 sbi->s_first_ino = EXT2_GOOD_OLD_FIRST_INO; in ext2_fill_super()
967 sbi->s_inode_size = le16_to_cpu(es->s_inode_size); in ext2_fill_super()
968 sbi->s_first_ino = le32_to_cpu(es->s_first_ino); in ext2_fill_super()
969 if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || in ext2_fill_super()
970 !is_power_of_2(sbi->s_inode_size) || in ext2_fill_super()
971 (sbi->s_inode_size > blocksize)) { in ext2_fill_super()
974 sbi->s_inode_size); in ext2_fill_super()
979 sbi->s_frag_size = EXT2_MIN_FRAG_SIZE << in ext2_fill_super()
981 if (sbi->s_frag_size == 0) in ext2_fill_super()
983 sbi->s_frags_per_block = sb->s_blocksize / sbi->s_frag_size; in ext2_fill_super()
985 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); in ext2_fill_super()
986 sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group); in ext2_fill_super()
987 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); in ext2_fill_super()
991 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb); in ext2_fill_super()
992 if (sbi->s_inodes_per_block == 0 || sbi->s_inodes_per_group == 0) in ext2_fill_super()
994 sbi->s_itb_per_group = sbi->s_inodes_per_group / in ext2_fill_super()
995 sbi->s_inodes_per_block; in ext2_fill_super()
996 sbi->s_desc_per_block = sb->s_blocksize / in ext2_fill_super()
998 sbi->s_sbh = bh; in ext2_fill_super()
999 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_fill_super()
1000 sbi->s_addr_per_block_bits = in ext2_fill_super()
1002 sbi->s_desc_per_block_bits = in ext2_fill_super()
1014 if (sb->s_blocksize != sbi->s_frag_size) { in ext2_fill_super()
1018 sbi->s_frag_size, sb->s_blocksize); in ext2_fill_super()
1022 if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1025 sbi->s_blocks_per_group); in ext2_fill_super()
1028 if (sbi->s_frags_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1031 sbi->s_frags_per_group); in ext2_fill_super()
1034 if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1037 sbi->s_inodes_per_group); in ext2_fill_super()
1043 sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - in ext2_fill_super()
1046 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / in ext2_fill_super()
1048 sbi->s_group_desc = kmalloc (db_count * sizeof (struct buffer_head *), GFP_KERNEL); in ext2_fill_super()
1049 if (sbi->s_group_desc == NULL) { in ext2_fill_super()
1053 bgl_lock_init(sbi->s_blockgroup_lock); in ext2_fill_super()
1054 sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); in ext2_fill_super()
1055 if (!sbi->s_debts) { in ext2_fill_super()
1061 sbi->s_group_desc[i] = sb_bread(sb, block); in ext2_fill_super()
1062 if (!sbi->s_group_desc[i]) { in ext2_fill_super()
1064 brelse (sbi->s_group_desc[j]); in ext2_fill_super()
1074 sbi->s_gdb_count = db_count; in ext2_fill_super()
1075 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); in ext2_fill_super()
1076 spin_lock_init(&sbi->s_next_gen_lock); in ext2_fill_super()
1079 spin_lock_init(&sbi->s_rsv_window_lock); in ext2_fill_super()
1080 sbi->s_rsv_window_root = RB_ROOT; in ext2_fill_super()
1087 sbi->s_rsv_window_head.rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1088 sbi->s_rsv_window_head.rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1089 sbi->s_rsv_window_head.rsv_alloc_hit = 0; in ext2_fill_super()
1090 sbi->s_rsv_window_head.rsv_goal_size = 0; in ext2_fill_super()
1091 ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); in ext2_fill_super()
1093 err = percpu_counter_init(&sbi->s_freeblocks_counter, in ext2_fill_super()
1096 err = percpu_counter_init(&sbi->s_freeinodes_counter, in ext2_fill_super()
1100 err = percpu_counter_init(&sbi->s_dirs_counter, in ext2_fill_super()
1152 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_fill_super()
1153 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_fill_super()
1154 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_fill_super()
1157 brelse(sbi->s_group_desc[i]); in ext2_fill_super()
1159 kfree(sbi->s_group_desc); in ext2_fill_super()
1160 kfree(sbi->s_debts); in ext2_fill_super()
1165 kfree(sbi->s_blockgroup_lock); in ext2_fill_super()
1166 kfree(sbi); in ext2_fill_super()
1218 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_sync_fs() local
1227 spin_lock(&sbi->s_lock); in ext2_sync_fs()
1232 spin_unlock(&sbi->s_lock); in ext2_sync_fs()
1239 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_freeze() local
1251 spin_lock(&sbi->s_lock); in ext2_freeze()
1252 sbi->s_es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_freeze()
1253 spin_unlock(&sbi->s_lock); in ext2_freeze()
1254 ext2_sync_super(sb, sbi->s_es, 1); in ext2_freeze()
1275 struct ext2_sb_info * sbi = EXT2_SB(sb); in ext2_remount() local
1282 spin_lock(&sbi->s_lock); in ext2_remount()
1286 old_opts.s_mount_opt = sbi->s_mount_opt; in ext2_remount()
1287 old_opts.s_resuid = sbi->s_resuid; in ext2_remount()
1288 old_opts.s_resgid = sbi->s_resgid; in ext2_remount()
1299 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); in ext2_remount()
1301 es = sbi->s_es; in ext2_remount()
1302 if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT2_MOUNT_DAX) { in ext2_remount()
1305 sbi->s_mount_opt ^= EXT2_MOUNT_DAX; in ext2_remount()
1308 spin_unlock(&sbi->s_lock); in ext2_remount()
1313 !(sbi->s_mount_state & EXT2_VALID_FS)) { in ext2_remount()
1314 spin_unlock(&sbi->s_lock); in ext2_remount()
1322 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_remount()
1324 spin_unlock(&sbi->s_lock); in ext2_remount()
1328 spin_lock(&sbi->s_lock); in ext2_remount()
1349 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_remount()
1352 spin_unlock(&sbi->s_lock); in ext2_remount()
1361 sbi->s_mount_opt = old_opts.s_mount_opt; in ext2_remount()
1362 sbi->s_resuid = old_opts.s_resuid; in ext2_remount()
1363 sbi->s_resgid = old_opts.s_resgid; in ext2_remount()
1365 spin_unlock(&sbi->s_lock); in ext2_remount()
1372 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_statfs() local
1373 struct ext2_super_block *es = sbi->s_es; in ext2_statfs()
1376 spin_lock(&sbi->s_lock); in ext2_statfs()
1379 sbi->s_overhead_last = 0; in ext2_statfs()
1380 else if (sbi->s_blocks_last != le32_to_cpu(es->s_blocks_count)) { in ext2_statfs()
1401 for (i = 0; i < sbi->s_groups_count; i++) in ext2_statfs()
1409 overhead += (sbi->s_groups_count * in ext2_statfs()
1410 (2 + sbi->s_itb_per_group)); in ext2_statfs()
1411 sbi->s_overhead_last = overhead; in ext2_statfs()
1413 sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count); in ext2_statfs()
1418 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; in ext2_statfs()
1432 spin_unlock(&sbi->s_lock); in ext2_statfs()