• Home
  • Raw
  • Download

Lines Matching refs:sb

67 static int ext4_commit_super(struct super_block *sb, int sync);
68 static void ext4_mark_recovery_complete(struct super_block *sb,
70 static void ext4_clear_journal_err(struct super_block *sb,
72 static int ext4_sync_fs(struct super_block *sb, int wait);
73 static int ext4_remount(struct super_block *sb, int *flags, char *data);
75 static int ext4_unfreeze(struct super_block *sb);
76 static int ext4_freeze(struct super_block *sb);
79 static inline int ext2_feature_set_ok(struct super_block *sb);
80 static inline int ext3_feature_set_ok(struct super_block *sb);
81 static int ext4_feature_set_ok(struct super_block *sb, int readonly);
83 static void ext4_unregister_li_request(struct super_block *sb);
97 #define IS_EXT2_SB(sb) ((sb)->s_bdev->bd_holder == &ext2_fs_type) argument
99 #define IS_EXT2_SB(sb) (0) argument
113 #define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) argument
115 #define IS_EXT3_SB(sb) (0) argument
118 static int ext4_verify_csum_type(struct super_block *sb, in ext4_verify_csum_type() argument
121 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, in ext4_verify_csum_type()
128 static __le32 ext4_superblock_csum(struct super_block *sb, in ext4_superblock_csum() argument
131 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_superblock_csum()
140 static int ext4_superblock_csum_verify(struct super_block *sb, in ext4_superblock_csum_verify() argument
143 if (!ext4_has_metadata_csum(sb)) in ext4_superblock_csum_verify()
146 return es->s_checksum == ext4_superblock_csum(sb, es); in ext4_superblock_csum_verify()
149 void ext4_superblock_csum_set(struct super_block *sb) in ext4_superblock_csum_set() argument
151 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in ext4_superblock_csum_set()
153 if (!ext4_has_metadata_csum(sb)) in ext4_superblock_csum_set()
156 es->s_checksum = ext4_superblock_csum(sb, es); in ext4_superblock_csum_set()
188 ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, in ext4_block_bitmap() argument
192 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_block_bitmap()
196 ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, in ext4_inode_bitmap() argument
200 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_inode_bitmap()
204 ext4_fsblk_t ext4_inode_table(struct super_block *sb, in ext4_inode_table() argument
208 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_inode_table()
212 __u32 ext4_free_group_clusters(struct super_block *sb, in ext4_free_group_clusters() argument
216 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_free_group_clusters()
220 __u32 ext4_free_inodes_count(struct super_block *sb, in ext4_free_inodes_count() argument
224 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_free_inodes_count()
228 __u32 ext4_used_dirs_count(struct super_block *sb, in ext4_used_dirs_count() argument
232 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_used_dirs_count()
236 __u32 ext4_itable_unused_count(struct super_block *sb, in ext4_itable_unused_count() argument
240 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_itable_unused_count()
244 void ext4_block_bitmap_set(struct super_block *sb, in ext4_block_bitmap_set() argument
248 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_block_bitmap_set()
252 void ext4_inode_bitmap_set(struct super_block *sb, in ext4_inode_bitmap_set() argument
256 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_inode_bitmap_set()
260 void ext4_inode_table_set(struct super_block *sb, in ext4_inode_table_set() argument
264 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_inode_table_set()
268 void ext4_free_group_clusters_set(struct super_block *sb, in ext4_free_group_clusters_set() argument
272 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_free_group_clusters_set()
276 void ext4_free_inodes_set(struct super_block *sb, in ext4_free_inodes_set() argument
280 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_free_inodes_set()
284 void ext4_used_dirs_set(struct super_block *sb, in ext4_used_dirs_set() argument
288 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_used_dirs_set()
292 void ext4_itable_unused_set(struct super_block *sb, in ext4_itable_unused_set() argument
296 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_itable_unused_set()
301 static void __save_error_info(struct super_block *sb, const char *func, in __save_error_info() argument
304 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in __save_error_info()
306 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; in __save_error_info()
307 if (bdev_read_only(sb->s_bdev)) in __save_error_info()
326 mod_timer(&EXT4_SB(sb)->s_err_report, jiffies + 24*60*60*HZ); in __save_error_info()
330 static void save_error_info(struct super_block *sb, const char *func, in save_error_info() argument
333 __save_error_info(sb, func, line); in save_error_info()
334 ext4_commit_super(sb, 1); in save_error_info()
345 static int block_device_ejected(struct super_block *sb) in block_device_ejected() argument
347 struct inode *bd_inode = sb->s_bdev->bd_inode; in block_device_ejected()
355 struct super_block *sb = journal->j_private; in ext4_journal_commit_callback() local
356 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_journal_commit_callback()
367 jce->jce_func(sb, jce, error); in ext4_journal_commit_callback()
388 static void ext4_handle_error(struct super_block *sb) in ext4_handle_error() argument
390 if (sb->s_flags & MS_RDONLY) in ext4_handle_error()
393 if (!test_opt(sb, ERRORS_CONT)) { in ext4_handle_error()
394 journal_t *journal = EXT4_SB(sb)->s_journal; in ext4_handle_error()
396 EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; in ext4_handle_error()
400 if (test_opt(sb, ERRORS_RO)) { in ext4_handle_error()
401 ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); in ext4_handle_error()
407 sb->s_flags |= MS_RDONLY; in ext4_handle_error()
409 if (test_opt(sb, ERRORS_PANIC)) in ext4_handle_error()
411 sb->s_id); in ext4_handle_error()
414 #define ext4_error_ratelimit(sb) \ argument
415 ___ratelimit(&(EXT4_SB(sb)->s_err_ratelimit_state), \
418 void __ext4_error(struct super_block *sb, const char *function, in __ext4_error() argument
424 if (ext4_error_ratelimit(sb)) { in __ext4_error()
430 sb->s_id, function, line, current->comm, &vaf); in __ext4_error()
433 save_error_info(sb, function, line); in __ext4_error()
434 ext4_handle_error(sb); in __ext4_error()
504 const char *ext4_decode_error(struct super_block *sb, int errno, in ext4_decode_error() argument
517 if (!sb || (EXT4_SB(sb)->s_journal && in ext4_decode_error()
518 EXT4_SB(sb)->s_journal->j_flags & JBD2_ABORT)) in ext4_decode_error()
541 void __ext4_std_error(struct super_block *sb, const char *function, in __ext4_std_error() argument
551 (sb->s_flags & MS_RDONLY)) in __ext4_std_error()
554 if (ext4_error_ratelimit(sb)) { in __ext4_std_error()
555 errstr = ext4_decode_error(sb, errno, nbuf); in __ext4_std_error()
557 sb->s_id, function, line, errstr); in __ext4_std_error()
560 save_error_info(sb, function, line); in __ext4_std_error()
561 ext4_handle_error(sb); in __ext4_std_error()
574 void __ext4_abort(struct super_block *sb, const char *function, in __ext4_abort() argument
579 save_error_info(sb, function, line); in __ext4_abort()
581 printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: ", sb->s_id, in __ext4_abort()
587 if ((sb->s_flags & MS_RDONLY) == 0) { in __ext4_abort()
588 ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); in __ext4_abort()
589 EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; in __ext4_abort()
595 sb->s_flags |= MS_RDONLY; in __ext4_abort()
596 if (EXT4_SB(sb)->s_journal) in __ext4_abort()
597 jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); in __ext4_abort()
598 save_error_info(sb, function, line); in __ext4_abort()
600 if (test_opt(sb, ERRORS_PANIC)) in __ext4_abort()
604 void __ext4_msg(struct super_block *sb, in __ext4_msg() argument
610 if (!___ratelimit(&(EXT4_SB(sb)->s_msg_ratelimit_state), "EXT4-fs")) in __ext4_msg()
616 printk("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf); in __ext4_msg()
620 void __ext4_warning(struct super_block *sb, const char *function, in __ext4_warning() argument
626 if (!___ratelimit(&(EXT4_SB(sb)->s_warning_ratelimit_state), in __ext4_warning()
634 sb->s_id, function, line, &vaf); in __ext4_warning()
639 struct super_block *sb, ext4_group_t grp, in __ext4_grp_locked_error() argument
647 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in __ext4_grp_locked_error()
651 __save_error_info(sb, function, line); in __ext4_grp_locked_error()
653 if (ext4_error_ratelimit(sb)) { in __ext4_grp_locked_error()
658 sb->s_id, function, line, grp); in __ext4_grp_locked_error()
668 if (test_opt(sb, ERRORS_CONT)) { in __ext4_grp_locked_error()
669 ext4_commit_super(sb, 0); in __ext4_grp_locked_error()
673 ext4_unlock_group(sb, grp); in __ext4_grp_locked_error()
674 ext4_handle_error(sb); in __ext4_grp_locked_error()
686 ext4_lock_group(sb, grp); in __ext4_grp_locked_error()
690 void ext4_update_dynamic_rev(struct super_block *sb) in ext4_update_dynamic_rev() argument
692 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in ext4_update_dynamic_rev()
697 ext4_warning(sb, in ext4_update_dynamic_rev()
718 static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb) in ext4_blkdev_get() argument
723 bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb); in ext4_blkdev_get()
729 ext4_msg(sb, KERN_ERR, "failed to open journal device %s: %ld", in ext4_blkdev_get()
757 static void dump_orphan_list(struct super_block *sb, struct ext4_sb_info *sbi) in dump_orphan_list() argument
761 ext4_msg(sb, KERN_ERR, "sb orphan head is %d", in dump_orphan_list()
775 static void ext4_put_super(struct super_block *sb) in ext4_put_super() argument
777 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_put_super()
781 ext4_unregister_li_request(sb); in ext4_put_super()
782 dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); in ext4_put_super()
791 ext4_abort(sb, "Couldn't clean up the journal"); in ext4_put_super()
796 ext4_release_system_zone(sb); in ext4_put_super()
797 ext4_mb_release(sb); in ext4_put_super()
798 ext4_ext_release(sb); in ext4_put_super()
799 ext4_xattr_put_super(sb); in ext4_put_super()
801 if (!(sb->s_flags & MS_RDONLY)) { in ext4_put_super()
802 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); in ext4_put_super()
805 if (!(sb->s_flags & MS_RDONLY)) in ext4_put_super()
806 ext4_commit_super(sb, 1); in ext4_put_super()
810 remove_proc_entry(sb->s_id, ext4_proc_root); in ext4_put_super()
833 dump_orphan_list(sb, sbi); in ext4_put_super()
836 invalidate_bdev(sb->s_bdev); in ext4_put_super()
837 if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) { in ext4_put_super()
853 sb->s_fs_info = NULL; in ext4_put_super()
871 static struct inode *ext4_alloc_inode(struct super_block *sb) in ext4_alloc_inode() argument
992 static struct inode *ext4_nfs_get_inode(struct super_block *sb, in ext4_nfs_get_inode() argument
997 if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO) in ext4_nfs_get_inode()
999 if (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)) in ext4_nfs_get_inode()
1010 inode = ext4_iget_normal(sb, ino); in ext4_nfs_get_inode()
1021 static struct dentry *ext4_fh_to_dentry(struct super_block *sb, struct fid *fid, in ext4_fh_to_dentry() argument
1024 return generic_fh_to_dentry(sb, fid, fh_len, fh_type, in ext4_fh_to_dentry()
1028 static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid, in ext4_fh_to_parent() argument
1031 return generic_fh_to_parent(sb, fid, fh_len, fh_type, in ext4_fh_to_parent()
1041 static int bdev_try_to_free_page(struct super_block *sb, struct page *page, in bdev_try_to_free_page() argument
1044 journal_t *journal = EXT4_SB(sb)->s_journal; in bdev_try_to_free_page()
1063 static int ext4_write_info(struct super_block *sb, int type);
1064 static int ext4_quota_on(struct super_block *sb, int type, int format_id,
1066 static int ext4_quota_on_sysfile(struct super_block *sb, int type,
1068 static int ext4_quota_off(struct super_block *sb, int type);
1069 static int ext4_quota_off_sysfile(struct super_block *sb, int type);
1070 static int ext4_quota_on_mount(struct super_block *sb, int type);
1071 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
1073 static ssize_t ext4_quota_write(struct super_block *sb, int type,
1075 static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
1077 static int ext4_enable_quotas(struct super_block *sb);
1270 static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) in set_qf_name() argument
1272 struct ext4_sb_info *sbi = EXT4_SB(sb); in set_qf_name()
1276 if (sb_any_quota_loaded(sb) && in set_qf_name()
1278 ext4_msg(sb, KERN_ERR, in set_qf_name()
1283 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) { in set_qf_name()
1284 ext4_msg(sb, KERN_ERR, "Cannot set journaled quota options " in set_qf_name()
1290 ext4_msg(sb, KERN_ERR, in set_qf_name()
1298 ext4_msg(sb, KERN_ERR, in set_qf_name()
1304 ext4_msg(sb, KERN_ERR, in set_qf_name()
1309 set_opt(sb, QUOTA); in set_qf_name()
1316 static int clear_qf_name(struct super_block *sb, int qtype) in clear_qf_name() argument
1319 struct ext4_sb_info *sbi = EXT4_SB(sb); in clear_qf_name()
1321 if (sb_any_quota_loaded(sb) && in clear_qf_name()
1323 ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options" in clear_qf_name()
1436 static int handle_mount_opt(struct super_block *sb, char *opt, int token, in handle_mount_opt() argument
1440 struct ext4_sb_info *sbi = EXT4_SB(sb); in handle_mount_opt()
1448 return set_qf_name(sb, USRQUOTA, &args[0]); in handle_mount_opt()
1450 return set_qf_name(sb, GRPQUOTA, &args[0]); in handle_mount_opt()
1452 return clear_qf_name(sb, USRQUOTA); in handle_mount_opt()
1454 return clear_qf_name(sb, GRPQUOTA); in handle_mount_opt()
1459 ext4_msg(sb, KERN_WARNING, deprecated_msg, opt, "3.5"); in handle_mount_opt()
1464 ext4_msg(sb, KERN_WARNING, "Ignoring removed %s option", opt); in handle_mount_opt()
1470 sb->s_flags |= MS_I_VERSION; in handle_mount_opt()
1479 ext4_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" " in handle_mount_opt()
1484 if ((m->flags & MOPT_NO_EXT2) && IS_EXT2_SB(sb)) { in handle_mount_opt()
1485 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
1489 if ((m->flags & MOPT_NO_EXT3) && IS_EXT3_SB(sb)) { in handle_mount_opt()
1490 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
1500 set_opt2(sb, EXPLICIT_DELALLOC); in handle_mount_opt()
1502 clear_opt(sb, ERRORS_MASK); in handle_mount_opt()
1503 if (token == Opt_noquota && sb_any_quota_loaded(sb)) { in handle_mount_opt()
1504 ext4_msg(sb, KERN_ERR, "Cannot change quota " in handle_mount_opt()
1510 ext4_msg(sb, KERN_ERR, "%s option not supported", opt); in handle_mount_opt()
1521 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
1528 set_opt(sb, INIT_INODE_TABLE); in handle_mount_opt()
1539 ext4_msg(sb, KERN_ERR, "Invalid uid value %d", arg); in handle_mount_opt()
1546 ext4_msg(sb, KERN_ERR, "Invalid gid value %d", arg); in handle_mount_opt()
1552 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
1564 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
1570 ext4_msg(sb, KERN_ERR, "error: could not dup " in handle_mount_opt()
1577 ext4_msg(sb, KERN_ERR, "error: could not find " in handle_mount_opt()
1585 ext4_msg(sb, KERN_ERR, "error: journal path %s " in handle_mount_opt()
1597 ext4_msg(sb, KERN_ERR, "Invalid journal IO priority" in handle_mount_opt()
1606 ext4_msg(sb, KERN_WARNING, in handle_mount_opt()
1609 ext4_msg(sb, KERN_WARNING, in handle_mount_opt()
1615 …ext4_msg(sb, KERN_WARNING, "Remounting file system with no journal so ignoring journalled data opt… in handle_mount_opt()
1616 else if (test_opt(sb, DATA_FLAGS) != m->mount_opt) { in handle_mount_opt()
1617 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
1622 clear_opt(sb, DATA_FLAGS); in handle_mount_opt()
1627 if (sb_any_quota_loaded(sb) && in handle_mount_opt()
1629 ext4_msg(sb, KERN_ERR, "Cannot change journaled " in handle_mount_opt()
1633 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, in handle_mount_opt()
1635 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
1648 ext4_msg(sb, KERN_WARNING, in handle_mount_opt()
1661 static int parse_options(char *options, struct super_block *sb, in parse_options() argument
1666 struct ext4_sb_info *sbi = EXT4_SB(sb); in parse_options()
1683 if (handle_mount_opt(sb, p, token, args, journal_devnum, in parse_options()
1688 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) && in parse_options()
1689 (test_opt(sb, USRQUOTA) || test_opt(sb, GRPQUOTA))) { in parse_options()
1690 ext4_msg(sb, KERN_ERR, "Cannot set quota options when QUOTA " in parse_options()
1695 if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA]) in parse_options()
1696 clear_opt(sb, USRQUOTA); in parse_options()
1698 if (test_opt(sb, GRPQUOTA) && sbi->s_qf_names[GRPQUOTA]) in parse_options()
1699 clear_opt(sb, GRPQUOTA); in parse_options()
1701 if (test_opt(sb, GRPQUOTA) || test_opt(sb, USRQUOTA)) { in parse_options()
1702 ext4_msg(sb, KERN_ERR, "old and new quota " in parse_options()
1708 ext4_msg(sb, KERN_ERR, "journaled quota format " in parse_options()
1714 if (test_opt(sb, DIOREAD_NOLOCK)) { in parse_options()
1719 ext4_msg(sb, KERN_ERR, "can't mount with " in parse_options()
1728 struct super_block *sb) in ext4_show_quota_options() argument
1731 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_show_quota_options()
1773 static int _ext4_show_options(struct seq_file *seq, struct super_block *sb, in _ext4_show_options() argument
1776 struct ext4_sb_info *sbi = EXT4_SB(sb); in _ext4_show_options()
1811 if (test_opt(sb, ERRORS_RO) && def_errors != EXT4_ERRORS_RO) in _ext4_show_options()
1813 if (test_opt(sb, ERRORS_CONT) && def_errors != EXT4_ERRORS_CONTINUE) in _ext4_show_options()
1815 if (test_opt(sb, ERRORS_PANIC) && def_errors != EXT4_ERRORS_PANIC) in _ext4_show_options()
1823 if (sb->s_flags & MS_I_VERSION) in _ext4_show_options()
1828 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) in _ext4_show_options()
1830 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) in _ext4_show_options()
1832 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA) in _ext4_show_options()
1840 if (nodefs || (test_opt(sb, INIT_INODE_TABLE) && in _ext4_show_options()
1846 ext4_show_quota_options(seq, sb); in _ext4_show_options()
1857 struct super_block *sb = seq->private; in options_seq_show() local
1860 seq_puts(seq, (sb->s_flags & MS_RDONLY) ? "ro" : "rw"); in options_seq_show()
1861 rc = _ext4_show_options(seq, sb, 1); in options_seq_show()
1879 static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es, in ext4_setup_super() argument
1882 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_setup_super()
1886 ext4_msg(sb, KERN_ERR, "revision level too high, " in ext4_setup_super()
1893 ext4_msg(sb, KERN_WARNING, "warning: mounting unchecked fs, " in ext4_setup_super()
1896 ext4_msg(sb, KERN_WARNING, in ext4_setup_super()
1902 ext4_msg(sb, KERN_WARNING, in ext4_setup_super()
1908 ext4_msg(sb, KERN_WARNING, in ext4_setup_super()
1917 ext4_update_dynamic_rev(sb); in ext4_setup_super()
1919 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); in ext4_setup_super()
1921 ext4_commit_super(sb, 1); in ext4_setup_super()
1923 if (test_opt(sb, DEBUG)) in ext4_setup_super()
1926 sb->s_blocksize, in ext4_setup_super()
1928 EXT4_BLOCKS_PER_GROUP(sb), in ext4_setup_super()
1929 EXT4_INODES_PER_GROUP(sb), in ext4_setup_super()
1932 cleancache_init_fs(sb); in ext4_setup_super()
1936 int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup) in ext4_alloc_flex_bg_array() argument
1938 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_alloc_flex_bg_array()
1952 ext4_msg(sb, KERN_ERR, "not enough memory for %d flex groups", in ext4_alloc_flex_bg_array()
1968 static int ext4_fill_flex_info(struct super_block *sb) in ext4_fill_flex_info() argument
1970 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_fill_flex_info()
1981 err = ext4_alloc_flex_bg_array(sb, sbi->s_groups_count); in ext4_fill_flex_info()
1986 gdp = ext4_get_group_desc(sb, i, NULL); in ext4_fill_flex_info()
1989 atomic_add(ext4_free_inodes_count(sb, gdp), in ext4_fill_flex_info()
1991 atomic64_add(ext4_free_group_clusters(sb, gdp), in ext4_fill_flex_info()
1993 atomic_add(ext4_used_dirs_count(sb, gdp), in ext4_fill_flex_info()
2049 int ext4_group_desc_csum_verify(struct super_block *sb, __u32 block_group, in ext4_group_desc_csum_verify() argument
2052 if (ext4_has_group_desc_csum(sb) && in ext4_group_desc_csum_verify()
2053 (gdp->bg_checksum != ext4_group_desc_csum(EXT4_SB(sb), in ext4_group_desc_csum_verify()
2060 void ext4_group_desc_csum_set(struct super_block *sb, __u32 block_group, in ext4_group_desc_csum_set() argument
2063 if (!ext4_has_group_desc_csum(sb)) in ext4_group_desc_csum_set()
2065 gdp->bg_checksum = ext4_group_desc_csum(EXT4_SB(sb), block_group, gdp); in ext4_group_desc_csum_set()
2069 static int ext4_check_descriptors(struct super_block *sb, in ext4_check_descriptors() argument
2072 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_check_descriptors()
2081 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) in ext4_check_descriptors()
2087 struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL); in ext4_check_descriptors()
2093 (EXT4_BLOCKS_PER_GROUP(sb) - 1); in ext4_check_descriptors()
2099 block_bitmap = ext4_block_bitmap(sb, gdp); in ext4_check_descriptors()
2101 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2106 inode_bitmap = ext4_inode_bitmap(sb, gdp); in ext4_check_descriptors()
2108 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2113 inode_table = ext4_inode_table(sb, gdp); in ext4_check_descriptors()
2116 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2121 ext4_lock_group(sb, i); in ext4_check_descriptors()
2122 if (!ext4_group_desc_csum_verify(sb, i, gdp)) { in ext4_check_descriptors()
2123 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2127 if (!(sb->s_flags & MS_RDONLY)) { in ext4_check_descriptors()
2128 ext4_unlock_group(sb, i); in ext4_check_descriptors()
2132 ext4_unlock_group(sb, i); in ext4_check_descriptors()
2134 first_block += EXT4_BLOCKS_PER_GROUP(sb); in ext4_check_descriptors()
2158 static void ext4_orphan_cleanup(struct super_block *sb, in ext4_orphan_cleanup() argument
2161 unsigned int s_flags = sb->s_flags; in ext4_orphan_cleanup()
2171 if (bdev_read_only(sb->s_bdev)) { in ext4_orphan_cleanup()
2172 ext4_msg(sb, KERN_ERR, "write access " in ext4_orphan_cleanup()
2178 if (!ext4_feature_set_ok(sb, 0)) { in ext4_orphan_cleanup()
2179 ext4_msg(sb, KERN_INFO, "Skipping orphan cleanup due to " in ext4_orphan_cleanup()
2184 if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { in ext4_orphan_cleanup()
2187 ext4_msg(sb, KERN_INFO, "Errors on filesystem, " in ext4_orphan_cleanup()
2196 ext4_msg(sb, KERN_INFO, "orphan cleanup on readonly fs"); in ext4_orphan_cleanup()
2197 sb->s_flags &= ~MS_RDONLY; in ext4_orphan_cleanup()
2201 sb->s_flags |= MS_ACTIVE; in ext4_orphan_cleanup()
2204 if (EXT4_SB(sb)->s_qf_names[i]) { in ext4_orphan_cleanup()
2205 int ret = ext4_quota_on_mount(sb, i); in ext4_orphan_cleanup()
2207 ext4_msg(sb, KERN_ERR, in ext4_orphan_cleanup()
2217 inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan)); in ext4_orphan_cleanup()
2223 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan); in ext4_orphan_cleanup()
2226 if (test_opt(sb, DEBUG)) in ext4_orphan_cleanup()
2227 ext4_msg(sb, KERN_DEBUG, in ext4_orphan_cleanup()
2238 if (test_opt(sb, DEBUG)) in ext4_orphan_cleanup()
2239 ext4_msg(sb, KERN_DEBUG, in ext4_orphan_cleanup()
2252 ext4_msg(sb, KERN_INFO, "%d orphan inode%s deleted", in ext4_orphan_cleanup()
2255 ext4_msg(sb, KERN_INFO, "%d truncate%s cleaned up", in ext4_orphan_cleanup()
2260 if (sb_dqopt(sb)->files[i]) in ext4_orphan_cleanup()
2261 dquot_quota_off(sb, i); in ext4_orphan_cleanup()
2264 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ in ext4_orphan_cleanup()
2379 static ext4_fsblk_t descriptor_loc(struct super_block *sb, in descriptor_loc() argument
2382 struct ext4_sb_info *sbi = EXT4_SB(sb); in descriptor_loc()
2388 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_META_BG) || in descriptor_loc()
2392 if (ext4_bg_has_super(sb, bg)) in descriptor_loc()
2401 if (sb->s_blocksize == 1024 && nr == 0 && in descriptor_loc()
2402 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) == 0) in descriptor_loc()
2405 return (has_super + ext4_group_first_block_no(sb, bg)); in descriptor_loc()
2481 struct super_block *sb = sbi->s_buddy_cache->i_sb; in session_write_kbytes_show() local
2483 if (!sb->s_bdev->bd_part) in session_write_kbytes_show()
2486 (part_stat_read(sb->s_bdev->bd_part, sectors[1]) - in session_write_kbytes_show()
2493 struct super_block *sb = sbi->s_buddy_cache->i_sb; in lifetime_write_kbytes_show() local
2495 if (!sb->s_bdev->bd_part) in lifetime_write_kbytes_show()
2499 ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) - in lifetime_write_kbytes_show()
2500 EXT4_SB(sb)->s_sectors_written_start) >> 1))); in lifetime_write_kbytes_show()
2780 static int ext4_feature_set_ok(struct super_block *sb, int readonly) in ext4_feature_set_ok() argument
2782 if (EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT4_FEATURE_INCOMPAT_SUPP)) { in ext4_feature_set_ok()
2783 ext4_msg(sb, KERN_ERR, in ext4_feature_set_ok()
2786 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_incompat) & in ext4_feature_set_ok()
2795 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT4_FEATURE_RO_COMPAT_SUPP)) { in ext4_feature_set_ok()
2796 ext4_msg(sb, KERN_ERR, "couldn't mount RDWR because of " in ext4_feature_set_ok()
2798 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) & in ext4_feature_set_ok()
2806 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) { in ext4_feature_set_ok()
2808 ext4_msg(sb, KERN_ERR, "Filesystem with huge files " in ext4_feature_set_ok()
2814 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC) && in ext4_feature_set_ok()
2815 !EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) { in ext4_feature_set_ok()
2816 ext4_msg(sb, KERN_ERR, in ext4_feature_set_ok()
2823 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) && in ext4_feature_set_ok()
2825 ext4_msg(sb, KERN_ERR, in ext4_feature_set_ok()
2840 struct super_block *sb = (struct super_block *) arg; in print_daily_error_info() local
2844 sbi = EXT4_SB(sb); in print_daily_error_info()
2849 ext4_msg(sb, KERN_NOTICE, "error count since last fsck: %u", in print_daily_error_info()
2853 sb->s_id, le32_to_cpu(es->s_first_error_time), in print_daily_error_info()
2867 sb->s_id, le32_to_cpu(es->s_last_error_time), in print_daily_error_info()
2887 struct super_block *sb; in ext4_run_li_request() local
2891 sb = elr->lr_super; in ext4_run_li_request()
2892 ngroups = EXT4_SB(sb)->s_groups_count; in ext4_run_li_request()
2894 sb_start_write(sb); in ext4_run_li_request()
2896 gdp = ext4_get_group_desc(sb, group, NULL); in ext4_run_li_request()
2911 ret = ext4_init_inode_table(sb, group, in ext4_run_li_request()
2921 sb_end_write(sb); in ext4_run_li_request()
2944 static void ext4_unregister_li_request(struct super_block *sb) in ext4_unregister_li_request() argument
2953 ext4_remove_li_request(EXT4_SB(sb)->s_li_request); in ext4_unregister_li_request()
3084 static ext4_group_t ext4_has_uninit_itable(struct super_block *sb) in ext4_has_uninit_itable() argument
3086 ext4_group_t group, ngroups = EXT4_SB(sb)->s_groups_count; in ext4_has_uninit_itable()
3090 gdp = ext4_get_group_desc(sb, group, NULL); in ext4_has_uninit_itable()
3119 static struct ext4_li_request *ext4_li_request_new(struct super_block *sb, in ext4_li_request_new() argument
3122 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_li_request_new()
3129 elr->lr_super = sb; in ext4_li_request_new()
3143 int ext4_register_li_request(struct super_block *sb, in ext4_register_li_request() argument
3146 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_register_li_request()
3148 ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; in ext4_register_li_request()
3162 (sb->s_flags & MS_RDONLY) || in ext4_register_li_request()
3163 !test_opt(sb, INIT_INODE_TABLE)) in ext4_register_li_request()
3166 elr = ext4_li_request_new(sb, first_not_zeroed); in ext4_register_li_request()
3218 static int set_journal_csum_feature_set(struct super_block *sb) in set_journal_csum_feature_set() argument
3222 struct ext4_sb_info *sbi = EXT4_SB(sb); in set_journal_csum_feature_set()
3224 if (ext4_has_metadata_csum(sb)) { in set_journal_csum_feature_set()
3238 if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) { in set_journal_csum_feature_set()
3243 } else if (test_opt(sb, JOURNAL_CHECKSUM)) { in set_journal_csum_feature_set()
3272 static int count_overhead(struct super_block *sb, ext4_group_t grp, in count_overhead() argument
3275 struct ext4_sb_info *sbi = EXT4_SB(sb); in count_overhead()
3278 ext4_group_t i, ngroups = ext4_get_groups_count(sb); in count_overhead()
3281 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC)) in count_overhead()
3282 return (ext4_bg_has_super(sb, grp) + ext4_bg_num_gdb(sb, grp) + in count_overhead()
3286 (grp * EXT4_BLOCKS_PER_GROUP(sb)); in count_overhead()
3287 last_block = first_block + EXT4_BLOCKS_PER_GROUP(sb) - 1; in count_overhead()
3289 gdp = ext4_get_group_desc(sb, i, NULL); in count_overhead()
3290 b = ext4_block_bitmap(sb, gdp); in count_overhead()
3295 b = ext4_inode_bitmap(sb, gdp); in count_overhead()
3300 b = ext4_inode_table(sb, gdp); in count_overhead()
3310 if (ext4_bg_has_super(sb, grp)) { in count_overhead()
3314 for (j = ext4_bg_num_gdb(sb, grp); j > 0; j--) { in count_overhead()
3321 return EXT4_CLUSTERS_PER_GROUP(sb) - in count_overhead()
3322 ext4_count_free(buf, EXT4_CLUSTERS_PER_GROUP(sb) / 8); in count_overhead()
3328 int ext4_calculate_overhead(struct super_block *sb) in ext4_calculate_overhead() argument
3330 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_calculate_overhead()
3332 ext4_group_t i, ngroups = ext4_get_groups_count(sb); in ext4_calculate_overhead()
3356 blks = count_overhead(sb, i, buf); in ext4_calculate_overhead()
3373 static ext4_fsblk_t ext4_calculate_resv_clusters(struct super_block *sb) in ext4_calculate_resv_clusters() argument
3383 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) in ext4_calculate_resv_clusters()
3393 resv_clusters = ext4_blocks_count(EXT4_SB(sb)->s_es) >> in ext4_calculate_resv_clusters()
3394 EXT4_SB(sb)->s_cluster_bits; in ext4_calculate_resv_clusters()
3415 static int ext4_fill_super(struct super_block *sb, void *data, int silent) in ext4_fill_super() argument
3450 sb->s_fs_info = sbi; in ext4_fill_super()
3451 sbi->s_sb = sb; in ext4_fill_super()
3454 if (sb->s_bdev->bd_part) in ext4_fill_super()
3456 part_stat_read(sb->s_bdev->bd_part, sectors[1]); in ext4_fill_super()
3459 for (cp = sb->s_id; (cp = strchr(cp, '/'));) in ext4_fill_super()
3464 blocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE); in ext4_fill_super()
3466 ext4_msg(sb, KERN_ERR, "unable to set blocksize"); in ext4_fill_super()
3481 if (!(bh = sb_bread_unmovable(sb, logical_sb_block))) { in ext4_fill_super()
3482 ext4_msg(sb, KERN_ERR, "unable to read superblock"); in ext4_fill_super()
3491 sb->s_magic = le16_to_cpu(es->s_magic); in ext4_fill_super()
3492 if (sb->s_magic != EXT4_SUPER_MAGIC) in ext4_fill_super()
3497 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, in ext4_fill_super()
3499 EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) in ext4_fill_super()
3500 ext4_warning(sb, KERN_INFO "metadata_csum and uninit_bg are " in ext4_fill_super()
3504 if (!ext4_verify_csum_type(sb, es)) { in ext4_fill_super()
3505 ext4_msg(sb, KERN_ERR, "VFS: Found ext4 filesystem with " in ext4_fill_super()
3512 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, in ext4_fill_super()
3516 ext4_msg(sb, KERN_ERR, "Cannot load crc32c driver."); in ext4_fill_super()
3524 if (!ext4_superblock_csum_verify(sb, es)) { in ext4_fill_super()
3525 ext4_msg(sb, KERN_ERR, "VFS: Found ext4 filesystem with " in ext4_fill_super()
3532 if (ext4_has_metadata_csum(sb)) in ext4_fill_super()
3538 set_opt(sb, INIT_INODE_TABLE); in ext4_fill_super()
3540 set_opt(sb, DEBUG); in ext4_fill_super()
3542 set_opt(sb, GRPID); in ext4_fill_super()
3544 set_opt(sb, NO_UID32); in ext4_fill_super()
3546 set_opt(sb, XATTR_USER); in ext4_fill_super()
3548 set_opt(sb, POSIX_ACL); in ext4_fill_super()
3551 if (ext4_has_metadata_csum(sb)) in ext4_fill_super()
3552 set_opt(sb, JOURNAL_CHECKSUM); in ext4_fill_super()
3555 set_opt(sb, JOURNAL_DATA); in ext4_fill_super()
3557 set_opt(sb, ORDERED_DATA); in ext4_fill_super()
3559 set_opt(sb, WRITEBACK_DATA); in ext4_fill_super()
3562 set_opt(sb, ERRORS_PANIC); in ext4_fill_super()
3564 set_opt(sb, ERRORS_CONT); in ext4_fill_super()
3566 set_opt(sb, ERRORS_RO); in ext4_fill_super()
3568 set_opt(sb, BLOCK_VALIDITY); in ext4_fill_super()
3570 set_opt(sb, DISCARD); in ext4_fill_super()
3579 set_opt(sb, BARRIER); in ext4_fill_super()
3585 if (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb) && in ext4_fill_super()
3587 set_opt(sb, DELALLOC); in ext4_fill_super()
3595 if (!parse_options((char *) sbi->s_es->s_mount_opts, sb, in ext4_fill_super()
3597 ext4_msg(sb, KERN_WARNING, in ext4_fill_super()
3602 if (!parse_options((char *) data, sb, &journal_devnum, in ext4_fill_super()
3606 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { in ext4_fill_super()
3610 if (test_opt2(sb, EXPLICIT_DELALLOC)) { in ext4_fill_super()
3611 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_fill_super()
3615 if (test_opt(sb, DIOREAD_NOLOCK)) { in ext4_fill_super()
3616 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_fill_super()
3620 if (test_opt(sb, DELALLOC)) in ext4_fill_super()
3621 clear_opt(sb, DELALLOC); in ext4_fill_super()
3624 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | in ext4_fill_super()
3625 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); in ext4_fill_super()
3628 (EXT4_HAS_COMPAT_FEATURE(sb, ~0U) || in ext4_fill_super()
3629 EXT4_HAS_RO_COMPAT_FEATURE(sb, ~0U) || in ext4_fill_super()
3630 EXT4_HAS_INCOMPAT_FEATURE(sb, ~0U))) in ext4_fill_super()
3631 ext4_msg(sb, KERN_WARNING, in ext4_fill_super()
3636 set_opt2(sb, HURD_COMPAT); in ext4_fill_super()
3637 if (EXT4_HAS_INCOMPAT_FEATURE(sb, in ext4_fill_super()
3639 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3645 if (IS_EXT2_SB(sb)) { in ext4_fill_super()
3646 if (ext2_feature_set_ok(sb)) in ext4_fill_super()
3647 ext4_msg(sb, KERN_INFO, "mounting ext2 file system " in ext4_fill_super()
3650 ext4_msg(sb, KERN_ERR, "couldn't mount as ext2 due " in ext4_fill_super()
3656 if (IS_EXT3_SB(sb)) { in ext4_fill_super()
3657 if (ext3_feature_set_ok(sb)) in ext4_fill_super()
3658 ext4_msg(sb, KERN_INFO, "mounting ext3 file system " in ext4_fill_super()
3661 ext4_msg(sb, KERN_ERR, "couldn't mount as ext3 due " in ext4_fill_super()
3672 if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) in ext4_fill_super()
3678 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3683 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT) && in ext4_fill_super()
3685 ext4_msg(sb, KERN_ERR, "Unsupported encryption level %d", in ext4_fill_super()
3690 if (sb->s_blocksize != blocksize) { in ext4_fill_super()
3692 if (!sb_set_blocksize(sb, blocksize)) { in ext4_fill_super()
3693 ext4_msg(sb, KERN_ERR, "bad block size %d", in ext4_fill_super()
3701 bh = sb_bread_unmovable(sb, logical_sb_block); in ext4_fill_super()
3703 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3710 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3716 has_huge_files = EXT4_HAS_RO_COMPAT_FEATURE(sb, in ext4_fill_super()
3718 sbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits, in ext4_fill_super()
3720 sb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files); in ext4_fill_super()
3731 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3737 sb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2); in ext4_fill_super()
3741 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) { in ext4_fill_super()
3745 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3755 if (EXT4_INODE_SIZE(sb) == 0 || EXT4_INODES_PER_GROUP(sb) == 0) in ext4_fill_super()
3758 sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb); in ext4_fill_super()
3763 sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb); in ext4_fill_super()
3766 sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb)); in ext4_fill_super()
3767 sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb)); in ext4_fill_super()
3772 if (EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) { in ext4_fill_super()
3778 if (!(sb->s_flags & MS_RDONLY)) in ext4_fill_super()
3783 if (!(sb->s_flags & MS_RDONLY)) in ext4_fill_super()
3792 has_bigalloc = EXT4_HAS_RO_COMPAT_FEATURE(sb, in ext4_fill_super()
3796 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3806 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3813 ext4_msg(sb, KERN_ERR, "blocks per group (%lu) and " in ext4_fill_super()
3821 ext4_warning(sb, "fragment/cluster size (%d) != " in ext4_fill_super()
3827 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3838 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3846 set_opt2(sb, STD_GROUP_SIZE); in ext4_fill_super()
3852 err = generic_check_addressable(sb->s_blocksize_bits, in ext4_fill_super()
3855 ext4_msg(sb, KERN_ERR, "filesystem" in ext4_fill_super()
3858 ext4_msg(sb, KERN_WARNING, "CONFIG_LBDAF not enabled"); in ext4_fill_super()
3862 if (EXT4_BLOCKS_PER_GROUP(sb) == 0) in ext4_fill_super()
3866 blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits; in ext4_fill_super()
3868 ext4_msg(sb, KERN_WARNING, "bad geometry: block count %llu " in ext4_fill_super()
3879 ext4_msg(sb, KERN_WARNING, "bad geometry: first data " in ext4_fill_super()
3887 EXT4_BLOCKS_PER_GROUP(sb) - 1); in ext4_fill_super()
3888 do_div(blocks_count, EXT4_BLOCKS_PER_GROUP(sb)); in ext4_fill_super()
3889 if (blocks_count > ((uint64_t)1<<32) - EXT4_DESC_PER_BLOCK(sb)) { in ext4_fill_super()
3890 ext4_msg(sb, KERN_WARNING, "groups count too large: %u " in ext4_fill_super()
3895 EXT4_BLOCKS_PER_GROUP(sb)); in ext4_fill_super()
3900 (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb))); in ext4_fill_super()
3901 db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) / in ext4_fill_super()
3902 EXT4_DESC_PER_BLOCK(sb); in ext4_fill_super()
3903 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_META_BG)) { in ext4_fill_super()
3905 ext4_msg(sb, KERN_WARNING, in ext4_fill_super()
3916 ext4_msg(sb, KERN_ERR, "not enough memory"); in ext4_fill_super()
3922 sbi->s_proc = proc_mkdir(sb->s_id, ext4_proc_root); in ext4_fill_super()
3926 &ext4_seq_options_fops, sb); in ext4_fill_super()
3931 block = descriptor_loc(sb, logical_sb_block, i); in ext4_fill_super()
3932 sbi->s_group_desc[i] = sb_bread_unmovable(sb, block); in ext4_fill_super()
3934 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
3940 if (!ext4_check_descriptors(sb, &first_not_zeroed)) { in ext4_fill_super()
3941 ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); in ext4_fill_super()
3951 sbi->s_err_report.data = (unsigned long) sb; in ext4_fill_super()
3963 sb->s_op = &ext4_sops; in ext4_fill_super()
3964 sb->s_export_op = &ext4_export_ops; in ext4_fill_super()
3965 sb->s_xattr = ext4_xattr_handlers; in ext4_fill_super()
3967 sb->dq_op = &ext4_quota_operations; in ext4_fill_super()
3968 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) in ext4_fill_super()
3969 sb->s_qcop = &ext4_qctl_sysfile_operations; in ext4_fill_super()
3971 sb->s_qcop = &ext4_qctl_operations; in ext4_fill_super()
3973 memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid)); in ext4_fill_super()
3978 sb->s_root = NULL; in ext4_fill_super()
3981 EXT4_HAS_INCOMPAT_FEATURE(sb, in ext4_fill_super()
3984 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) && in ext4_fill_super()
3985 !(sb->s_flags & MS_RDONLY)) in ext4_fill_super()
3986 if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) in ext4_fill_super()
3993 if (!test_opt(sb, NOLOAD) && in ext4_fill_super()
3994 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { in ext4_fill_super()
3995 if (ext4_load_journal(sb, es, journal_devnum)) in ext4_fill_super()
3997 } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && in ext4_fill_super()
3998 EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { in ext4_fill_super()
3999 ext4_msg(sb, KERN_ERR, "required journal recovery " in ext4_fill_super()
4003 clear_opt(sb, DATA_FLAGS); in ext4_fill_super()
4009 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT) && in ext4_fill_super()
4010 !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0, in ext4_fill_super()
4012 ext4_msg(sb, KERN_ERR, "Failed to set 64-bit journal feature"); in ext4_fill_super()
4016 if (!set_journal_csum_feature_set(sb)) { in ext4_fill_super()
4017 ext4_msg(sb, KERN_ERR, "Failed to set journal checksum " in ext4_fill_super()
4024 switch (test_opt(sb, DATA_FLAGS)) { in ext4_fill_super()
4032 set_opt(sb, ORDERED_DATA); in ext4_fill_super()
4034 set_opt(sb, JOURNAL_DATA); in ext4_fill_super()
4041 ext4_msg(sb, KERN_ERR, "Journal does not support " in ext4_fill_super()
4054 sbi->s_mb_cache = ext4_xattr_create_cache(sb->s_id); in ext4_fill_super()
4056 ext4_msg(sb, KERN_ERR, "Failed to create an mb_cache"); in ext4_fill_super()
4062 !(sb->s_flags & MS_RDONLY) && in ext4_fill_super()
4063 !EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT)) { in ext4_fill_super()
4064 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT); in ext4_fill_super()
4065 ext4_commit_super(sb, 1); in ext4_fill_super()
4075 err = ext4_calculate_overhead(sb); in ext4_fill_super()
4084 EXT4_SB(sb)->rsv_conversion_wq = in ext4_fill_super()
4086 if (!EXT4_SB(sb)->rsv_conversion_wq) { in ext4_fill_super()
4097 root = ext4_iget(sb, EXT4_ROOT_INO); in ext4_fill_super()
4099 ext4_msg(sb, KERN_ERR, "get root inode failed"); in ext4_fill_super()
4105 ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck"); in ext4_fill_super()
4109 sb->s_root = d_make_root(root); in ext4_fill_super()
4110 if (!sb->s_root) { in ext4_fill_super()
4111 ext4_msg(sb, KERN_ERR, "get root dentry failed"); in ext4_fill_super()
4116 if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY)) in ext4_fill_super()
4117 sb->s_flags |= MS_RDONLY; in ext4_fill_super()
4123 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, in ext4_fill_super()
4140 ext4_msg(sb, KERN_INFO, "required extra inode space not" in ext4_fill_super()
4144 err = ext4_reserve_clusters(sbi, ext4_calculate_resv_clusters(sb)); in ext4_fill_super()
4146 ext4_msg(sb, KERN_ERR, "failed to reserve %llu clusters for " in ext4_fill_super()
4147 "reserved pool", ext4_calculate_resv_clusters(sb)); in ext4_fill_super()
4151 err = ext4_setup_system_zone(sb); in ext4_fill_super()
4153 ext4_msg(sb, KERN_ERR, "failed to initialize system " in ext4_fill_super()
4158 ext4_ext_init(sb); in ext4_fill_super()
4159 err = ext4_mb_init(sb); in ext4_fill_super()
4161 ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", in ext4_fill_super()
4166 block = ext4_count_free_clusters(sb); in ext4_fill_super()
4171 unsigned long freei = ext4_count_free_inodes(sb); in ext4_fill_super()
4177 ext4_count_dirs(sb)); in ext4_fill_super()
4181 ext4_msg(sb, KERN_ERR, "insufficient memory"); in ext4_fill_super()
4185 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) in ext4_fill_super()
4186 if (!ext4_fill_flex_info(sb)) { in ext4_fill_super()
4187 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4193 err = ext4_register_li_request(sb, first_not_zeroed); in ext4_fill_super()
4200 "%s", sb->s_id); in ext4_fill_super()
4206 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) && in ext4_fill_super()
4207 !(sb->s_flags & MS_RDONLY)) { in ext4_fill_super()
4208 err = ext4_enable_quotas(sb); in ext4_fill_super()
4214 EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS; in ext4_fill_super()
4215 ext4_orphan_cleanup(sb, es); in ext4_fill_super()
4216 EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS; in ext4_fill_super()
4218 ext4_msg(sb, KERN_INFO, "recovery complete"); in ext4_fill_super()
4219 ext4_mark_recovery_complete(sb, es); in ext4_fill_super()
4221 if (EXT4_SB(sb)->s_journal) { in ext4_fill_super()
4222 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) in ext4_fill_super()
4224 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) in ext4_fill_super()
4231 if (test_opt(sb, DISCARD)) { in ext4_fill_super()
4232 struct request_queue *q = bdev_get_queue(sb->s_bdev); in ext4_fill_super()
4234 ext4_msg(sb, KERN_WARNING, in ext4_fill_super()
4239 ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. " in ext4_fill_super()
4256 ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); in ext4_fill_super()
4264 ext4_unregister_li_request(sb); in ext4_fill_super()
4266 ext4_mb_release(sb); in ext4_fill_super()
4274 ext4_ext_release(sb); in ext4_fill_super()
4275 ext4_release_system_zone(sb); in ext4_fill_super()
4277 dput(sb->s_root); in ext4_fill_super()
4278 sb->s_root = NULL; in ext4_fill_super()
4280 ext4_msg(sb, KERN_ERR, "mount failed"); in ext4_fill_super()
4281 if (EXT4_SB(sb)->rsv_conversion_wq) in ext4_fill_super()
4282 destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq); in ext4_fill_super()
4303 remove_proc_entry(sb->s_id, ext4_proc_root); in ext4_fill_super()
4312 sb->s_fs_info = NULL; in ext4_fill_super()
4325 static void ext4_init_journal_params(struct super_block *sb, journal_t *journal) in ext4_init_journal_params() argument
4327 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_init_journal_params()
4334 if (test_opt(sb, BARRIER)) in ext4_init_journal_params()
4338 if (test_opt(sb, DATA_ERR_ABORT)) in ext4_init_journal_params()
4345 static journal_t *ext4_get_journal(struct super_block *sb, in ext4_get_journal() argument
4351 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); in ext4_get_journal()
4357 journal_inode = ext4_iget(sb, journal_inum); in ext4_get_journal()
4359 ext4_msg(sb, KERN_ERR, "no journal found"); in ext4_get_journal()
4365 ext4_msg(sb, KERN_ERR, "journal inode is deleted"); in ext4_get_journal()
4372 ext4_msg(sb, KERN_ERR, "invalid journal inode"); in ext4_get_journal()
4379 ext4_msg(sb, KERN_ERR, "Could not load journal inode"); in ext4_get_journal()
4383 journal->j_private = sb; in ext4_get_journal()
4384 ext4_init_journal_params(sb, journal); in ext4_get_journal()
4388 static journal_t *ext4_get_dev_journal(struct super_block *sb, in ext4_get_dev_journal() argument
4401 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); in ext4_get_dev_journal()
4403 bdev = ext4_blkdev_get(j_dev, sb); in ext4_get_dev_journal()
4407 blocksize = sb->s_blocksize; in ext4_get_dev_journal()
4410 ext4_msg(sb, KERN_ERR, in ext4_get_dev_journal()
4419 ext4_msg(sb, KERN_ERR, "couldn't read superblock of " in ext4_get_dev_journal()
4428 ext4_msg(sb, KERN_ERR, "external journal has " in ext4_get_dev_journal()
4436 es->s_checksum != ext4_superblock_csum(sb, es)) { in ext4_get_dev_journal()
4437 ext4_msg(sb, KERN_ERR, "external journal has " in ext4_get_dev_journal()
4443 if (memcmp(EXT4_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) { in ext4_get_dev_journal()
4444 ext4_msg(sb, KERN_ERR, "journal UUID does not match"); in ext4_get_dev_journal()
4453 journal = jbd2_journal_init_dev(bdev, sb->s_bdev, in ext4_get_dev_journal()
4456 ext4_msg(sb, KERN_ERR, "failed to create device journal"); in ext4_get_dev_journal()
4459 journal->j_private = sb; in ext4_get_dev_journal()
4463 ext4_msg(sb, KERN_ERR, "I/O error on journal device"); in ext4_get_dev_journal()
4467 ext4_msg(sb, KERN_ERR, "External journal has more than one " in ext4_get_dev_journal()
4472 EXT4_SB(sb)->journal_bdev = bdev; in ext4_get_dev_journal()
4473 ext4_init_journal_params(sb, journal); in ext4_get_dev_journal()
4483 static int ext4_load_journal(struct super_block *sb, in ext4_load_journal() argument
4493 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); in ext4_load_journal()
4497 ext4_msg(sb, KERN_INFO, "external journal device major/minor " in ext4_load_journal()
4503 really_read_only = bdev_read_only(sb->s_bdev); in ext4_load_journal()
4510 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { in ext4_load_journal()
4511 if (sb->s_flags & MS_RDONLY) { in ext4_load_journal()
4512 ext4_msg(sb, KERN_INFO, "INFO: recovery " in ext4_load_journal()
4515 ext4_msg(sb, KERN_ERR, "write access " in ext4_load_journal()
4519 ext4_msg(sb, KERN_INFO, "write access will " in ext4_load_journal()
4525 ext4_msg(sb, KERN_ERR, "filesystem has both journal " in ext4_load_journal()
4531 if (!(journal = ext4_get_journal(sb, journal_inum))) in ext4_load_journal()
4534 if (!(journal = ext4_get_dev_journal(sb, journal_dev))) in ext4_load_journal()
4539 ext4_msg(sb, KERN_INFO, "barriers disabled"); in ext4_load_journal()
4541 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) in ext4_load_journal()
4556 ext4_msg(sb, KERN_ERR, "error loading journal"); in ext4_load_journal()
4561 EXT4_SB(sb)->s_journal = journal; in ext4_load_journal()
4562 ext4_clear_journal_err(sb, es); in ext4_load_journal()
4569 ext4_commit_super(sb, 1); in ext4_load_journal()
4575 static int ext4_commit_super(struct super_block *sb, int sync) in ext4_commit_super() argument
4577 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in ext4_commit_super()
4578 struct buffer_head *sbh = EXT4_SB(sb)->s_sbh; in ext4_commit_super()
4581 if (!sbh || block_device_ejected(sb)) in ext4_commit_super()
4592 ext4_msg(sb, KERN_ERR, "previous I/O error to " in ext4_commit_super()
4607 if (!(sb->s_flags & MS_RDONLY)) in ext4_commit_super()
4609 if (sb->s_bdev->bd_part) in ext4_commit_super()
4611 cpu_to_le64(EXT4_SB(sb)->s_kbytes_written + in ext4_commit_super()
4612 ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) - in ext4_commit_super()
4613 EXT4_SB(sb)->s_sectors_written_start) >> 1)); in ext4_commit_super()
4616 cpu_to_le64(EXT4_SB(sb)->s_kbytes_written); in ext4_commit_super()
4617 if (percpu_counter_initialized(&EXT4_SB(sb)->s_freeclusters_counter)) in ext4_commit_super()
4619 EXT4_C2B(EXT4_SB(sb), percpu_counter_sum_positive( in ext4_commit_super()
4620 &EXT4_SB(sb)->s_freeclusters_counter))); in ext4_commit_super()
4621 if (percpu_counter_initialized(&EXT4_SB(sb)->s_freeinodes_counter)) in ext4_commit_super()
4624 &EXT4_SB(sb)->s_freeinodes_counter)); in ext4_commit_super()
4626 ext4_superblock_csum_set(sb); in ext4_commit_super()
4635 ext4_msg(sb, KERN_ERR, "I/O error while writing " in ext4_commit_super()
4649 static void ext4_mark_recovery_complete(struct super_block *sb, in ext4_mark_recovery_complete() argument
4652 journal_t *journal = EXT4_SB(sb)->s_journal; in ext4_mark_recovery_complete()
4654 if (!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { in ext4_mark_recovery_complete()
4662 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER) && in ext4_mark_recovery_complete()
4663 sb->s_flags & MS_RDONLY) { in ext4_mark_recovery_complete()
4664 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); in ext4_mark_recovery_complete()
4665 ext4_commit_super(sb, 1); in ext4_mark_recovery_complete()
4677 static void ext4_clear_journal_err(struct super_block *sb, in ext4_clear_journal_err() argument
4684 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); in ext4_clear_journal_err()
4686 journal = EXT4_SB(sb)->s_journal; in ext4_clear_journal_err()
4697 errstr = ext4_decode_error(sb, j_errno, nbuf); in ext4_clear_journal_err()
4698 ext4_warning(sb, "Filesystem error recorded " in ext4_clear_journal_err()
4700 ext4_warning(sb, "Marking fs in need of filesystem check."); in ext4_clear_journal_err()
4702 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; in ext4_clear_journal_err()
4704 ext4_commit_super(sb, 1); in ext4_clear_journal_err()
4715 int ext4_force_commit(struct super_block *sb) in ext4_force_commit() argument
4719 if (sb->s_flags & MS_RDONLY) in ext4_force_commit()
4722 journal = EXT4_SB(sb)->s_journal; in ext4_force_commit()
4726 static int ext4_sync_fs(struct super_block *sb, int wait) in ext4_sync_fs() argument
4731 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_sync_fs()
4733 trace_ext4_sync_fs(sb, wait); in ext4_sync_fs()
4739 dquot_writeback_dquots(sb, -1); in ext4_sync_fs()
4756 } else if (wait && test_opt(sb, BARRIER)) in ext4_sync_fs()
4760 err = blkdev_issue_flush(sb->s_bdev, GFP_KERNEL, NULL); in ext4_sync_fs()
4776 static int ext4_freeze(struct super_block *sb) in ext4_freeze() argument
4781 if (sb->s_flags & MS_RDONLY) in ext4_freeze()
4784 journal = EXT4_SB(sb)->s_journal; in ext4_freeze()
4800 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); in ext4_freeze()
4801 error = ext4_commit_super(sb, 1); in ext4_freeze()
4813 static int ext4_unfreeze(struct super_block *sb) in ext4_unfreeze() argument
4815 if (sb->s_flags & MS_RDONLY) in ext4_unfreeze()
4819 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); in ext4_unfreeze()
4820 ext4_commit_super(sb, 1); in ext4_unfreeze()
4840 static int ext4_remount(struct super_block *sb, int *flags, char *data) in ext4_remount() argument
4843 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_remount()
4856 old_sb_flags = sb->s_flags; in ext4_remount()
4885 if (!parse_options(data, sb, NULL, &journal_ioprio, 1)) { in ext4_remount()
4891 test_opt(sb, JOURNAL_CHECKSUM)) { in ext4_remount()
4892 ext4_msg(sb, KERN_ERR, "changing journal_checksum " in ext4_remount()
4898 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { in ext4_remount()
4899 if (test_opt2(sb, EXPLICIT_DELALLOC)) { in ext4_remount()
4900 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_remount()
4905 if (test_opt(sb, DIOREAD_NOLOCK)) { in ext4_remount()
4906 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_remount()
4914 ext4_abort(sb, "Abort forced by user"); in ext4_remount()
4916 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | in ext4_remount()
4917 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); in ext4_remount()
4922 ext4_init_journal_params(sb, sbi->s_journal); in ext4_remount()
4926 if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { in ext4_remount()
4933 err = sync_filesystem(sb); in ext4_remount()
4936 err = dquot_suspend(sb, -1); in ext4_remount()
4944 sb->s_flags |= MS_RDONLY; in ext4_remount()
4956 ext4_mark_recovery_complete(sb, es); in ext4_remount()
4959 if (!ext4_feature_set_ok(sb, 0)) { in ext4_remount()
4969 ext4_get_group_desc(sb, g, NULL); in ext4_remount()
4971 if (!ext4_group_desc_csum_verify(sb, g, gdp)) { in ext4_remount()
4972 ext4_msg(sb, KERN_ERR, in ext4_remount()
4987 ext4_msg(sb, KERN_WARNING, "Couldn't " in ext4_remount()
5002 ext4_clear_journal_err(sb, es); in ext4_remount()
5004 if (!ext4_setup_super(sb, es, 0)) in ext4_remount()
5005 sb->s_flags &= ~MS_RDONLY; in ext4_remount()
5006 if (EXT4_HAS_INCOMPAT_FEATURE(sb, in ext4_remount()
5008 if (ext4_multi_mount_protect(sb, in ext4_remount()
5021 if ((sb->s_flags & MS_RDONLY) || !test_opt(sb, INIT_INODE_TABLE)) in ext4_remount()
5022 ext4_unregister_li_request(sb); in ext4_remount()
5025 first_not_zeroed = ext4_has_uninit_itable(sb); in ext4_remount()
5026 ext4_register_li_request(sb, first_not_zeroed); in ext4_remount()
5029 ext4_setup_system_zone(sb); in ext4_remount()
5031 ext4_commit_super(sb, 1); in ext4_remount()
5038 if (sb_any_quota_suspended(sb)) in ext4_remount()
5039 dquot_resume(sb, -1); in ext4_remount()
5040 else if (EXT4_HAS_RO_COMPAT_FEATURE(sb, in ext4_remount()
5042 err = ext4_enable_quotas(sb); in ext4_remount()
5049 ext4_msg(sb, KERN_INFO, "re-mounted. Opts: %s", orig_data); in ext4_remount()
5054 sb->s_flags = old_sb_flags; in ext4_remount()
5075 struct super_block *sb = dentry->d_sb; in ext4_statfs() local
5076 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_statfs()
5083 if (!test_opt(sb, MINIX_DF)) in ext4_statfs()
5087 buf->f_bsize = sb->s_blocksize; in ext4_statfs()
5180 struct super_block *sb = dquot->dq_sb; in ext4_mark_dquot_dirty() local
5181 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_mark_dquot_dirty()
5184 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) || in ext4_mark_dquot_dirty()
5193 static int ext4_write_info(struct super_block *sb, int type) in ext4_write_info() argument
5199 handle = ext4_journal_start(sb->s_root->d_inode, EXT4_HT_QUOTA, 2); in ext4_write_info()
5202 ret = dquot_commit_info(sb, type); in ext4_write_info()
5213 static int ext4_quota_on_mount(struct super_block *sb, int type) in ext4_quota_on_mount() argument
5215 return dquot_quota_on_mount(sb, EXT4_SB(sb)->s_qf_names[type], in ext4_quota_on_mount()
5216 EXT4_SB(sb)->s_jquota_fmt, type); in ext4_quota_on_mount()
5222 static int ext4_quota_on(struct super_block *sb, int type, int format_id, in ext4_quota_on() argument
5227 if (!test_opt(sb, QUOTA)) in ext4_quota_on()
5231 if (path->dentry->d_sb != sb) in ext4_quota_on()
5234 if (EXT4_SB(sb)->s_qf_names[type]) { in ext4_quota_on()
5236 if (path->dentry->d_parent != sb->s_root) in ext4_quota_on()
5237 ext4_msg(sb, KERN_WARNING, in ext4_quota_on()
5246 if (EXT4_SB(sb)->s_journal && in ext4_quota_on()
5252 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); in ext4_quota_on()
5253 err = jbd2_journal_flush(EXT4_SB(sb)->s_journal); in ext4_quota_on()
5254 jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); in ext4_quota_on()
5259 return dquot_quota_on(sb, type, format_id, path); in ext4_quota_on()
5262 static int ext4_quota_enable(struct super_block *sb, int type, int format_id, in ext4_quota_enable() argument
5268 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum), in ext4_quota_enable()
5269 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum) in ext4_quota_enable()
5272 BUG_ON(!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)); in ext4_quota_enable()
5277 qf_inode = ext4_iget(sb, qf_inums[type]); in ext4_quota_enable()
5279 ext4_error(sb, "Bad quota inode # %lu", qf_inums[type]); in ext4_quota_enable()
5292 static int ext4_enable_quotas(struct super_block *sb) in ext4_enable_quotas() argument
5296 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum), in ext4_enable_quotas()
5297 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum) in ext4_enable_quotas()
5300 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE; in ext4_enable_quotas()
5303 err = ext4_quota_enable(sb, type, QFMT_VFS_V1, in ext4_enable_quotas()
5306 ext4_warning(sb, in ext4_enable_quotas()
5320 static int ext4_quota_on_sysfile(struct super_block *sb, int type, in ext4_quota_on_sysfile() argument
5323 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) in ext4_quota_on_sysfile()
5329 return ext4_quota_enable(sb, type, format_id, DQUOT_LIMITS_ENABLED); in ext4_quota_on_sysfile()
5332 static int ext4_quota_off(struct super_block *sb, int type) in ext4_quota_off() argument
5334 struct inode *inode = sb_dqopt(sb)->files[type]; in ext4_quota_off()
5339 if (test_opt(sb, DELALLOC)) in ext4_quota_off()
5340 sync_filesystem(sb); in ext4_quota_off()
5355 return dquot_quota_off(sb, type); in ext4_quota_off()
5361 static int ext4_quota_off_sysfile(struct super_block *sb, int type) in ext4_quota_off_sysfile() argument
5363 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) in ext4_quota_off_sysfile()
5367 return dquot_disable(sb, type, DQUOT_LIMITS_ENABLED); in ext4_quota_off_sysfile()
5374 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, in ext4_quota_read() argument
5377 struct inode *inode = sb_dqopt(sb)->files[type]; in ext4_quota_read()
5378 ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); in ext4_quota_read()
5379 int offset = off & (sb->s_blocksize - 1); in ext4_quota_read()
5391 tocopy = sb->s_blocksize - offset < toread ? in ext4_quota_read()
5392 sb->s_blocksize - offset : toread; in ext4_quota_read()
5411 static ssize_t ext4_quota_write(struct super_block *sb, int type, in ext4_quota_write() argument
5414 struct inode *inode = sb_dqopt(sb)->files[type]; in ext4_quota_write()
5415 ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); in ext4_quota_write()
5416 int err, offset = off & (sb->s_blocksize - 1); in ext4_quota_write()
5420 if (EXT4_SB(sb)->s_journal && !handle) { in ext4_quota_write()
5421 ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" in ext4_quota_write()
5430 if (sb->s_blocksize - offset < len) { in ext4_quota_write()
5431 ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" in ext4_quota_write()
5485 static inline int ext2_feature_set_ok(struct super_block *sb) in ext2_feature_set_ok() argument
5487 if (EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP)) in ext2_feature_set_ok()
5489 if (sb->s_flags & MS_RDONLY) in ext2_feature_set_ok()
5491 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP)) in ext2_feature_set_ok()
5498 static inline int ext2_feature_set_ok(struct super_block *sb) { return 0; } in ext2_feature_set_ok() argument
5515 static inline int ext3_feature_set_ok(struct super_block *sb) in ext3_feature_set_ok() argument
5517 if (EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP)) in ext3_feature_set_ok()
5519 if (!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) in ext3_feature_set_ok()
5521 if (sb->s_flags & MS_RDONLY) in ext3_feature_set_ok()
5523 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP)) in ext3_feature_set_ok()
5530 static inline int ext3_feature_set_ok(struct super_block *sb) { return 0; } in ext3_feature_set_ok() argument