Lines Matching refs:sbi

382 static void ext3_blkdev_remove(struct ext3_sb_info *sbi)  in ext3_blkdev_remove()  argument
385 bdev = sbi->journal_bdev; in ext3_blkdev_remove()
388 sbi->journal_bdev = NULL; in ext3_blkdev_remove()
397 static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi) in dump_orphan_list() argument
402 le32_to_cpu(sbi->s_es->s_last_orphan)); in dump_orphan_list()
405 list_for_each(l, &sbi->s_orphan) { in dump_orphan_list()
417 struct ext3_sb_info *sbi = EXT3_SB(sb); in ext3_put_super() local
418 struct ext3_super_block *es = sbi->s_es; in ext3_put_super()
423 err = journal_destroy(sbi->s_journal); in ext3_put_super()
424 sbi->s_journal = NULL; in ext3_put_super()
430 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext3_put_super()
431 BUFFER_TRACE(sbi->s_sbh, "marking dirty"); in ext3_put_super()
432 mark_buffer_dirty(sbi->s_sbh); in ext3_put_super()
436 for (i = 0; i < sbi->s_gdb_count; i++) in ext3_put_super()
437 brelse(sbi->s_group_desc[i]); in ext3_put_super()
438 kfree(sbi->s_group_desc); in ext3_put_super()
439 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext3_put_super()
440 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext3_put_super()
441 percpu_counter_destroy(&sbi->s_dirs_counter); in ext3_put_super()
442 brelse(sbi->s_sbh); in ext3_put_super()
445 kfree(sbi->s_qf_names[i]); in ext3_put_super()
452 if (!list_empty(&sbi->s_orphan)) in ext3_put_super()
453 dump_orphan_list(sb, sbi); in ext3_put_super()
454 J_ASSERT(list_empty(&sbi->s_orphan)); in ext3_put_super()
457 if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) { in ext3_put_super()
463 sync_blockdev(sbi->journal_bdev); in ext3_put_super()
464 invalidate_bdev(sbi->journal_bdev); in ext3_put_super()
465 ext3_blkdev_remove(sbi); in ext3_put_super()
468 kfree(sbi->s_blockgroup_lock); in ext3_put_super()
469 mutex_destroy(&sbi->s_orphan_lock); in ext3_put_super()
470 mutex_destroy(&sbi->s_resize_lock); in ext3_put_super()
471 kfree(sbi); in ext3_put_super()
561 struct ext3_sb_info *sbi = EXT3_SB(sb); in ext3_show_quota_options() local
563 if (sbi->s_jquota_fmt) { in ext3_show_quota_options()
566 switch (sbi->s_jquota_fmt) { in ext3_show_quota_options()
580 if (sbi->s_qf_names[USRQUOTA]) in ext3_show_quota_options()
581 seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]); in ext3_show_quota_options()
583 if (sbi->s_qf_names[GRPQUOTA]) in ext3_show_quota_options()
584 seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]); in ext3_show_quota_options()
615 struct ext3_sb_info *sbi = EXT3_SB(sb); in ext3_show_options() local
616 struct ext3_super_block *es = sbi->s_es; in ext3_show_options()
621 if (sbi->s_sb_block != 1) in ext3_show_options()
622 seq_printf(seq, ",sb=%lu", sbi->s_sb_block); in ext3_show_options()
629 if (!uid_eq(sbi->s_resuid, make_kuid(&init_user_ns, EXT3_DEF_RESUID)) || in ext3_show_options()
632 from_kuid_munged(&init_user_ns, sbi->s_resuid)); in ext3_show_options()
634 if (!gid_eq(sbi->s_resgid, make_kgid(&init_user_ns, EXT3_DEF_RESGID)) || in ext3_show_options()
637 from_kgid_munged(&init_user_ns, sbi->s_resgid)); in ext3_show_options()
671 if (sbi->s_commit_interval) { in ext3_show_options()
673 (unsigned) (sbi->s_commit_interval / HZ)); in ext3_show_options()
925 struct ext3_sb_info *sbi = EXT3_SB(sb); in set_qf_name() local
929 !sbi->s_qf_names[qtype]) { in set_qf_name()
941 if (sbi->s_qf_names[qtype]) { in set_qf_name()
942 int same = !strcmp(sbi->s_qf_names[qtype], qname); in set_qf_name()
958 sbi->s_qf_names[qtype] = qname; in set_qf_name()
959 set_opt(sbi->s_mount_opt, QUOTA); in set_qf_name()
965 struct ext3_sb_info *sbi = EXT3_SB(sb); in clear_qf_name() local
968 sbi->s_qf_names[qtype]) { in clear_qf_name()
973 if (sbi->s_qf_names[qtype]) { in clear_qf_name()
974 kfree(sbi->s_qf_names[qtype]); in clear_qf_name()
975 sbi->s_qf_names[qtype] = NULL; in clear_qf_name()
985 struct ext3_sb_info *sbi = EXT3_SB(sb); in parse_options() local
1016 clear_opt (sbi->s_mount_opt, MINIX_DF); in parse_options()
1019 set_opt (sbi->s_mount_opt, MINIX_DF); in parse_options()
1022 set_opt (sbi->s_mount_opt, GRPID); in parse_options()
1025 clear_opt (sbi->s_mount_opt, GRPID); in parse_options()
1036 sbi->s_resuid = uid; in parse_options()
1046 sbi->s_resgid = gid; in parse_options()
1053 clear_opt (sbi->s_mount_opt, ERRORS_CONT); in parse_options()
1054 clear_opt (sbi->s_mount_opt, ERRORS_RO); in parse_options()
1055 set_opt (sbi->s_mount_opt, ERRORS_PANIC); in parse_options()
1058 clear_opt (sbi->s_mount_opt, ERRORS_CONT); in parse_options()
1059 clear_opt (sbi->s_mount_opt, ERRORS_PANIC); in parse_options()
1060 set_opt (sbi->s_mount_opt, ERRORS_RO); in parse_options()
1063 clear_opt (sbi->s_mount_opt, ERRORS_RO); in parse_options()
1064 clear_opt (sbi->s_mount_opt, ERRORS_PANIC); in parse_options()
1065 set_opt (sbi->s_mount_opt, ERRORS_CONT); in parse_options()
1068 set_opt (sbi->s_mount_opt, NO_UID32); in parse_options()
1071 clear_opt (sbi->s_mount_opt, CHECK); in parse_options()
1074 set_opt (sbi->s_mount_opt, DEBUG); in parse_options()
1086 set_opt (sbi->s_mount_opt, XATTR_USER); in parse_options()
1089 clear_opt (sbi->s_mount_opt, XATTR_USER); in parse_options()
1100 set_opt(sbi->s_mount_opt, POSIX_ACL); in parse_options()
1103 clear_opt(sbi->s_mount_opt, POSIX_ACL); in parse_options()
1113 set_opt(sbi->s_mount_opt, RESERVATION); in parse_options()
1116 clear_opt(sbi->s_mount_opt, RESERVATION); in parse_options()
1129 set_opt (sbi->s_mount_opt, UPDATE_JOURNAL); in parse_options()
1187 set_opt (sbi->s_mount_opt, NOLOAD); in parse_options()
1196 sbi->s_commit_interval = HZ * option; in parse_options()
1220 clear_opt(sbi->s_mount_opt, DATA_FLAGS); in parse_options()
1221 sbi->s_mount_opt |= data_opt; in parse_options()
1225 set_opt(sbi->s_mount_opt, DATA_ERR_ABORT); in parse_options()
1228 clear_opt(sbi->s_mount_opt, DATA_ERR_ABORT); in parse_options()
1257 sbi->s_jquota_fmt != qfmt) { in parse_options()
1263 sbi->s_jquota_fmt = qfmt; in parse_options()
1267 set_opt(sbi->s_mount_opt, QUOTA); in parse_options()
1268 set_opt(sbi->s_mount_opt, USRQUOTA); in parse_options()
1271 set_opt(sbi->s_mount_opt, QUOTA); in parse_options()
1272 set_opt(sbi->s_mount_opt, GRPQUOTA); in parse_options()
1280 clear_opt(sbi->s_mount_opt, QUOTA); in parse_options()
1281 clear_opt(sbi->s_mount_opt, USRQUOTA); in parse_options()
1282 clear_opt(sbi->s_mount_opt, GRPQUOTA); in parse_options()
1306 set_opt(sbi->s_mount_opt, ABORT); in parse_options()
1309 clear_opt(sbi->s_mount_opt, BARRIER); in parse_options()
1318 set_opt(sbi->s_mount_opt, BARRIER); in parse_options()
1320 clear_opt(sbi->s_mount_opt, BARRIER); in parse_options()
1351 if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { in parse_options()
1352 if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA]) in parse_options()
1353 clear_opt(sbi->s_mount_opt, USRQUOTA); in parse_options()
1354 if (test_opt(sb, GRPQUOTA) && sbi->s_qf_names[GRPQUOTA]) in parse_options()
1355 clear_opt(sbi->s_mount_opt, GRPQUOTA); in parse_options()
1363 if (!sbi->s_jquota_fmt) { in parse_options()
1376 struct ext3_sb_info *sbi = EXT3_SB(sb); in ext3_setup_super() local
1387 if (!(sbi->s_mount_state & EXT3_VALID_FS)) in ext3_setup_super()
1391 else if ((sbi->s_mount_state & EXT3_ERROR_FS)) in ext3_setup_super()
1426 sbi->s_groups_count, in ext3_setup_super()
1429 sbi->s_mount_opt); in ext3_setup_super()
1445 struct ext3_sb_info *sbi = EXT3_SB(sb); in ext3_check_descriptors() local
1450 for (i = 0; i < sbi->s_groups_count; i++) { in ext3_check_descriptors()
1455 if (i == sbi->s_groups_count - 1) in ext3_check_descriptors()
1456 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; in ext3_check_descriptors()
1482 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 > in ext3_check_descriptors()
1494 sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb)); in ext3_check_descriptors()
1495 sbi->s_es->s_free_inodes_count=cpu_to_le32(ext3_count_free_inodes(sb)); in ext3_check_descriptors()
1672 struct ext3_sb_info *sbi = EXT3_SB(sb); in descriptor_loc() local
1676 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); in descriptor_loc()
1681 bg = sbi->s_desc_per_block * nr; in descriptor_loc()
1692 struct ext3_sb_info *sbi; in ext3_fill_super() local
1710 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in ext3_fill_super()
1711 if (!sbi) in ext3_fill_super()
1714 sbi->s_blockgroup_lock = in ext3_fill_super()
1716 if (!sbi->s_blockgroup_lock) { in ext3_fill_super()
1717 kfree(sbi); in ext3_fill_super()
1720 sb->s_fs_info = sbi; in ext3_fill_super()
1721 sbi->s_sb_block = sb_block; in ext3_fill_super()
1749 sbi->s_es = es; in ext3_fill_super()
1757 set_opt(sbi->s_mount_opt, DEBUG); in ext3_fill_super()
1759 set_opt(sbi->s_mount_opt, GRPID); in ext3_fill_super()
1761 set_opt(sbi->s_mount_opt, NO_UID32); in ext3_fill_super()
1764 set_opt(sbi->s_mount_opt, XATTR_USER); in ext3_fill_super()
1768 set_opt(sbi->s_mount_opt, POSIX_ACL); in ext3_fill_super()
1771 set_opt(sbi->s_mount_opt, JOURNAL_DATA); in ext3_fill_super()
1773 set_opt(sbi->s_mount_opt, ORDERED_DATA); in ext3_fill_super()
1775 set_opt(sbi->s_mount_opt, WRITEBACK_DATA); in ext3_fill_super()
1777 if (le16_to_cpu(sbi->s_es->s_errors) == EXT3_ERRORS_PANIC) in ext3_fill_super()
1778 set_opt(sbi->s_mount_opt, ERRORS_PANIC); in ext3_fill_super()
1779 else if (le16_to_cpu(sbi->s_es->s_errors) == EXT3_ERRORS_CONTINUE) in ext3_fill_super()
1780 set_opt(sbi->s_mount_opt, ERRORS_CONT); in ext3_fill_super()
1782 set_opt(sbi->s_mount_opt, ERRORS_RO); in ext3_fill_super()
1784 sbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid)); in ext3_fill_super()
1785 sbi->s_resgid = make_kgid(&init_user_ns, le16_to_cpu(es->s_def_resgid)); in ext3_fill_super()
1788 set_opt(sbi->s_mount_opt, BARRIER); in ext3_fill_super()
1789 set_opt(sbi->s_mount_opt, RESERVATION); in ext3_fill_super()
1862 sbi->s_es = es; in ext3_fill_super()
1873 sbi->s_inode_size = EXT3_GOOD_OLD_INODE_SIZE; in ext3_fill_super()
1874 sbi->s_first_ino = EXT3_GOOD_OLD_FIRST_INO; in ext3_fill_super()
1876 sbi->s_inode_size = le16_to_cpu(es->s_inode_size); in ext3_fill_super()
1877 sbi->s_first_ino = le32_to_cpu(es->s_first_ino); in ext3_fill_super()
1878 if ((sbi->s_inode_size < EXT3_GOOD_OLD_INODE_SIZE) || in ext3_fill_super()
1879 (!is_power_of_2(sbi->s_inode_size)) || in ext3_fill_super()
1880 (sbi->s_inode_size > blocksize)) { in ext3_fill_super()
1883 sbi->s_inode_size); in ext3_fill_super()
1887 sbi->s_frag_size = EXT3_MIN_FRAG_SIZE << in ext3_fill_super()
1889 if (blocksize != sbi->s_frag_size) { in ext3_fill_super()
1892 sbi->s_frag_size, blocksize); in ext3_fill_super()
1895 sbi->s_frags_per_block = 1; in ext3_fill_super()
1896 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); in ext3_fill_super()
1897 sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group); in ext3_fill_super()
1898 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); in ext3_fill_super()
1901 sbi->s_inodes_per_block = blocksize / EXT3_INODE_SIZE(sb); in ext3_fill_super()
1902 if (sbi->s_inodes_per_block == 0) in ext3_fill_super()
1904 sbi->s_itb_per_group = sbi->s_inodes_per_group / in ext3_fill_super()
1905 sbi->s_inodes_per_block; in ext3_fill_super()
1906 sbi->s_desc_per_block = blocksize / sizeof(struct ext3_group_desc); in ext3_fill_super()
1907 sbi->s_sbh = bh; in ext3_fill_super()
1908 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext3_fill_super()
1909 sbi->s_addr_per_block_bits = ilog2(EXT3_ADDR_PER_BLOCK(sb)); in ext3_fill_super()
1910 sbi->s_desc_per_block_bits = ilog2(EXT3_DESC_PER_BLOCK(sb)); in ext3_fill_super()
1912 sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); in ext3_fill_super()
1913 sbi->s_def_hash_version = es->s_def_hash_version; in ext3_fill_super()
1916 sbi->s_hash_unsigned = 3; in ext3_fill_super()
1920 sbi->s_hash_unsigned = 3; in ext3_fill_super()
1926 if (sbi->s_blocks_per_group > blocksize * 8) { in ext3_fill_super()
1929 sbi->s_blocks_per_group); in ext3_fill_super()
1932 if (sbi->s_frags_per_group > blocksize * 8) { in ext3_fill_super()
1935 sbi->s_frags_per_group); in ext3_fill_super()
1938 if (sbi->s_inodes_per_group > blocksize * 8) { in ext3_fill_super()
1941 sbi->s_inodes_per_group); in ext3_fill_super()
1959 sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - in ext3_fill_super()
1962 db_count = DIV_ROUND_UP(sbi->s_groups_count, EXT3_DESC_PER_BLOCK(sb)); in ext3_fill_super()
1963 sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *), in ext3_fill_super()
1965 if (sbi->s_group_desc == NULL) { in ext3_fill_super()
1972 bgl_lock_init(sbi->s_blockgroup_lock); in ext3_fill_super()
1976 sbi->s_group_desc[i] = sb_bread(sb, block); in ext3_fill_super()
1977 if (!sbi->s_group_desc[i]) { in ext3_fill_super()
1989 sbi->s_gdb_count = db_count; in ext3_fill_super()
1990 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); in ext3_fill_super()
1991 spin_lock_init(&sbi->s_next_gen_lock); in ext3_fill_super()
1994 spin_lock_init(&sbi->s_rsv_window_lock); in ext3_fill_super()
1995 sbi->s_rsv_window_root = RB_ROOT; in ext3_fill_super()
2000 sbi->s_rsv_window_head.rsv_start = EXT3_RESERVE_WINDOW_NOT_ALLOCATED; in ext3_fill_super()
2001 sbi->s_rsv_window_head.rsv_end = EXT3_RESERVE_WINDOW_NOT_ALLOCATED; in ext3_fill_super()
2002 sbi->s_rsv_window_head.rsv_alloc_hit = 0; in ext3_fill_super()
2003 sbi->s_rsv_window_head.rsv_goal_size = 0; in ext3_fill_super()
2004 ext3_rsv_window_add(sb, &sbi->s_rsv_window_head); in ext3_fill_super()
2018 INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ in ext3_fill_super()
2019 mutex_init(&sbi->s_orphan_lock); in ext3_fill_super()
2020 mutex_init(&sbi->s_resize_lock); in ext3_fill_super()
2046 err = percpu_counter_init(&sbi->s_freeblocks_counter, in ext3_fill_super()
2049 err = percpu_counter_init(&sbi->s_freeinodes_counter, in ext3_fill_super()
2053 err = percpu_counter_init(&sbi->s_dirs_counter, in ext3_fill_super()
2070 (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) in ext3_fill_super()
2071 set_opt(sbi->s_mount_opt, DEFAULT_DATA_MODE); in ext3_fill_super()
2073 set_opt(sbi->s_mount_opt, JOURNAL_DATA); in ext3_fill_super()
2079 (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { in ext3_fill_super()
2137 percpu_counter_destroy(&sbi->s_freeblocks_counter); in ext3_fill_super()
2138 percpu_counter_destroy(&sbi->s_freeinodes_counter); in ext3_fill_super()
2139 percpu_counter_destroy(&sbi->s_dirs_counter); in ext3_fill_super()
2140 journal_destroy(sbi->s_journal); in ext3_fill_super()
2143 brelse(sbi->s_group_desc[i]); in ext3_fill_super()
2144 kfree(sbi->s_group_desc); in ext3_fill_super()
2148 kfree(sbi->s_qf_names[i]); in ext3_fill_super()
2150 ext3_blkdev_remove(sbi); in ext3_fill_super()
2154 kfree(sbi->s_blockgroup_lock); in ext3_fill_super()
2155 kfree(sbi); in ext3_fill_super()
2166 struct ext3_sb_info *sbi = EXT3_SB(sb); in ext3_init_journal_params() local
2168 if (sbi->s_commit_interval) in ext3_init_journal_params()
2169 journal->j_commit_interval = sbi->s_commit_interval; in ext3_init_journal_params()
2647 struct ext3_sb_info *sbi = EXT3_SB(sb); in ext3_remount() local
2661 old_opts.s_mount_opt = sbi->s_mount_opt; in ext3_remount()
2662 old_opts.s_resuid = sbi->s_resuid; in ext3_remount()
2663 old_opts.s_resgid = sbi->s_resgid; in ext3_remount()
2664 old_opts.s_commit_interval = sbi->s_commit_interval; in ext3_remount()
2666 old_opts.s_jquota_fmt = sbi->s_jquota_fmt; in ext3_remount()
2668 if (sbi->s_qf_names[i]) { in ext3_remount()
2669 old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i], in ext3_remount()
2696 es = sbi->s_es; in ext3_remount()
2698 ext3_init_journal_params(sb, sbi->s_journal); in ext3_remount()
2724 (sbi->s_mount_state & EXT3_VALID_FS)) in ext3_remount()
2725 es->s_state = cpu_to_le16(sbi->s_mount_state); in ext3_remount()
2761 sbi->s_mount_state = le16_to_cpu(es->s_state); in ext3_remount()
2779 sbi->s_mount_opt = old_opts.s_mount_opt; in ext3_remount()
2780 sbi->s_resuid = old_opts.s_resuid; in ext3_remount()
2781 sbi->s_resgid = old_opts.s_resgid; in ext3_remount()
2782 sbi->s_commit_interval = old_opts.s_commit_interval; in ext3_remount()
2784 sbi->s_jquota_fmt = old_opts.s_jquota_fmt; in ext3_remount()
2786 kfree(sbi->s_qf_names[i]); in ext3_remount()
2787 sbi->s_qf_names[i] = old_opts.s_qf_names[i]; in ext3_remount()
2796 struct ext3_sb_info *sbi = EXT3_SB(sb); in ext3_statfs() local
2797 struct ext3_super_block *es = sbi->s_es; in ext3_statfs()
2801 sbi->s_overhead_last = 0; in ext3_statfs()
2802 } else if (sbi->s_blocks_last != le32_to_cpu(es->s_blocks_count)) { in ext3_statfs()
2803 unsigned long ngroups = sbi->s_groups_count, i; in ext3_statfs()
2834 overhead += ngroups * (2 + sbi->s_itb_per_group); in ext3_statfs()
2837 if (sbi->s_journal && !sbi->journal_bdev) in ext3_statfs()
2838 overhead += sbi->s_journal->j_maxlen; in ext3_statfs()
2840 sbi->s_overhead_last = overhead; in ext3_statfs()
2842 sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count); in ext3_statfs()
2847 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; in ext3_statfs()
2848 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter); in ext3_statfs()
2853 buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter); in ext3_statfs()