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()
223 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_show_options() local
224 struct ext2_super_block *es = sbi->s_es; in ext2_show_options()
227 spin_lock(&sbi->s_lock); in ext2_show_options()
230 if (sbi->s_sb_block != 1) in ext2_show_options()
231 seq_printf(seq, ",sb=%lu", sbi->s_sb_block); in ext2_show_options()
238 if (!uid_eq(sbi->s_resuid, make_kuid(&init_user_ns, EXT2_DEF_RESUID)) || in ext2_show_options()
241 from_kuid_munged(&init_user_ns, sbi->s_resuid)); in ext2_show_options()
243 if (!gid_eq(sbi->s_resgid, make_kgid(&init_user_ns, EXT2_DEF_RESGID)) || in ext2_show_options()
246 from_kgid_munged(&init_user_ns, sbi->s_resgid)); in ext2_show_options()
287 if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) in ext2_show_options()
290 if (sbi->s_mount_opt & EXT2_MOUNT_GRPQUOTA) in ext2_show_options()
295 if (sbi->s_mount_opt & EXT2_MOUNT_XIP) in ext2_show_options()
297 if (sbi->s_mount_opt & EXT2_MOUNT_DAX) in ext2_show_options()
304 spin_unlock(&sbi->s_lock); in ext2_show_options()
449 struct ext2_sb_info *sbi = EXT2_SB(sb); in parse_options() local
466 clear_opt (sbi->s_mount_opt, MINIX_DF); in parse_options()
469 set_opt (sbi->s_mount_opt, MINIX_DF); in parse_options()
472 set_opt (sbi->s_mount_opt, GRPID); in parse_options()
475 clear_opt (sbi->s_mount_opt, GRPID); in parse_options()
486 sbi->s_resuid = uid; in parse_options()
496 sbi->s_resgid = gid; in parse_options()
503 clear_opt (sbi->s_mount_opt, ERRORS_CONT); in parse_options()
504 clear_opt (sbi->s_mount_opt, ERRORS_RO); in parse_options()
505 set_opt (sbi->s_mount_opt, ERRORS_PANIC); in parse_options()
508 clear_opt (sbi->s_mount_opt, ERRORS_CONT); in parse_options()
509 clear_opt (sbi->s_mount_opt, ERRORS_PANIC); in parse_options()
510 set_opt (sbi->s_mount_opt, ERRORS_RO); in parse_options()
513 clear_opt (sbi->s_mount_opt, ERRORS_RO); in parse_options()
514 clear_opt (sbi->s_mount_opt, ERRORS_PANIC); in parse_options()
515 set_opt (sbi->s_mount_opt, ERRORS_CONT); in parse_options()
518 set_opt (sbi->s_mount_opt, NO_UID32); in parse_options()
521 clear_opt (sbi->s_mount_opt, CHECK); in parse_options()
524 set_opt (sbi->s_mount_opt, DEBUG); in parse_options()
527 set_opt (sbi->s_mount_opt, OLDALLOC); in parse_options()
530 clear_opt (sbi->s_mount_opt, OLDALLOC); in parse_options()
533 set_opt (sbi->s_mount_opt, NOBH); in parse_options()
537 set_opt (sbi->s_mount_opt, XATTR_USER); in parse_options()
540 clear_opt (sbi->s_mount_opt, XATTR_USER); in parse_options()
551 set_opt(sbi->s_mount_opt, POSIX_ACL); in parse_options()
554 clear_opt(sbi->s_mount_opt, POSIX_ACL); in parse_options()
565 set_opt(sbi->s_mount_opt, XIP); in parse_options()
569 set_opt(sbi->s_mount_opt, DAX); in parse_options()
578 set_opt(sbi->s_mount_opt, USRQUOTA); in parse_options()
582 set_opt(sbi->s_mount_opt, GRPQUOTA); in parse_options()
594 set_opt(sbi->s_mount_opt, RESERVATION); in parse_options()
598 clear_opt(sbi->s_mount_opt, RESERVATION); in parse_options()
615 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_setup_super() local
625 if (!(sbi->s_mount_state & EXT2_VALID_FS)) in ext2_setup_super()
629 else if ((sbi->s_mount_state & EXT2_ERROR_FS)) in ext2_setup_super()
652 sbi->s_frag_size, in ext2_setup_super()
653 sbi->s_groups_count, in ext2_setup_super()
656 sbi->s_mount_opt); in ext2_setup_super()
663 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_check_descriptors() local
667 for (i = 0; i < sbi->s_groups_count; i++) { in ext2_check_descriptors()
672 if (i == sbi->s_groups_count - 1) in ext2_check_descriptors()
673 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; in ext2_check_descriptors()
697 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 > in ext2_check_descriptors()
761 struct ext2_sb_info *sbi = EXT2_SB(sb); in descriptor_loc() local
765 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); in descriptor_loc()
770 bg = sbi->s_desc_per_block * nr; in descriptor_loc()
780 struct ext2_sb_info * sbi; in ext2_fill_super() local
796 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in ext2_fill_super()
797 if (!sbi) in ext2_fill_super()
800 sbi->s_blockgroup_lock = in ext2_fill_super()
802 if (!sbi->s_blockgroup_lock) { in ext2_fill_super()
803 kfree(sbi); in ext2_fill_super()
806 sb->s_fs_info = sbi; in ext2_fill_super()
807 sbi->s_sb_block = sb_block; in ext2_fill_super()
809 spin_lock_init(&sbi->s_lock); in ext2_fill_super()
844 sbi->s_es = es; in ext2_fill_super()
853 set_opt(sbi->s_mount_opt, DEBUG); in ext2_fill_super()
855 set_opt(sbi->s_mount_opt, GRPID); in ext2_fill_super()
857 set_opt(sbi->s_mount_opt, NO_UID32); in ext2_fill_super()
860 set_opt(sbi->s_mount_opt, XATTR_USER); in ext2_fill_super()
864 set_opt(sbi->s_mount_opt, POSIX_ACL); in ext2_fill_super()
867 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) in ext2_fill_super()
868 set_opt(sbi->s_mount_opt, ERRORS_PANIC); in ext2_fill_super()
869 else if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_CONTINUE) in ext2_fill_super()
870 set_opt(sbi->s_mount_opt, ERRORS_CONT); in ext2_fill_super()
872 set_opt(sbi->s_mount_opt, ERRORS_RO); in ext2_fill_super()
874 sbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid)); in ext2_fill_super()
875 sbi->s_resgid = make_kgid(&init_user_ns, le16_to_cpu(es->s_def_resgid)); in ext2_fill_super()
877 set_opt(sbi->s_mount_opt, RESERVATION); in ext2_fill_super()
913 blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); in ext2_fill_super()
915 if (sbi->s_mount_opt & EXT2_MOUNT_DAX) { in ext2_fill_super()
947 sbi->s_es = es; in ext2_fill_super()
958 sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; in ext2_fill_super()
959 sbi->s_first_ino = EXT2_GOOD_OLD_FIRST_INO; in ext2_fill_super()
961 sbi->s_inode_size = le16_to_cpu(es->s_inode_size); in ext2_fill_super()
962 sbi->s_first_ino = le32_to_cpu(es->s_first_ino); in ext2_fill_super()
963 if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || in ext2_fill_super()
964 !is_power_of_2(sbi->s_inode_size) || in ext2_fill_super()
965 (sbi->s_inode_size > blocksize)) { in ext2_fill_super()
968 sbi->s_inode_size); in ext2_fill_super()
973 sbi->s_frag_size = EXT2_MIN_FRAG_SIZE << in ext2_fill_super()
975 if (sbi->s_frag_size == 0) in ext2_fill_super()
977 sbi->s_frags_per_block = sb->s_blocksize / sbi->s_frag_size; in ext2_fill_super()
979 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); in ext2_fill_super()
980 sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group); in ext2_fill_super()
981 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); in ext2_fill_super()
985 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb); in ext2_fill_super()
986 if (sbi->s_inodes_per_block == 0 || sbi->s_inodes_per_group == 0) in ext2_fill_super()
988 sbi->s_itb_per_group = sbi->s_inodes_per_group / in ext2_fill_super()
989 sbi->s_inodes_per_block; in ext2_fill_super()
990 sbi->s_desc_per_block = sb->s_blocksize / in ext2_fill_super()
992 sbi->s_sbh = bh; in ext2_fill_super()
993 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_fill_super()
994 sbi->s_addr_per_block_bits = in ext2_fill_super()
996 sbi->s_desc_per_block_bits = in ext2_fill_super()
1008 if (sb->s_blocksize != sbi->s_frag_size) { in ext2_fill_super()
1012 sbi->s_frag_size, sb->s_blocksize); in ext2_fill_super()
1016 if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1019 sbi->s_blocks_per_group); in ext2_fill_super()
1022 if (sbi->s_frags_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1025 sbi->s_frags_per_group); in ext2_fill_super()
1028 if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1031 sbi->s_inodes_per_group); in ext2_fill_super()
1037 sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - in ext2_fill_super()
1040 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / in ext2_fill_super()
1042 sbi->s_group_desc = kmalloc (db_count * sizeof (struct buffer_head *), GFP_KERNEL); in ext2_fill_super()
1043 if (sbi->s_group_desc == NULL) { in ext2_fill_super()
1047 bgl_lock_init(sbi->s_blockgroup_lock); in ext2_fill_super()
1048 sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); in ext2_fill_super()
1049 if (!sbi->s_debts) { in ext2_fill_super()
1055 sbi->s_group_desc[i] = sb_bread(sb, block); in ext2_fill_super()
1056 if (!sbi->s_group_desc[i]) { in ext2_fill_super()
1058 brelse (sbi->s_group_desc[j]); in ext2_fill_super()
1068 sbi->s_gdb_count = db_count; in ext2_fill_super()
1069 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); in ext2_fill_super()
1070 spin_lock_init(&sbi->s_next_gen_lock); in ext2_fill_super()
1073 spin_lock_init(&sbi->s_rsv_window_lock); in ext2_fill_super()
1074 sbi->s_rsv_window_root = RB_ROOT; in ext2_fill_super()
1081 sbi->s_rsv_window_head.rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1082 sbi->s_rsv_window_head.rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED; in ext2_fill_super()
1083 sbi->s_rsv_window_head.rsv_alloc_hit = 0; in ext2_fill_super()
1084 sbi->s_rsv_window_head.rsv_goal_size = 0; in ext2_fill_super()
1085 ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); in ext2_fill_super()
1087 err = percpu_counter_init(&sbi->s_freeblocks_counter, in ext2_fill_super()
1090 err = percpu_counter_init(&sbi->s_freeinodes_counter, in ext2_fill_super()
1094 err = percpu_counter_init(&sbi->s_dirs_counter, in ext2_fill_super()
1146 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext2_fill_super()
1147 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext2_fill_super()
1148 percpu_counter_destroy(&sbi->s_dirs_counter); in ext2_fill_super()
1151 brelse(sbi->s_group_desc[i]); in ext2_fill_super()
1153 kfree(sbi->s_group_desc); in ext2_fill_super()
1154 kfree(sbi->s_debts); in ext2_fill_super()
1159 kfree(sbi->s_blockgroup_lock); in ext2_fill_super()
1160 kfree(sbi); in ext2_fill_super()
1212 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_sync_fs() local
1221 spin_lock(&sbi->s_lock); in ext2_sync_fs()
1226 spin_unlock(&sbi->s_lock); in ext2_sync_fs()
1233 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_freeze() local
1245 spin_lock(&sbi->s_lock); in ext2_freeze()
1246 sbi->s_es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_freeze()
1247 spin_unlock(&sbi->s_lock); in ext2_freeze()
1248 ext2_sync_super(sb, sbi->s_es, 1); in ext2_freeze()
1269 struct ext2_sb_info * sbi = EXT2_SB(sb); in ext2_remount() local
1276 spin_lock(&sbi->s_lock); in ext2_remount()
1280 old_opts.s_mount_opt = sbi->s_mount_opt; in ext2_remount()
1281 old_opts.s_resuid = sbi->s_resuid; in ext2_remount()
1282 old_opts.s_resgid = sbi->s_resgid; in ext2_remount()
1293 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); in ext2_remount()
1295 es = sbi->s_es; in ext2_remount()
1296 if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT2_MOUNT_DAX) { in ext2_remount()
1299 sbi->s_mount_opt ^= EXT2_MOUNT_DAX; in ext2_remount()
1302 spin_unlock(&sbi->s_lock); in ext2_remount()
1307 !(sbi->s_mount_state & EXT2_VALID_FS)) { in ext2_remount()
1308 spin_unlock(&sbi->s_lock); in ext2_remount()
1316 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext2_remount()
1318 spin_unlock(&sbi->s_lock); in ext2_remount()
1322 spin_lock(&sbi->s_lock); in ext2_remount()
1343 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext2_remount()
1346 spin_unlock(&sbi->s_lock); in ext2_remount()
1355 sbi->s_mount_opt = old_opts.s_mount_opt; in ext2_remount()
1356 sbi->s_resuid = old_opts.s_resuid; in ext2_remount()
1357 sbi->s_resgid = old_opts.s_resgid; in ext2_remount()
1359 spin_unlock(&sbi->s_lock); in ext2_remount()
1366 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_statfs() local
1367 struct ext2_super_block *es = sbi->s_es; in ext2_statfs()
1370 spin_lock(&sbi->s_lock); in ext2_statfs()
1373 sbi->s_overhead_last = 0; in ext2_statfs()
1374 else if (sbi->s_blocks_last != le32_to_cpu(es->s_blocks_count)) { in ext2_statfs()
1395 for (i = 0; i < sbi->s_groups_count; i++) in ext2_statfs()
1403 overhead += (sbi->s_groups_count * in ext2_statfs()
1404 (2 + sbi->s_itb_per_group)); in ext2_statfs()
1405 sbi->s_overhead_last = overhead; in ext2_statfs()
1407 sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count); in ext2_statfs()
1412 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; in ext2_statfs()
1426 spin_unlock(&sbi->s_lock); in ext2_statfs()