• Home
  • Raw
  • Download

Lines Matching refs:sb

40 static void ext2_sync_super(struct super_block *sb,
42 static int ext2_remount (struct super_block * sb, int * flags, char * data);
44 static int ext2_sync_fs(struct super_block *sb, int wait);
45 static int ext2_freeze(struct super_block *sb);
46 static int ext2_unfreeze(struct super_block *sb);
48 void ext2_error(struct super_block *sb, const char *function, in ext2_error() argument
53 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_error()
56 if (!(sb->s_flags & MS_RDONLY)) { in ext2_error()
61 ext2_sync_super(sb, es, 1); in ext2_error()
70 sb->s_id, function, &vaf); in ext2_error()
74 if (test_opt(sb, ERRORS_PANIC)) in ext2_error()
76 if (test_opt(sb, ERRORS_RO)) { in ext2_error()
77 ext2_msg(sb, KERN_CRIT, in ext2_error()
79 sb->s_flags |= MS_RDONLY; in ext2_error()
83 void ext2_msg(struct super_block *sb, const char *prefix, in ext2_msg() argument
94 printk("%sEXT2-fs (%s): %pV\n", prefix, sb->s_id, &vaf); in ext2_msg()
102 void ext2_update_dynamic_rev(struct super_block *sb) in ext2_update_dynamic_rev() argument
104 struct ext2_super_block *es = EXT2_SB(sb)->s_es; in ext2_update_dynamic_rev()
109 ext2_msg(sb, KERN_WARNING, in ext2_update_dynamic_rev()
127 static void ext2_put_super (struct super_block * sb) in ext2_put_super() argument
131 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_put_super()
133 dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); in ext2_put_super()
135 ext2_xattr_put_super(sb); in ext2_put_super()
136 if (!(sb->s_flags & MS_RDONLY)) { in ext2_put_super()
142 ext2_sync_super(sb, es, 1); in ext2_put_super()
154 sb->s_fs_info = NULL; in ext2_put_super()
161 static struct inode *ext2_alloc_inode(struct super_block *sb) in ext2_alloc_inode() argument
219 struct super_block *sb = root->d_sb; in ext2_show_options() local
220 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_show_options()
229 if (test_opt(sb, MINIX_DF)) in ext2_show_options()
231 if (test_opt(sb, GRPID)) in ext2_show_options()
233 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT2_DEFM_BSDGROUPS)) in ext2_show_options()
245 if (test_opt(sb, ERRORS_RO)) { in ext2_show_options()
253 if (test_opt(sb, ERRORS_CONT)) in ext2_show_options()
255 if (test_opt(sb, ERRORS_PANIC)) in ext2_show_options()
257 if (test_opt(sb, NO_UID32)) in ext2_show_options()
259 if (test_opt(sb, DEBUG)) in ext2_show_options()
261 if (test_opt(sb, OLDALLOC)) in ext2_show_options()
265 if (test_opt(sb, XATTR_USER)) in ext2_show_options()
267 if (!test_opt(sb, XATTR_USER) && in ext2_show_options()
274 if (test_opt(sb, POSIX_ACL)) in ext2_show_options()
276 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT2_DEFM_ACL)) in ext2_show_options()
280 if (test_opt(sb, NOBH)) in ext2_show_options()
296 if (!test_opt(sb, RESERVATION)) in ext2_show_options()
304 static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off…
305 static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, lof…
326 static struct inode *ext2_nfs_get_inode(struct super_block *sb, in ext2_nfs_get_inode() argument
331 if (ino < EXT2_FIRST_INO(sb) && ino != EXT2_ROOT_INO) in ext2_nfs_get_inode()
333 if (ino > le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count)) in ext2_nfs_get_inode()
341 inode = ext2_iget(sb, ino); in ext2_nfs_get_inode()
352 static struct dentry *ext2_fh_to_dentry(struct super_block *sb, struct fid *fid, in ext2_fh_to_dentry() argument
355 return generic_fh_to_dentry(sb, fid, fh_len, fh_type, in ext2_fh_to_dentry()
359 static struct dentry *ext2_fh_to_parent(struct super_block *sb, struct fid *fid, in ext2_fh_to_parent() argument
362 return generic_fh_to_parent(sb, fid, fh_len, fh_type, in ext2_fh_to_parent()
435 static int parse_options(char *options, struct super_block *sb) in parse_options() argument
438 struct ext2_sb_info *sbi = EXT2_SB(sb); in parse_options()
471 ext2_msg(sb, KERN_ERR, "Invalid uid value %d", option); in parse_options()
482 ext2_msg(sb, KERN_ERR, "Invalid gid value %d", option); in parse_options()
534 ext2_msg(sb, KERN_INFO, "(no)user_xattr options" in parse_options()
548 ext2_msg(sb, KERN_INFO, in parse_options()
556 ext2_msg(sb, KERN_INFO, "xip option not supported"); in parse_options()
573 ext2_msg(sb, KERN_INFO, in parse_options()
580 ext2_msg(sb, KERN_INFO, "reservations ON"); in parse_options()
584 ext2_msg(sb, KERN_INFO, "reservations OFF"); in parse_options()
595 static int ext2_setup_super (struct super_block * sb, in ext2_setup_super() argument
600 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_setup_super()
603 ext2_msg(sb, KERN_ERR, in ext2_setup_super()
611 ext2_msg(sb, KERN_WARNING, in ext2_setup_super()
615 ext2_msg(sb, KERN_WARNING, in ext2_setup_super()
621 ext2_msg(sb, KERN_WARNING, in ext2_setup_super()
627 ext2_msg(sb, KERN_WARNING, in ext2_setup_super()
633 if (test_opt (sb, DEBUG)) in ext2_setup_super()
634 ext2_msg(sb, KERN_INFO, "%s, %s, bs=%lu, fs=%lu, gc=%lu, " in ext2_setup_super()
636 EXT2FS_VERSION, EXT2FS_DATE, sb->s_blocksize, in ext2_setup_super()
639 EXT2_BLOCKS_PER_GROUP(sb), in ext2_setup_super()
640 EXT2_INODES_PER_GROUP(sb), in ext2_setup_super()
645 static int ext2_check_descriptors(struct super_block *sb) in ext2_check_descriptors() argument
648 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_check_descriptors()
653 struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL); in ext2_check_descriptors()
654 ext2_fsblk_t first_block = ext2_group_first_block_no(sb, i); in ext2_check_descriptors()
661 (EXT2_BLOCKS_PER_GROUP(sb) - 1); in ext2_check_descriptors()
666 ext2_error (sb, "ext2_check_descriptors", in ext2_check_descriptors()
675 ext2_error (sb, "ext2_check_descriptors", in ext2_check_descriptors()
685 ext2_error (sb, "ext2_check_descriptors", in ext2_check_descriptors()
742 static unsigned long descriptor_loc(struct super_block *sb, in descriptor_loc() argument
746 struct ext2_sb_info *sbi = EXT2_SB(sb); in descriptor_loc()
752 if (!EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_META_BG) || in descriptor_loc()
756 if (ext2_bg_has_super(sb, bg)) in descriptor_loc()
759 return ext2_group_first_block_no(sb, bg) + has_super; in descriptor_loc()
762 static int ext2_fill_super(struct super_block *sb, void *data, int silent) in ext2_fill_super() argument
791 sb->s_fs_info = sbi; in ext2_fill_super()
803 blocksize = sb_min_blocksize(sb, BLOCK_SIZE); in ext2_fill_super()
805 ext2_msg(sb, KERN_ERR, "error: unable to set blocksize"); in ext2_fill_super()
820 if (!(bh = sb_bread(sb, logic_sb_block))) { in ext2_fill_super()
821 ext2_msg(sb, KERN_ERR, "error: unable to read superblock"); in ext2_fill_super()
830 sb->s_magic = le16_to_cpu(es->s_magic); in ext2_fill_super()
832 if (sb->s_magic != EXT2_SUPER_MAGIC) in ext2_fill_super()
864 if (!parse_options((char *) data, sb)) in ext2_fill_super()
867 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | in ext2_fill_super()
868 ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? in ext2_fill_super()
871 ext2_xip_verify_sb(sb); /* see if bdev supports xip, unset in ext2_fill_super()
875 (EXT2_HAS_COMPAT_FEATURE(sb, ~0U) || in ext2_fill_super()
876 EXT2_HAS_RO_COMPAT_FEATURE(sb, ~0U) || in ext2_fill_super()
877 EXT2_HAS_INCOMPAT_FEATURE(sb, ~0U))) in ext2_fill_super()
878 ext2_msg(sb, KERN_WARNING, in ext2_fill_super()
886 features = EXT2_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP); in ext2_fill_super()
888 ext2_msg(sb, KERN_ERR, "error: couldn't mount because of " in ext2_fill_super()
893 if (!(sb->s_flags & MS_RDONLY) && in ext2_fill_super()
894 (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ in ext2_fill_super()
895 ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " in ext2_fill_super()
903 if (ext2_use_xip(sb) && blocksize != PAGE_SIZE) { in ext2_fill_super()
905 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
911 if (sb->s_blocksize != blocksize) { in ext2_fill_super()
914 if (!sb_set_blocksize(sb, blocksize)) { in ext2_fill_super()
915 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
922 bh = sb_bread(sb, logic_sb_block); in ext2_fill_super()
924 ext2_msg(sb, KERN_ERR, "error: couldn't read" in ext2_fill_super()
931 ext2_msg(sb, KERN_ERR, "error: magic mismatch"); in ext2_fill_super()
936 sb->s_maxbytes = ext2_max_size(sb->s_blocksize_bits); in ext2_fill_super()
937 sb->s_max_links = EXT2_LINK_MAX; in ext2_fill_super()
948 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
959 sbi->s_frags_per_block = sb->s_blocksize / sbi->s_frag_size; in ext2_fill_super()
965 if (EXT2_INODE_SIZE(sb) == 0) in ext2_fill_super()
967 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb); in ext2_fill_super()
972 sbi->s_desc_per_block = sb->s_blocksize / in ext2_fill_super()
977 ilog2 (EXT2_ADDR_PER_BLOCK(sb)); in ext2_fill_super()
979 ilog2 (EXT2_DESC_PER_BLOCK(sb)); in ext2_fill_super()
981 if (sb->s_magic != EXT2_SUPER_MAGIC) in ext2_fill_super()
984 if (sb->s_blocksize != bh->b_size) { in ext2_fill_super()
986 ext2_msg(sb, KERN_ERR, "error: unsupported blocksize"); in ext2_fill_super()
990 if (sb->s_blocksize != sbi->s_frag_size) { in ext2_fill_super()
991 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
994 sbi->s_frag_size, sb->s_blocksize); in ext2_fill_super()
998 if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
999 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1004 if (sbi->s_frags_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1005 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1010 if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1011 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1017 if (EXT2_BLOCKS_PER_GROUP(sb) == 0) in ext2_fill_super()
1021 / EXT2_BLOCKS_PER_GROUP(sb)) + 1; in ext2_fill_super()
1022 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / in ext2_fill_super()
1023 EXT2_DESC_PER_BLOCK(sb); in ext2_fill_super()
1026 ext2_msg(sb, KERN_ERR, "error: not enough memory"); in ext2_fill_super()
1032 ext2_msg(sb, KERN_ERR, "error: not enough memory"); in ext2_fill_super()
1036 block = descriptor_loc(sb, logic_sb_block, i); in ext2_fill_super()
1037 sbi->s_group_desc[i] = sb_bread(sb, block); in ext2_fill_super()
1041 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1046 if (!ext2_check_descriptors (sb)) { in ext2_fill_super()
1047 ext2_msg(sb, KERN_ERR, "group descriptors corrupted"); in ext2_fill_super()
1067 ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); in ext2_fill_super()
1070 ext2_count_free_blocks(sb)); in ext2_fill_super()
1073 ext2_count_free_inodes(sb)); in ext2_fill_super()
1077 ext2_count_dirs(sb)); in ext2_fill_super()
1080 ext2_msg(sb, KERN_ERR, "error: insufficient memory"); in ext2_fill_super()
1086 sb->s_op = &ext2_sops; in ext2_fill_super()
1087 sb->s_export_op = &ext2_export_ops; in ext2_fill_super()
1088 sb->s_xattr = ext2_xattr_handlers; in ext2_fill_super()
1091 sb->dq_op = &dquot_operations; in ext2_fill_super()
1092 sb->s_qcop = &dquot_quotactl_ops; in ext2_fill_super()
1095 root = ext2_iget(sb, EXT2_ROOT_INO); in ext2_fill_super()
1102 ext2_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck"); in ext2_fill_super()
1106 sb->s_root = d_make_root(root); in ext2_fill_super()
1107 if (!sb->s_root) { in ext2_fill_super()
1108 ext2_msg(sb, KERN_ERR, "error: get root inode failed"); in ext2_fill_super()
1112 if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) in ext2_fill_super()
1113 ext2_msg(sb, KERN_WARNING, in ext2_fill_super()
1115 if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY)) in ext2_fill_super()
1116 sb->s_flags |= MS_RDONLY; in ext2_fill_super()
1117 ext2_write_super(sb); in ext2_fill_super()
1122 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1124 sb->s_id); in ext2_fill_super()
1139 sb->s_fs_info = NULL; in ext2_fill_super()
1146 static void ext2_clear_super_error(struct super_block *sb) in ext2_clear_super_error() argument
1148 struct buffer_head *sbh = EXT2_SB(sb)->s_sbh; in ext2_clear_super_error()
1159 ext2_msg(sb, KERN_ERR, in ext2_clear_super_error()
1166 static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es, in ext2_sync_super() argument
1169 ext2_clear_super_error(sb); in ext2_sync_super()
1170 spin_lock(&EXT2_SB(sb)->s_lock); in ext2_sync_super()
1171 es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb)); in ext2_sync_super()
1172 es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb)); in ext2_sync_super()
1175 spin_unlock(&EXT2_SB(sb)->s_lock); in ext2_sync_super()
1176 mark_buffer_dirty(EXT2_SB(sb)->s_sbh); in ext2_sync_super()
1178 sync_dirty_buffer(EXT2_SB(sb)->s_sbh); in ext2_sync_super()
1191 static int ext2_sync_fs(struct super_block *sb, int wait) in ext2_sync_fs() argument
1193 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_sync_fs()
1194 struct ext2_super_block *es = EXT2_SB(sb)->s_es; in ext2_sync_fs()
1200 dquot_writeback_dquots(sb, -1); in ext2_sync_fs()
1208 ext2_sync_super(sb, es, wait); in ext2_sync_fs()
1212 static int ext2_freeze(struct super_block *sb) in ext2_freeze() argument
1214 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_freeze()
1221 if (atomic_long_read(&sb->s_remove_count)) { in ext2_freeze()
1222 ext2_sync_fs(sb, 1); in ext2_freeze()
1229 ext2_sync_super(sb, sbi->s_es, 1); in ext2_freeze()
1234 static int ext2_unfreeze(struct super_block *sb) in ext2_unfreeze() argument
1237 ext2_write_super(sb); in ext2_unfreeze()
1242 void ext2_write_super(struct super_block *sb) in ext2_write_super() argument
1244 if (!(sb->s_flags & MS_RDONLY)) in ext2_write_super()
1245 ext2_sync_fs(sb, 1); in ext2_write_super()
1248 static int ext2_remount (struct super_block * sb, int * flags, char * data) in ext2_remount() argument
1250 struct ext2_sb_info * sbi = EXT2_SB(sb); in ext2_remount()
1257 sync_filesystem(sb); in ext2_remount()
1261 old_sb_flags = sb->s_flags; in ext2_remount()
1269 if (!parse_options(data, sb)) { in ext2_remount()
1274 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | in ext2_remount()
1277 ext2_xip_verify_sb(sb); /* see if bdev supports xip, unset in ext2_remount()
1280 if ((ext2_use_xip(sb)) && (sb->s_blocksize != PAGE_SIZE)) { in ext2_remount()
1281 ext2_msg(sb, KERN_WARNING, in ext2_remount()
1289 ext2_msg(sb, KERN_WARNING, "warning: refusing change of " in ext2_remount()
1294 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { in ext2_remount()
1313 err = dquot_suspend(sb, -1); in ext2_remount()
1319 ext2_sync_super(sb, es, 1); in ext2_remount()
1321 __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, in ext2_remount()
1324 ext2_msg(sb, KERN_WARNING, in ext2_remount()
1337 if (!ext2_setup_super (sb, es, 0)) in ext2_remount()
1338 sb->s_flags &= ~MS_RDONLY; in ext2_remount()
1341 ext2_write_super(sb); in ext2_remount()
1343 dquot_resume(sb, -1); in ext2_remount()
1351 sb->s_flags = old_sb_flags; in ext2_remount()
1358 struct super_block *sb = dentry->d_sb; in ext2_statfs() local
1359 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_statfs()
1365 if (test_opt (sb, MINIX_DF)) in ext2_statfs()
1389 overhead += ext2_bg_has_super(sb, i) + in ext2_statfs()
1390 ext2_bg_num_gdb(sb, i); in ext2_statfs()
1404 buf->f_bsize = sb->s_blocksize; in ext2_statfs()
1406 buf->f_bfree = ext2_count_free_blocks(sb); in ext2_statfs()
1412 buf->f_ffree = ext2_count_free_inodes(sb); in ext2_statfs()
1435 static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, in ext2_quota_read() argument
1438 struct inode *inode = sb_dqopt(sb)->files[type]; in ext2_quota_read()
1439 sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb); in ext2_quota_read()
1441 int offset = off & (sb->s_blocksize - 1); in ext2_quota_read()
1454 tocopy = sb->s_blocksize - offset < toread ? in ext2_quota_read()
1455 sb->s_blocksize - offset : toread; in ext2_quota_read()
1458 tmp_bh.b_size = sb->s_blocksize; in ext2_quota_read()
1465 bh = sb_bread(sb, tmp_bh.b_blocknr); in ext2_quota_read()
1480 static ssize_t ext2_quota_write(struct super_block *sb, int type, in ext2_quota_write() argument
1483 struct inode *inode = sb_dqopt(sb)->files[type]; in ext2_quota_write()
1484 sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb); in ext2_quota_write()
1486 int offset = off & (sb->s_blocksize - 1); in ext2_quota_write()
1493 tocopy = sb->s_blocksize - offset < towrite ? in ext2_quota_write()
1494 sb->s_blocksize - offset : towrite; in ext2_quota_write()
1500 if (offset || tocopy != EXT2_BLOCK_SIZE(sb)) in ext2_quota_write()
1501 bh = sb_bread(sb, tmp_bh.b_blocknr); in ext2_quota_write()
1503 bh = sb_getblk(sb, tmp_bh.b_blocknr); in ext2_quota_write()