Lines Matching refs:sb
41 static void ext2_write_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_rdonly(sb)) { 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 |= SB_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()
128 static int ext2_quota_off(struct super_block *sb, int type);
130 static void ext2_quota_off_umount(struct super_block *sb) in ext2_quota_off_umount() argument
135 ext2_quota_off(sb, type); in ext2_quota_off_umount()
138 static inline void ext2_quota_off_umount(struct super_block *sb) in ext2_quota_off_umount() argument
143 static void ext2_put_super (struct super_block * sb) in ext2_put_super() argument
147 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_put_super()
149 ext2_quota_off_umount(sb); in ext2_put_super()
155 if (!sb_rdonly(sb)) { in ext2_put_super()
161 ext2_sync_super(sb, es, 1); in ext2_put_super()
173 sb->s_fs_info = NULL; in ext2_put_super()
181 static struct inode *ext2_alloc_inode(struct super_block *sb) in ext2_alloc_inode() argument
248 struct super_block *sb = root->d_sb; in ext2_show_options() local
249 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_show_options()
258 if (test_opt(sb, MINIX_DF)) in ext2_show_options()
260 if (test_opt(sb, GRPID)) in ext2_show_options()
262 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT2_DEFM_BSDGROUPS)) in ext2_show_options()
274 if (test_opt(sb, ERRORS_RO)) { in ext2_show_options()
282 if (test_opt(sb, ERRORS_CONT)) in ext2_show_options()
284 if (test_opt(sb, ERRORS_PANIC)) in ext2_show_options()
286 if (test_opt(sb, NO_UID32)) in ext2_show_options()
288 if (test_opt(sb, DEBUG)) in ext2_show_options()
290 if (test_opt(sb, OLDALLOC)) in ext2_show_options()
294 if (test_opt(sb, XATTR_USER)) in ext2_show_options()
296 if (!test_opt(sb, XATTR_USER) && in ext2_show_options()
303 if (test_opt(sb, POSIX_ACL)) in ext2_show_options()
305 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT2_DEFM_ACL)) in ext2_show_options()
309 if (test_opt(sb, NOBH)) in ext2_show_options()
327 if (!test_opt(sb, RESERVATION)) in ext2_show_options()
335 static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off…
336 static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, lof…
337 static int ext2_quota_on(struct super_block *sb, int type, int format_id,
375 static struct inode *ext2_nfs_get_inode(struct super_block *sb, in ext2_nfs_get_inode() argument
380 if (ino < EXT2_FIRST_INO(sb) && ino != EXT2_ROOT_INO) in ext2_nfs_get_inode()
382 if (ino > le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count)) in ext2_nfs_get_inode()
390 inode = ext2_iget(sb, ino); in ext2_nfs_get_inode()
401 static struct dentry *ext2_fh_to_dentry(struct super_block *sb, struct fid *fid, in ext2_fh_to_dentry() argument
404 return generic_fh_to_dentry(sb, fid, fh_len, fh_type, in ext2_fh_to_dentry()
408 static struct dentry *ext2_fh_to_parent(struct super_block *sb, struct fid *fid, in ext2_fh_to_parent() argument
411 return generic_fh_to_parent(sb, fid, fh_len, fh_type, in ext2_fh_to_parent()
485 static int parse_options(char *options, struct super_block *sb, in parse_options() argument
521 ext2_msg(sb, KERN_ERR, "Invalid uid value %d", option); in parse_options()
532 ext2_msg(sb, KERN_ERR, "Invalid gid value %d", option); in parse_options()
560 ext2_msg(sb, KERN_WARNING, in parse_options()
587 ext2_msg(sb, KERN_INFO, "(no)user_xattr options" in parse_options()
601 ext2_msg(sb, KERN_INFO, in parse_options()
606 ext2_msg(sb, KERN_INFO, "use dax instead of xip"); in parse_options()
611 ext2_msg(sb, KERN_WARNING, in parse_options()
615 ext2_msg(sb, KERN_INFO, "dax option not supported"); in parse_options()
632 ext2_msg(sb, KERN_INFO, in parse_options()
639 ext2_msg(sb, KERN_INFO, "reservations ON"); in parse_options()
643 ext2_msg(sb, KERN_INFO, "reservations OFF"); in parse_options()
654 static int ext2_setup_super (struct super_block * sb, in ext2_setup_super() argument
659 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_setup_super()
662 ext2_msg(sb, KERN_ERR, in ext2_setup_super()
670 ext2_msg(sb, KERN_WARNING, in ext2_setup_super()
674 ext2_msg(sb, KERN_WARNING, in ext2_setup_super()
680 ext2_msg(sb, KERN_WARNING, in ext2_setup_super()
687 ext2_msg(sb, KERN_WARNING, in ext2_setup_super()
693 if (test_opt (sb, DEBUG)) in ext2_setup_super()
694 ext2_msg(sb, KERN_INFO, "%s, %s, bs=%lu, fs=%lu, gc=%lu, " in ext2_setup_super()
696 EXT2FS_VERSION, EXT2FS_DATE, sb->s_blocksize, in ext2_setup_super()
699 EXT2_BLOCKS_PER_GROUP(sb), in ext2_setup_super()
700 EXT2_INODES_PER_GROUP(sb), in ext2_setup_super()
705 static int ext2_check_descriptors(struct super_block *sb) in ext2_check_descriptors() argument
708 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_check_descriptors()
713 struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL); in ext2_check_descriptors()
714 ext2_fsblk_t first_block = ext2_group_first_block_no(sb, i); in ext2_check_descriptors()
721 (EXT2_BLOCKS_PER_GROUP(sb) - 1); in ext2_check_descriptors()
726 ext2_error (sb, "ext2_check_descriptors", in ext2_check_descriptors()
735 ext2_error (sb, "ext2_check_descriptors", in ext2_check_descriptors()
745 ext2_error (sb, "ext2_check_descriptors", in ext2_check_descriptors()
802 static unsigned long descriptor_loc(struct super_block *sb, in descriptor_loc() argument
806 struct ext2_sb_info *sbi = EXT2_SB(sb); in descriptor_loc()
812 if (!EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_META_BG) || in descriptor_loc()
816 if (ext2_bg_has_super(sb, bg)) in descriptor_loc()
819 return ext2_group_first_block_no(sb, bg) + has_super; in descriptor_loc()
822 static int ext2_fill_super(struct super_block *sb, void *data, int silent) in ext2_fill_super() argument
824 struct dax_device *dax_dev = fs_dax_get_by_bdev(sb->s_bdev); in ext2_fill_super()
852 sb->s_fs_info = sbi; in ext2_fill_super()
866 blocksize = sb_min_blocksize(sb, BLOCK_SIZE); in ext2_fill_super()
868 ext2_msg(sb, KERN_ERR, "error: unable to set blocksize"); in ext2_fill_super()
883 if (!(bh = sb_bread(sb, logic_sb_block))) { in ext2_fill_super()
884 ext2_msg(sb, KERN_ERR, "error: unable to read superblock"); in ext2_fill_super()
893 sb->s_magic = le16_to_cpu(es->s_magic); in ext2_fill_super()
895 if (sb->s_magic != EXT2_SUPER_MAGIC) in ext2_fill_super()
927 if (!parse_options((char *) data, sb, &opts)) in ext2_fill_super()
934 sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | in ext2_fill_super()
935 ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? in ext2_fill_super()
937 sb->s_iflags |= SB_I_CGROUPWB; in ext2_fill_super()
940 (EXT2_HAS_COMPAT_FEATURE(sb, ~0U) || in ext2_fill_super()
941 EXT2_HAS_RO_COMPAT_FEATURE(sb, ~0U) || in ext2_fill_super()
942 EXT2_HAS_INCOMPAT_FEATURE(sb, ~0U))) in ext2_fill_super()
943 ext2_msg(sb, KERN_WARNING, in ext2_fill_super()
951 features = EXT2_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP); in ext2_fill_super()
953 ext2_msg(sb, KERN_ERR, "error: couldn't mount because of " in ext2_fill_super()
958 if (!sb_rdonly(sb) && (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ in ext2_fill_super()
959 ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " in ext2_fill_super()
968 if (!bdev_dax_supported(sb->s_bdev, blocksize)) { in ext2_fill_super()
969 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
976 if (sb->s_blocksize != blocksize) { in ext2_fill_super()
979 if (!sb_set_blocksize(sb, blocksize)) { in ext2_fill_super()
980 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
987 bh = sb_bread(sb, logic_sb_block); in ext2_fill_super()
989 ext2_msg(sb, KERN_ERR, "error: couldn't read" in ext2_fill_super()
996 ext2_msg(sb, KERN_ERR, "error: magic mismatch"); in ext2_fill_super()
1001 sb->s_maxbytes = ext2_max_size(sb->s_blocksize_bits); in ext2_fill_super()
1002 sb->s_max_links = EXT2_LINK_MAX; in ext2_fill_super()
1013 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1024 sbi->s_frags_per_block = sb->s_blocksize / sbi->s_frag_size; in ext2_fill_super()
1030 if (EXT2_INODE_SIZE(sb) == 0) in ext2_fill_super()
1032 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb); in ext2_fill_super()
1037 sbi->s_desc_per_block = sb->s_blocksize / in ext2_fill_super()
1042 ilog2 (EXT2_ADDR_PER_BLOCK(sb)); in ext2_fill_super()
1044 ilog2 (EXT2_DESC_PER_BLOCK(sb)); in ext2_fill_super()
1046 if (sb->s_magic != EXT2_SUPER_MAGIC) in ext2_fill_super()
1049 if (sb->s_blocksize != bh->b_size) { in ext2_fill_super()
1051 ext2_msg(sb, KERN_ERR, "error: unsupported blocksize"); in ext2_fill_super()
1055 if (sb->s_blocksize != sbi->s_frag_size) { in ext2_fill_super()
1056 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1059 sbi->s_frag_size, sb->s_blocksize); in ext2_fill_super()
1063 if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1064 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1069 if (sbi->s_frags_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1070 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1075 if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { in ext2_fill_super()
1076 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1082 if (EXT2_BLOCKS_PER_GROUP(sb) == 0) in ext2_fill_super()
1086 / EXT2_BLOCKS_PER_GROUP(sb)) + 1; in ext2_fill_super()
1087 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / in ext2_fill_super()
1088 EXT2_DESC_PER_BLOCK(sb); in ext2_fill_super()
1093 ext2_msg(sb, KERN_ERR, "error: not enough memory"); in ext2_fill_super()
1099 ext2_msg(sb, KERN_ERR, "error: not enough memory"); in ext2_fill_super()
1103 block = descriptor_loc(sb, logic_sb_block, i); in ext2_fill_super()
1104 sbi->s_group_desc[i] = sb_bread(sb, block); in ext2_fill_super()
1108 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1113 if (!ext2_check_descriptors (sb)) { in ext2_fill_super()
1114 ext2_msg(sb, KERN_ERR, "group descriptors corrupted"); in ext2_fill_super()
1134 ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); in ext2_fill_super()
1137 ext2_count_free_blocks(sb), GFP_KERNEL); in ext2_fill_super()
1140 ext2_count_free_inodes(sb), GFP_KERNEL); in ext2_fill_super()
1144 ext2_count_dirs(sb), GFP_KERNEL); in ext2_fill_super()
1147 ext2_msg(sb, KERN_ERR, "error: insufficient memory"); in ext2_fill_super()
1154 ext2_msg(sb, KERN_ERR, "Failed to create ea_block_cache"); in ext2_fill_super()
1161 sb->s_op = &ext2_sops; in ext2_fill_super()
1162 sb->s_export_op = &ext2_export_ops; in ext2_fill_super()
1163 sb->s_xattr = ext2_xattr_handlers; in ext2_fill_super()
1166 sb->dq_op = &dquot_operations; in ext2_fill_super()
1167 sb->s_qcop = &ext2_quotactl_ops; in ext2_fill_super()
1168 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; in ext2_fill_super()
1171 root = ext2_iget(sb, EXT2_ROOT_INO); in ext2_fill_super()
1178 ext2_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck"); in ext2_fill_super()
1182 sb->s_root = d_make_root(root); in ext2_fill_super()
1183 if (!sb->s_root) { in ext2_fill_super()
1184 ext2_msg(sb, KERN_ERR, "error: get root inode failed"); in ext2_fill_super()
1188 if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) in ext2_fill_super()
1189 ext2_msg(sb, KERN_WARNING, in ext2_fill_super()
1191 if (ext2_setup_super (sb, es, sb_rdonly(sb))) in ext2_fill_super()
1192 sb->s_flags |= SB_RDONLY; in ext2_fill_super()
1193 ext2_write_super(sb); in ext2_fill_super()
1198 ext2_msg(sb, KERN_ERR, in ext2_fill_super()
1200 sb->s_id); in ext2_fill_super()
1217 sb->s_fs_info = NULL; in ext2_fill_super()
1225 static void ext2_clear_super_error(struct super_block *sb) in ext2_clear_super_error() argument
1227 struct buffer_head *sbh = EXT2_SB(sb)->s_sbh; in ext2_clear_super_error()
1238 ext2_msg(sb, KERN_ERR, in ext2_clear_super_error()
1245 void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es, in ext2_sync_super() argument
1248 ext2_clear_super_error(sb); in ext2_sync_super()
1249 spin_lock(&EXT2_SB(sb)->s_lock); in ext2_sync_super()
1250 es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb)); in ext2_sync_super()
1251 es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb)); in ext2_sync_super()
1254 spin_unlock(&EXT2_SB(sb)->s_lock); in ext2_sync_super()
1255 mark_buffer_dirty(EXT2_SB(sb)->s_sbh); in ext2_sync_super()
1257 sync_dirty_buffer(EXT2_SB(sb)->s_sbh); in ext2_sync_super()
1270 static int ext2_sync_fs(struct super_block *sb, int wait) in ext2_sync_fs() argument
1272 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_sync_fs()
1273 struct ext2_super_block *es = EXT2_SB(sb)->s_es; in ext2_sync_fs()
1279 dquot_writeback_dquots(sb, -1); in ext2_sync_fs()
1287 ext2_sync_super(sb, es, wait); in ext2_sync_fs()
1291 static int ext2_freeze(struct super_block *sb) in ext2_freeze() argument
1293 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_freeze()
1300 if (atomic_long_read(&sb->s_remove_count)) { in ext2_freeze()
1301 ext2_sync_fs(sb, 1); in ext2_freeze()
1308 ext2_sync_super(sb, sbi->s_es, 1); in ext2_freeze()
1313 static int ext2_unfreeze(struct super_block *sb) in ext2_unfreeze() argument
1316 ext2_write_super(sb); in ext2_unfreeze()
1321 static void ext2_write_super(struct super_block *sb) in ext2_write_super() argument
1323 if (!sb_rdonly(sb)) in ext2_write_super()
1324 ext2_sync_fs(sb, 1); in ext2_write_super()
1327 static int ext2_remount (struct super_block * sb, int * flags, char * data) in ext2_remount() argument
1329 struct ext2_sb_info * sbi = EXT2_SB(sb); in ext2_remount()
1334 sync_filesystem(sb); in ext2_remount()
1342 if (!parse_options(data, sb, &new_opts)) in ext2_remount()
1348 ext2_msg(sb, KERN_WARNING, "warning: refusing change of " in ext2_remount()
1352 if ((bool)(*flags & SB_RDONLY) == sb_rdonly(sb)) in ext2_remount()
1367 err = dquot_suspend(sb, -1); in ext2_remount()
1371 ext2_sync_super(sb, es, 1); in ext2_remount()
1373 __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, in ext2_remount()
1377 ext2_msg(sb, KERN_WARNING, in ext2_remount()
1389 if (!ext2_setup_super (sb, es, 0)) in ext2_remount()
1390 sb->s_flags &= ~SB_RDONLY; in ext2_remount()
1393 ext2_write_super(sb); in ext2_remount()
1395 dquot_resume(sb, -1); in ext2_remount()
1403 sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | in ext2_remount()
1412 struct super_block *sb = dentry->d_sb; in ext2_statfs() local
1413 struct ext2_sb_info *sbi = EXT2_SB(sb); in ext2_statfs()
1419 if (test_opt (sb, MINIX_DF)) in ext2_statfs()
1443 overhead += ext2_bg_has_super(sb, i) + in ext2_statfs()
1444 ext2_bg_num_gdb(sb, i); in ext2_statfs()
1458 buf->f_bsize = sb->s_blocksize; in ext2_statfs()
1460 buf->f_bfree = ext2_count_free_blocks(sb); in ext2_statfs()
1466 buf->f_ffree = ext2_count_free_inodes(sb); in ext2_statfs()
1489 static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, in ext2_quota_read() argument
1492 struct inode *inode = sb_dqopt(sb)->files[type]; in ext2_quota_read()
1493 sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb); in ext2_quota_read()
1495 int offset = off & (sb->s_blocksize - 1); in ext2_quota_read()
1508 tocopy = sb->s_blocksize - offset < toread ? in ext2_quota_read()
1509 sb->s_blocksize - offset : toread; in ext2_quota_read()
1512 tmp_bh.b_size = sb->s_blocksize; in ext2_quota_read()
1519 bh = sb_bread(sb, tmp_bh.b_blocknr); in ext2_quota_read()
1534 static ssize_t ext2_quota_write(struct super_block *sb, int type, in ext2_quota_write() argument
1537 struct inode *inode = sb_dqopt(sb)->files[type]; in ext2_quota_write()
1538 sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb); in ext2_quota_write()
1540 int offset = off & (sb->s_blocksize - 1); in ext2_quota_write()
1547 tocopy = sb->s_blocksize - offset < towrite ? in ext2_quota_write()
1548 sb->s_blocksize - offset : towrite; in ext2_quota_write()
1551 tmp_bh.b_size = sb->s_blocksize; in ext2_quota_write()
1555 if (offset || tocopy != EXT2_BLOCK_SIZE(sb)) in ext2_quota_write()
1556 bh = sb_bread(sb, tmp_bh.b_blocknr); in ext2_quota_write()
1558 bh = sb_getblk(sb, tmp_bh.b_blocknr); in ext2_quota_write()
1586 static int ext2_quota_on(struct super_block *sb, int type, int format_id, in ext2_quota_on() argument
1592 err = dquot_quota_on(sb, type, format_id, path); in ext2_quota_on()
1607 static int ext2_quota_off(struct super_block *sb, int type) in ext2_quota_off() argument
1609 struct inode *inode = sb_dqopt(sb)->files[type]; in ext2_quota_off()
1615 err = dquot_quota_off(sb, type); in ext2_quota_off()
1628 return dquot_quota_off(sb, type); in ext2_quota_off()